diff --git a/src/main/java/io/github/teampropulsive/space/rocket/RocketEntity.java b/src/main/java/io/github/teampropulsive/space/rocket/RocketEntity.java index 7088132..1590c70 100644 --- a/src/main/java/io/github/teampropulsive/space/rocket/RocketEntity.java +++ b/src/main/java/io/github/teampropulsive/space/rocket/RocketEntity.java @@ -1,5 +1,6 @@ package io.github.teampropulsive.space.rocket; +import io.github.teampropulsive.space.spacecraft.SpacecraftEntity; import io.github.teampropulsive.types.Planet; import net.minecraft.entity.EntityType; import net.minecraft.entity.attribute.EntityAttributes; @@ -15,42 +16,27 @@ import static io.github.teampropulsive.Propulsive.SPACE; import static io.github.teampropulsive.Propulsive.TICKABLE_PLANETS; -public class RocketEntity extends AbstractHorseEntity { +public class RocketEntity extends SpacecraftEntity { public boolean hasWarpAbility = false; public Vec3d velocity; + public Vec3d dockingPosition; public float storedOxygen = 0; - - public RocketEntity(EntityType entityType, World world) { - super((EntityType) entityType, world); - } - @Override - public boolean canBeSaddled() { - return false; - } - @Override - public boolean isSaddled() { - return true; - } - @Override - public EntityView method_48926() { - return null; + public float maxOxygen = 1000; // We can settle on a number here later + public RocketEntity(EntityType entityType, World world) { + super(entityType, world); } @Override - public boolean isAiDisabled() { - return true; + public boolean canJump() { + return hasWarpAbility; } @Override - public void tick() { - super.tick(); + protected void jump(float strength, Vec3d movementInput) { + //super.jump(strength, movementInput); } - @Override - public boolean isOnGround() { // it's on the ground I swear! - return true; - } @Override protected Vec3d getControlledMovementInput(PlayerEntity controllingPlayer, Vec3d movementInput) { Vec3d a = controllingPlayer.getRotationVecClient(); @@ -59,41 +45,9 @@ protected Vec3d getControlledMovementInput(PlayerEntity controllingPlayer, Vec3d float z = (float) a.z; return new Vec3d(x, y, z); } + @Override protected float getSaddledSpeed(PlayerEntity controllingPlayer) { return (float)this.getAttributeValue(EntityAttributes.GENERIC_MOVEMENT_SPEED); } - - @Override - public boolean isTame() { - return true; - } - - @Override - public boolean canJump() { - return hasWarpAbility; - } - - @Override - protected void jump(float strength, Vec3d movementInput) { - //super.jump(strength, movementInput); - } - - - protected Vec3d calculateGravity() { - Vec3d velocity = Vec3d.ZERO; - if (this.getWorld().getRegistryKey() == SPACE) { - for (Planet planet : TICKABLE_PLANETS) { - Vec3d distanceDirection = planet.currentPos.subtract(this.getPos()); - velocity.add( - new Vec3d( - distanceDirection.x * planet.planetSize, - distanceDirection.y * planet.planetSize, - distanceDirection.z * planet.planetSize - ) - ); - } - } - return velocity; - } } \ No newline at end of file diff --git a/src/main/java/io/github/teampropulsive/space/spacecraft/SpacecraftEntity.java b/src/main/java/io/github/teampropulsive/space/spacecraft/SpacecraftEntity.java new file mode 100644 index 0000000..e62d53a --- /dev/null +++ b/src/main/java/io/github/teampropulsive/space/spacecraft/SpacecraftEntity.java @@ -0,0 +1,71 @@ +package io.github.teampropulsive.space.spacecraft; + +import io.github.teampropulsive.types.Planet; +import net.minecraft.entity.EntityType; +import net.minecraft.entity.attribute.EntityAttributes; +import net.minecraft.entity.passive.AbstractHorseEntity; +import net.minecraft.entity.player.PlayerEntity; +import net.minecraft.util.math.Vec3d; +import net.minecraft.world.EntityView; +import net.minecraft.world.World; + +import static io.github.teampropulsive.Propulsive.SPACE; +import static io.github.teampropulsive.Propulsive.TICKABLE_PLANETS; + +public class SpacecraftEntity extends AbstractHorseEntity { + + protected SpacecraftEntity(EntityType entityType, World world) { + super(entityType, world); + } + @Override + public boolean canBeSaddled() { + return false; + } + @Override + public boolean isSaddled() { + return true; + } + @Override + public EntityView method_48926() { + return null; + } + + @Override + public boolean isAiDisabled() { + return true; + } + + @Override + public void tick() { + super.tick(); + } + + @Override + public boolean isOnGround() { // it's on the ground I swear! + return true; + } + + + + @Override + public boolean isTame() { + return true; + } + + protected Vec3d calculateGravity() { + Vec3d velocity = Vec3d.ZERO; + if (this.getWorld().getRegistryKey() == SPACE) { + for (Planet planet : TICKABLE_PLANETS) { + Vec3d distanceDirection = planet.currentPos.subtract(this.getPos()); + velocity.add( + new Vec3d( + distanceDirection.x * planet.planetSize, + distanceDirection.y * planet.planetSize, + distanceDirection.z * planet.planetSize + ) + ); + } + } + return velocity; + } +} \ No newline at end of file diff --git a/src/main/java/io/github/teampropulsive/space/station/StationEntity.java b/src/main/java/io/github/teampropulsive/space/station/StationEntity.java new file mode 100644 index 0000000..a142f33 --- /dev/null +++ b/src/main/java/io/github/teampropulsive/space/station/StationEntity.java @@ -0,0 +1,4 @@ +package io.github.teampropulsive.space.station; + +public class StationEntity { +}