-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
d4446bf
commit 57d024f
Showing
3 changed files
with
86 additions
and
57 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
71 changes: 71 additions & 0 deletions
71
src/main/java/io/github/teampropulsive/space/spacecraft/SpacecraftEntity.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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<? extends AbstractHorseEntity> 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; | ||
} | ||
} |
4 changes: 4 additions & 0 deletions
4
src/main/java/io/github/teampropulsive/space/station/StationEntity.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
package io.github.teampropulsive.space.station; | ||
|
||
public class StationEntity { | ||
} |