bop boats now extends BoatEntity

This commit is contained in:
Corail31 2019-07-30 02:17:25 +02:00
parent c341b1d687
commit ce1cdff408
6 changed files with 123 additions and 235 deletions

View file

@ -8,8 +8,9 @@
package biomesoplenty.api.entity; package biomesoplenty.api.entity;
import net.minecraft.entity.EntityType; import net.minecraft.entity.EntityType;
import net.minecraft.entity.item.BoatEntity;
public class BOPEntities public class BOPEntities
{ {
public static EntityType<?> boat_bop; public static EntityType<? extends BoatEntity> boat_bop;
} }

View file

@ -6,7 +6,6 @@ import biomesoplenty.api.item.BOPItems;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.block.BlockState; import net.minecraft.block.BlockState;
import net.minecraft.block.LilyPadBlock; import net.minecraft.block.LilyPadBlock;
import net.minecraft.client.entity.player.ClientPlayerEntity;
import net.minecraft.entity.Entity; import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityType; import net.minecraft.entity.EntityType;
import net.minecraft.entity.LivingEntity; import net.minecraft.entity.LivingEntity;
@ -26,7 +25,11 @@ import net.minecraft.network.datasync.EntityDataManager;
import net.minecraft.network.play.client.CSteerBoatPacket; import net.minecraft.network.play.client.CSteerBoatPacket;
import net.minecraft.particles.ParticleTypes; import net.minecraft.particles.ParticleTypes;
import net.minecraft.tags.FluidTags; import net.minecraft.tags.FluidTags;
import net.minecraft.util.*; import net.minecraft.util.DamageSource;
import net.minecraft.util.EntityPredicates;
import net.minecraft.util.IndirectEntityDamageSource;
import net.minecraft.util.SoundEvent;
import net.minecraft.util.SoundEvents;
import net.minecraft.util.math.AxisAlignedBB; import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.MathHelper; import net.minecraft.util.math.MathHelper;
@ -44,7 +47,7 @@ import net.minecraftforge.fml.network.NetworkHooks;
import javax.annotation.Nullable; import javax.annotation.Nullable;
import java.util.List; import java.util.List;
public class BoatEntityBOP extends Entity { public class BoatEntityBOP extends BoatEntity {
private static final DataParameter<Integer> TIME_SINCE_HIT = EntityDataManager.createKey(BoatEntityBOP.class, DataSerializers.VARINT); private static final DataParameter<Integer> TIME_SINCE_HIT = EntityDataManager.createKey(BoatEntityBOP.class, DataSerializers.VARINT);
private static final DataParameter<Integer> FORWARD_DIRECTION = EntityDataManager.createKey(BoatEntityBOP.class, DataSerializers.VARINT); private static final DataParameter<Integer> FORWARD_DIRECTION = EntityDataManager.createKey(BoatEntityBOP.class, DataSerializers.VARINT);
private static final DataParameter<Float> DAMAGE_TAKEN = EntityDataManager.createKey(BoatEntityBOP.class, DataSerializers.FLOAT); private static final DataParameter<Float> DAMAGE_TAKEN = EntityDataManager.createKey(BoatEntityBOP.class, DataSerializers.FLOAT);
@ -68,8 +71,8 @@ public class BoatEntityBOP extends Entity {
private boolean backInputDown; private boolean backInputDown;
private double waterLevel; private double waterLevel;
private float boatGlide; private float boatGlide;
private BoatEntityBOP.Status status; private Status status;
private BoatEntityBOP.Status previousStatus; private Status previousStatus;
private double lastYd; private double lastYd;
private boolean rocking; private boolean rocking;
private boolean field_203060_aN; private boolean field_203060_aN;
@ -77,7 +80,7 @@ public class BoatEntityBOP extends Entity {
private float rockingAngle; private float rockingAngle;
private float prevRockingAngle; private float prevRockingAngle;
public BoatEntityBOP(EntityType<?> p_i50129_1_, World p_i50129_2_) { public BoatEntityBOP(EntityType<? extends BoatEntity> p_i50129_1_, World p_i50129_2_) {
super(p_i50129_1_, p_i50129_2_); super(p_i50129_1_, p_i50129_2_);
this.preventEntitySpawning = true; this.preventEntitySpawning = true;
} }
@ -95,14 +98,7 @@ public class BoatEntityBOP extends Entity {
this(BOPEntities.boat_bop, world); this(BOPEntities.boat_bop, world);
} }
/** @Override
* returns if this entity triggers Block.onEntityWalking on the blocks they walk on. used for spiders and wolves to
* prevent them from trampling crops
*/
protected boolean canTriggerWalking() {
return false;
}
protected void registerData() { protected void registerData() {
this.dataManager.register(TIME_SINCE_HIT, 0); this.dataManager.register(TIME_SINCE_HIT, 0);
this.dataManager.register(FORWARD_DIRECTION, 1); this.dataManager.register(FORWARD_DIRECTION, 1);
@ -113,37 +109,10 @@ public class BoatEntityBOP extends Entity {
this.dataManager.register(ROCKING_TICKS, 0); this.dataManager.register(ROCKING_TICKS, 0);
} }
/**
* Returns a boundingBox used to collide the entity with other entities and blocks. This enables the entity to be
* pushable on contact, like boats or minecarts.
*/
@Nullable
public AxisAlignedBB getCollisionBox(Entity entityIn) {
return entityIn.canBePushed() ? entityIn.getBoundingBox() : null;
}
@Nullable
public AxisAlignedBB getCollisionBoundingBox() {
return this.getBoundingBox();
}
/**
* Returns true if this entity should push and be pushed by other entities when colliding.
*/
public boolean canBePushed() {
return true;
}
/**
* Returns the Y offset from the entity's position for any entity riding this one.
*/
public double getMountedYOffset() {
return -0.1D;
}
/** /**
* Called when the entity is attacked. * Called when the entity is attacked.
*/ */
@Override
public boolean attackEntityFrom(DamageSource source, float amount) { public boolean attackEntityFrom(DamageSource source, float amount) {
if (this.isInvulnerableTo(source)) { if (this.isInvulnerableTo(source)) {
return false; return false;
@ -155,7 +124,7 @@ public class BoatEntityBOP extends Entity {
this.setTimeSinceHit(10); this.setTimeSinceHit(10);
this.setDamageTaken(this.getDamageTaken() + amount * 10.0F); this.setDamageTaken(this.getDamageTaken() + amount * 10.0F);
this.markVelocityChanged(); this.markVelocityChanged();
boolean flag = source.getTrueSource() instanceof PlayerEntity && ((PlayerEntity)source.getTrueSource()).abilities.isCreativeMode; boolean flag = source.getTrueSource() instanceof PlayerEntity && ((PlayerEntity) source.getTrueSource()).abilities.isCreativeMode;
if (flag || this.getDamageTaken() > 40.0F) { if (flag || this.getDamageTaken() > 40.0F) {
if (!flag && this.world.getGameRules().getBoolean(GameRules.DO_ENTITY_DROPS)) { if (!flag && this.world.getGameRules().getBoolean(GameRules.DO_ENTITY_DROPS)) {
this.entityDropItem(this.getItemBoat()); this.entityDropItem(this.getItemBoat());
@ -163,7 +132,6 @@ public class BoatEntityBOP extends Entity {
this.remove(); this.remove();
} }
return true; return true;
} }
} else { } else {
@ -171,6 +139,7 @@ public class BoatEntityBOP extends Entity {
} }
} }
@Override
public void onEnterBubbleColumnWithAirAbove(boolean downwards) { public void onEnterBubbleColumnWithAirAbove(boolean downwards) {
if (!this.world.isRemote) { if (!this.world.isRemote) {
this.rocking = true; this.rocking = true;
@ -179,30 +148,15 @@ public class BoatEntityBOP extends Entity {
this.setRockingTicks(60); this.setRockingTicks(60);
} }
} }
this.world.addParticle(ParticleTypes.SPLASH, this.posX + (double) this.rand.nextFloat(), this.posY + 0.7D, this.posZ + (double) this.rand.nextFloat(), 0.0D, 0.0D, 0.0D);
this.world.addParticle(ParticleTypes.SPLASH, this.posX + (double)this.rand.nextFloat(), this.posY + 0.7D, this.posZ + (double)this.rand.nextFloat(), 0.0D, 0.0D, 0.0D);
if (this.rand.nextInt(20) == 0) { if (this.rand.nextInt(20) == 0) {
this.world.playSound(this.posX, this.posY, this.posZ, this.getSplashSound(), this.getSoundCategory(), 1.0F, 0.8F + 0.4F * this.rand.nextFloat(), false); this.world.playSound(this.posX, this.posY, this.posZ, this.getSplashSound(), this.getSoundCategory(), 1.0F, 0.8F + 0.4F * this.rand.nextFloat(), false);
} }
}
/**
* Applies a velocity to the entities, to push them away from eachother.
*/
public void applyEntityCollision(Entity entityIn) {
if (entityIn instanceof BoatEntity) {
if (entityIn.getBoundingBox().minY < this.getBoundingBox().maxY) {
super.applyEntityCollision(entityIn);
}
} else if (entityIn.getBoundingBox().minY <= this.getBoundingBox().minY) {
super.applyEntityCollision(entityIn);
}
} }
@Override
public Item getItemBoat() { public Item getItemBoat() {
switch(this.getBoatType()) { switch (this.getBoatModel()) {
case FIR: case FIR:
default: default:
return BOPItems.fir_boat; return BOPItems.fir_boat;
@ -234,6 +188,7 @@ public class BoatEntityBOP extends Entity {
/** /**
* Setups the entity to do the hurt animation. Only used by packets in multiplayer. * Setups the entity to do the hurt animation. Only used by packets in multiplayer.
*/ */
@Override
@OnlyIn(Dist.CLIENT) @OnlyIn(Dist.CLIENT)
public void performHurtAnimation() { public void performHurtAnimation() {
this.setForwardDirection(-this.getForwardDirection()); this.setForwardDirection(-this.getForwardDirection());
@ -241,50 +196,14 @@ public class BoatEntityBOP extends Entity {
this.setDamageTaken(this.getDamageTaken() * 11.0F); this.setDamageTaken(this.getDamageTaken() * 11.0F);
} }
/**
* Returns true if other Entities should be prevented from moving through this Entity.
*/
public boolean canBeCollidedWith() {
return !this.removed;
}
/**
* Sets a target for the client to interpolate towards over the next few ticks
*/
@OnlyIn(Dist.CLIENT)
public void setPositionAndRotationDirect(double x, double y, double z, float yaw, float pitch, int posRotationIncrements, boolean teleport) {
this.lerpX = x;
this.lerpY = y;
this.lerpZ = z;
this.lerpYaw = (double)yaw;
this.lerpPitch = (double)pitch;
this.lerpSteps = 10;
}
/**
* Gets the horizontal facing direction of this Entity, adjusted to take specially-treated entity types into account.
*/
public Direction getAdjustedHorizontalFacing() {
return this.getHorizontalFacing().rotateY();
}
/** /**
* Called to update the entity's position/logic. * Called to update the entity's position/logic.
*/ */
@Override @Override
public void tick() { public void tick() {
if (this.world.isRemote) {
Entity rider = getControllingPassenger();
if (rider instanceof PlayerEntity) {
ClientPlayerEntity player = (ClientPlayerEntity) rider;
updateInputs(player.movementInput.leftKeyDown, player.movementInput.rightKeyDown, player.movementInput.forwardKeyDown, player.movementInput.backKeyDown);
player.rowingBoat |= player.movementInput.leftKeyDown || player.movementInput.rightKeyDown || player.movementInput.forwardKeyDown || player.movementInput.backKeyDown;
}
}
this.previousStatus = this.status; this.previousStatus = this.status;
this.status = this.getBoatStatus(); this.status = this.getBoatStatus();
if (this.status != BoatEntityBOP.Status.UNDER_WATER && this.status != BoatEntityBOP.Status.UNDER_FLOWING_WATER) { if (this.status != Status.UNDER_WATER && this.status != Status.UNDER_FLOWING_WATER) {
this.outOfControlTicks = 0.0F; this.outOfControlTicks = 0.0F;
} else { } else {
++this.outOfControlTicks; ++this.outOfControlTicks;
@ -305,7 +224,13 @@ public class BoatEntityBOP extends Entity {
this.prevPosX = this.posX; this.prevPosX = this.posX;
this.prevPosY = this.posY; this.prevPosY = this.posY;
this.prevPosZ = this.posZ; this.prevPosZ = this.posZ;
super.tick();
// !!! this is the super of BoatEntity !!!
if (!this.world.isRemote) {
this.setFlag(6, this.isGlowing());
}
baseTick();
this.tickLerp(); this.tickLerp();
if (this.canPassengerSteer()) { if (this.canPassengerSteer()) {
if (this.getPassengers().isEmpty() || !(this.getPassengers().get(0) instanceof PlayerEntity)) { if (this.getPassengers().isEmpty() || !(this.getPassengers().get(0) instanceof PlayerEntity)) {
@ -325,30 +250,30 @@ public class BoatEntityBOP extends Entity {
this.updateRocking(); this.updateRocking();
for(int i = 0; i <= 1; ++i) { for (int i = 0; i <= 1; ++i) {
if (this.getPaddleState(i)) { if (this.getPaddleState(i)) {
if (!this.isSilent() && (double)(this.paddlePositions[i] % ((float)Math.PI * 2F)) <= (double)((float)Math.PI / 4F) && ((double)this.paddlePositions[i] + (double)((float)Math.PI / 8F)) % (double)((float)Math.PI * 2F) >= (double)((float)Math.PI / 4F)) { if (!this.isSilent() && (double) (this.paddlePositions[i] % ((float) Math.PI * 2F)) <= (double) ((float) Math.PI / 4F) && ((double) this.paddlePositions[i] + (double) ((float) Math.PI / 8F)) % (double) ((float) Math.PI * 2F) >= (double) ((float) Math.PI / 4F)) {
SoundEvent soundevent = this.getPaddleSound(); SoundEvent soundevent = this.getPaddleSound();
if (soundevent != null) { if (soundevent != null) {
Vec3d vec3d = this.getLook(1.0F); Vec3d vec3d = this.getLook(1.0F);
double d0 = i == 1 ? -vec3d.z : vec3d.z; double d0 = i == 1 ? -vec3d.z : vec3d.z;
double d1 = i == 1 ? vec3d.x : -vec3d.x; double d1 = i == 1 ? vec3d.x : -vec3d.x;
this.world.playSound((PlayerEntity)null, this.posX + d0, this.posY, this.posZ + d1, soundevent, this.getSoundCategory(), 1.0F, 0.8F + 0.4F * this.rand.nextFloat()); this.world.playSound((PlayerEntity) null, this.posX + d0, this.posY, this.posZ + d1, soundevent, this.getSoundCategory(), 1.0F, 0.8F + 0.4F * this.rand.nextFloat());
} }
} }
this.paddlePositions[i] = (float)((double)this.paddlePositions[i] + (double)((float)Math.PI / 8F)); this.paddlePositions[i] = (float) ((double) this.paddlePositions[i] + (double) ((float) Math.PI / 8F));
} else { } else {
this.paddlePositions[i] = 0.0F; this.paddlePositions[i] = 0.0F;
} }
} }
this.doBlockCollisions(); this.doBlockCollisions();
List<Entity> list = this.world.getEntitiesInAABBexcluding(this, this.getBoundingBox().grow((double)0.2F, (double)-0.01F, (double)0.2F), EntityPredicates.pushableBy(this)); List<Entity> list = this.world.getEntitiesInAABBexcluding(this, this.getBoundingBox().grow((double) 0.2F, (double) -0.01F, (double) 0.2F), EntityPredicates.pushableBy(this));
if (!list.isEmpty()) { if (!list.isEmpty()) {
boolean flag = !this.world.isRemote && !(this.getControllingPassenger() instanceof PlayerEntity); boolean flag = !this.world.isRemote && !(this.getControllingPassenger() instanceof PlayerEntity);
for(int j = 0; j < list.size(); ++j) { for (int j = 0; j < list.size(); ++j) {
Entity entity = list.get(j); Entity entity = list.get(j);
if (!entity.isPassenger(this)) { if (!entity.isPassenger(this)) {
if (flag && this.getPassengers().size() < 2 && !entity.isPassenger() && entity.getWidth() < this.getWidth() && entity instanceof LivingEntity && !(entity instanceof WaterMobEntity) && !(entity instanceof PlayerEntity)) { if (flag && this.getPassengers().size() < 2 && !entity.isPassenger() && entity.getWidth() < this.getWidth() && entity instanceof LivingEntity && !(entity instanceof WaterMobEntity) && !(entity instanceof PlayerEntity)) {
@ -359,7 +284,6 @@ public class BoatEntityBOP extends Entity {
} }
} }
} }
} }
private void updateRocking() { private void updateRocking() {
@ -373,7 +297,7 @@ public class BoatEntityBOP extends Entity {
this.rockingIntensity = MathHelper.clamp(this.rockingIntensity, 0.0F, 1.0F); this.rockingIntensity = MathHelper.clamp(this.rockingIntensity, 0.0F, 1.0F);
this.prevRockingAngle = this.rockingAngle; this.prevRockingAngle = this.rockingAngle;
this.rockingAngle = 10.0F * (float)Math.sin((double)(0.5F * (float)this.world.getGameTime())) * this.rockingIntensity; this.rockingAngle = 10.0F * (float) Math.sin((double) (0.5F * (float) this.world.getGameTime())) * this.rockingIntensity;
} else { } else {
if (!this.rocking) { if (!this.rocking) {
this.setRockingTicks(0); this.setRockingTicks(0);
@ -398,12 +322,12 @@ public class BoatEntityBOP extends Entity {
this.rocking = false; this.rocking = false;
} }
} }
} }
@Override
@Nullable @Nullable
protected SoundEvent getPaddleSound() { protected SoundEvent getPaddleSound() {
switch(this.getBoatStatus()) { switch (this.getBoatStatus()) {
case IN_WATER: case IN_WATER:
case UNDER_WATER: case UNDER_WATER:
case UNDER_FLOWING_WATER: case UNDER_FLOWING_WATER:
@ -418,49 +342,52 @@ public class BoatEntityBOP extends Entity {
private void tickLerp() { private void tickLerp() {
if (this.lerpSteps > 0 && !this.canPassengerSteer()) { if (this.lerpSteps > 0 && !this.canPassengerSteer()) {
double d0 = this.posX + (this.lerpX - this.posX) / (double)this.lerpSteps; double d0 = this.posX + (this.lerpX - this.posX) / (double) this.lerpSteps;
double d1 = this.posY + (this.lerpY - this.posY) / (double)this.lerpSteps; double d1 = this.posY + (this.lerpY - this.posY) / (double) this.lerpSteps;
double d2 = this.posZ + (this.lerpZ - this.posZ) / (double)this.lerpSteps; double d2 = this.posZ + (this.lerpZ - this.posZ) / (double) this.lerpSteps;
double d3 = MathHelper.wrapDegrees(this.lerpYaw - (double)this.rotationYaw); double d3 = MathHelper.wrapDegrees(this.lerpYaw - (double) this.rotationYaw);
this.rotationYaw = (float)((double)this.rotationYaw + d3 / (double)this.lerpSteps); this.rotationYaw = (float) ((double) this.rotationYaw + d3 / (double) this.lerpSteps);
this.rotationPitch = (float)((double)this.rotationPitch + (this.lerpPitch - (double)this.rotationPitch) / (double)this.lerpSteps); this.rotationPitch = (float) ((double) this.rotationPitch + (this.lerpPitch - (double) this.rotationPitch) / (double) this.lerpSteps);
--this.lerpSteps; --this.lerpSteps;
this.setPosition(d0, d1, d2); this.setPosition(d0, d1, d2);
this.setRotation(this.rotationYaw, this.rotationPitch); this.setRotation(this.rotationYaw, this.rotationPitch);
} }
} }
@Override
public void setPaddleState(boolean left, boolean right) { public void setPaddleState(boolean left, boolean right) {
this.dataManager.set(field_199704_e, left); this.dataManager.set(field_199704_e, left);
this.dataManager.set(field_199705_f, right); this.dataManager.set(field_199705_f, right);
} }
@Override
@OnlyIn(Dist.CLIENT) @OnlyIn(Dist.CLIENT)
public float getRowingTime(int side, float limbSwing) { public float getRowingTime(int side, float limbSwing) {
return this.getPaddleState(side) ? (float)MathHelper.clampedLerp((double)this.paddlePositions[side] - (double)((float)Math.PI / 8F), (double)this.paddlePositions[side], (double)limbSwing) : 0.0F; return this.getPaddleState(side) ? (float) MathHelper.clampedLerp((double) this.paddlePositions[side] - (double) ((float) Math.PI / 8F), (double) this.paddlePositions[side], (double) limbSwing) : 0.0F;
} }
/** /**
* Determines whether the boat is in water, gliding on land, or in air * Determines whether the boat is in water, gliding on land, or in air
*/ */
private BoatEntityBOP.Status getBoatStatus() { private Status getBoatStatus() {
BoatEntityBOP.Status boatentity$status = this.getUnderwaterStatus(); Status boatentity$status = this.getUnderwaterStatus();
if (boatentity$status != null) { if (boatentity$status != null) {
this.waterLevel = this.getBoundingBox().maxY; this.waterLevel = this.getBoundingBox().maxY;
return boatentity$status; return boatentity$status;
} else if (this.checkInWater()) { } else if (this.checkInWater()) {
return BoatEntityBOP.Status.IN_WATER; return Status.IN_WATER;
} else { } else {
float f = this.getBoatGlide(); float f = this.getBoatGlide();
if (f > 0.0F) { if (f > 0.0F) {
this.boatGlide = f; this.boatGlide = f;
return BoatEntityBOP.Status.ON_LAND; return Status.ON_LAND;
} else { } else {
return BoatEntityBOP.Status.IN_AIR; return Status.IN_AIR;
} }
} }
} }
@Override
public float getWaterLevelAbove() { public float getWaterLevelAbove() {
AxisAlignedBB axisalignedbb = this.getBoundingBox(); AxisAlignedBB axisalignedbb = this.getBoundingBox();
int i = MathHelper.floor(axisalignedbb.minX); int i = MathHelper.floor(axisalignedbb.minX);
@ -472,11 +399,11 @@ public class BoatEntityBOP extends Entity {
try (BlockPos.PooledMutableBlockPos blockpos$pooledmutableblockpos = BlockPos.PooledMutableBlockPos.retain()) { try (BlockPos.PooledMutableBlockPos blockpos$pooledmutableblockpos = BlockPos.PooledMutableBlockPos.retain()) {
label161: label161:
for(int k1 = k; k1 < l; ++k1) { for (int k1 = k; k1 < l; ++k1) {
float f = 0.0F; float f = 0.0F;
for(int l1 = i; l1 < j; ++l1) { for (int l1 = i; l1 < j; ++l1) {
for(int i2 = i1; i2 < j1; ++i2) { for (int i2 = i1; i2 < j1; ++i2) {
blockpos$pooledmutableblockpos.setPos(l1, k1, i2); blockpos$pooledmutableblockpos.setPos(l1, k1, i2);
IFluidState ifluidstate = this.world.getFluidState(blockpos$pooledmutableblockpos); IFluidState ifluidstate = this.world.getFluidState(blockpos$pooledmutableblockpos);
if (ifluidstate.isTagged(FluidTags.WATER)) { if (ifluidstate.isTagged(FluidTags.WATER)) {
@ -490,12 +417,12 @@ public class BoatEntityBOP extends Entity {
} }
if (f < 1.0F) { if (f < 1.0F) {
float f2 = (float)blockpos$pooledmutableblockpos.getY() + f; float f2 = (float) blockpos$pooledmutableblockpos.getY() + f;
return f2; return f2;
} }
} }
float f1 = (float)(l + 1); float f1 = (float) (l + 1);
return f1; return f1;
} }
} }
@ -503,6 +430,7 @@ public class BoatEntityBOP extends Entity {
/** /**
* Decides how much the boat should be gliding on the land (based on any slippery blocks) * Decides how much the boat should be gliding on the land (based on any slippery blocks)
*/ */
@Override
public float getBoatGlide() { public float getBoatGlide() {
AxisAlignedBB axisalignedbb = this.getBoundingBox(); AxisAlignedBB axisalignedbb = this.getBoundingBox();
AxisAlignedBB axisalignedbb1 = new AxisAlignedBB(axisalignedbb.minX, axisalignedbb.minY - 0.001D, axisalignedbb.minZ, axisalignedbb.maxX, axisalignedbb.minY, axisalignedbb.maxZ); AxisAlignedBB axisalignedbb1 = new AxisAlignedBB(axisalignedbb.minX, axisalignedbb.minY - 0.001D, axisalignedbb.minZ, axisalignedbb.maxX, axisalignedbb.minY, axisalignedbb.maxZ);
@ -517,15 +445,15 @@ public class BoatEntityBOP extends Entity {
int k1 = 0; int k1 = 0;
try (BlockPos.PooledMutableBlockPos blockpos$pooledmutableblockpos = BlockPos.PooledMutableBlockPos.retain()) { try (BlockPos.PooledMutableBlockPos blockpos$pooledmutableblockpos = BlockPos.PooledMutableBlockPos.retain()) {
for(int l1 = i; l1 < j; ++l1) { for (int l1 = i; l1 < j; ++l1) {
for(int i2 = i1; i2 < j1; ++i2) { for (int i2 = i1; i2 < j1; ++i2) {
int j2 = (l1 != i && l1 != j - 1 ? 0 : 1) + (i2 != i1 && i2 != j1 - 1 ? 0 : 1); int j2 = (l1 != i && l1 != j - 1 ? 0 : 1) + (i2 != i1 && i2 != j1 - 1 ? 0 : 1);
if (j2 != 2) { if (j2 != 2) {
for(int k2 = k; k2 < l; ++k2) { for (int k2 = k; k2 < l; ++k2) {
if (j2 <= 0 || k2 != k && k2 != l - 1) { if (j2 <= 0 || k2 != k && k2 != l - 1) {
blockpos$pooledmutableblockpos.setPos(l1, k2, i2); blockpos$pooledmutableblockpos.setPos(l1, k2, i2);
BlockState blockstate = this.world.getBlockState(blockpos$pooledmutableblockpos); BlockState blockstate = this.world.getBlockState(blockpos$pooledmutableblockpos);
if (!(blockstate.getBlock() instanceof LilyPadBlock) && VoxelShapes.compare(blockstate.getCollisionShape(this.world, blockpos$pooledmutableblockpos).withOffset((double)l1, (double)k2, (double)i2), voxelshape, IBooleanFunction.AND)) { if (!(blockstate.getBlock() instanceof LilyPadBlock) && VoxelShapes.compare(blockstate.getCollisionShape(this.world, blockpos$pooledmutableblockpos).withOffset((double) l1, (double) k2, (double) i2), voxelshape, IBooleanFunction.AND)) {
f += blockstate.getSlipperiness(this.world, blockpos$pooledmutableblockpos, this); f += blockstate.getSlipperiness(this.world, blockpos$pooledmutableblockpos, this);
++k1; ++k1;
} }
@ -536,7 +464,7 @@ public class BoatEntityBOP extends Entity {
} }
} }
return f / (float)k1; return f / (float) k1;
} }
private boolean checkInWater() { private boolean checkInWater() {
@ -551,15 +479,15 @@ public class BoatEntityBOP extends Entity {
this.waterLevel = Double.MIN_VALUE; this.waterLevel = Double.MIN_VALUE;
try (BlockPos.PooledMutableBlockPos blockpos$pooledmutableblockpos = BlockPos.PooledMutableBlockPos.retain()) { try (BlockPos.PooledMutableBlockPos blockpos$pooledmutableblockpos = BlockPos.PooledMutableBlockPos.retain()) {
for(int k1 = i; k1 < j; ++k1) { for (int k1 = i; k1 < j; ++k1) {
for(int l1 = k; l1 < l; ++l1) { for (int l1 = k; l1 < l; ++l1) {
for(int i2 = i1; i2 < j1; ++i2) { for (int i2 = i1; i2 < j1; ++i2) {
blockpos$pooledmutableblockpos.setPos(k1, l1, i2); blockpos$pooledmutableblockpos.setPos(k1, l1, i2);
IFluidState ifluidstate = this.world.getFluidState(blockpos$pooledmutableblockpos); IFluidState ifluidstate = this.world.getFluidState(blockpos$pooledmutableblockpos);
if (ifluidstate.isTagged(FluidTags.WATER)) { if (ifluidstate.isTagged(FluidTags.WATER)) {
float f = (float)l1 + ifluidstate.func_215679_a(this.world, blockpos$pooledmutableblockpos); float f = (float) l1 + ifluidstate.func_215679_a(this.world, blockpos$pooledmutableblockpos);
this.waterLevel = Math.max((double)f, this.waterLevel); this.waterLevel = Math.max((double) f, this.waterLevel);
flag |= axisalignedbb.minY < (double)f; flag |= axisalignedbb.minY < (double) f;
} }
} }
} }
@ -573,7 +501,7 @@ public class BoatEntityBOP extends Entity {
* Decides whether the boat is currently underwater. * Decides whether the boat is currently underwater.
*/ */
@Nullable @Nullable
private BoatEntityBOP.Status getUnderwaterStatus() { private Status getUnderwaterStatus() {
AxisAlignedBB axisalignedbb = this.getBoundingBox(); AxisAlignedBB axisalignedbb = this.getBoundingBox();
double d0 = axisalignedbb.maxY + 0.001D; double d0 = axisalignedbb.maxY + 0.001D;
int i = MathHelper.floor(axisalignedbb.minX); int i = MathHelper.floor(axisalignedbb.minX);
@ -585,15 +513,14 @@ public class BoatEntityBOP extends Entity {
boolean flag = false; boolean flag = false;
try (BlockPos.PooledMutableBlockPos blockpos$pooledmutableblockpos = BlockPos.PooledMutableBlockPos.retain()) { try (BlockPos.PooledMutableBlockPos blockpos$pooledmutableblockpos = BlockPos.PooledMutableBlockPos.retain()) {
for(int k1 = i; k1 < j; ++k1) { for (int k1 = i; k1 < j; ++k1) {
for(int l1 = k; l1 < l; ++l1) { for (int l1 = k; l1 < l; ++l1) {
for(int i2 = i1; i2 < j1; ++i2) { for (int i2 = i1; i2 < j1; ++i2) {
blockpos$pooledmutableblockpos.setPos(k1, l1, i2); blockpos$pooledmutableblockpos.setPos(k1, l1, i2);
IFluidState ifluidstate = this.world.getFluidState(blockpos$pooledmutableblockpos); IFluidState ifluidstate = this.world.getFluidState(blockpos$pooledmutableblockpos);
if (ifluidstate.isTagged(FluidTags.WATER) && d0 < (double)((float)blockpos$pooledmutableblockpos.getY() + ifluidstate.func_215679_a(this.world, blockpos$pooledmutableblockpos))) { if (ifluidstate.isTagged(FluidTags.WATER) && d0 < (double) ((float) blockpos$pooledmutableblockpos.getY() + ifluidstate.func_215679_a(this.world, blockpos$pooledmutableblockpos))) {
if (!ifluidstate.isSource()) { if (!ifluidstate.isSource()) {
BoatEntityBOP.Status boatentity$status = BoatEntityBOP.Status.UNDER_FLOWING_WATER; return Status.UNDER_FLOWING_WATER;
return boatentity$status;
} }
flag = true; flag = true;
@ -603,36 +530,36 @@ public class BoatEntityBOP extends Entity {
} }
} }
return flag ? BoatEntityBOP.Status.UNDER_WATER : null; return flag ? Status.UNDER_WATER : null;
} }
/** /**
* Update the boat's speed, based on momentum. * Update the boat's speed, based on momentum.
*/ */
private void updateMotion() { private void updateMotion() {
double d0 = (double)-0.04F; double gravity = (double) -0.04F;
double d1 = this.hasNoGravity() ? 0.0D : (double)-0.04F; double d1 = this.hasNoGravity() ? 0.0D : gravity;
double d2 = 0.0D; double d2 = 0.0D;
this.momentum = 0.05F; this.momentum = 0.05F;
if (this.previousStatus == BoatEntityBOP.Status.IN_AIR && this.status != BoatEntityBOP.Status.IN_AIR && this.status != BoatEntityBOP.Status.ON_LAND) { if (this.previousStatus == Status.IN_AIR && this.status != Status.IN_AIR && this.status != Status.ON_LAND) {
this.waterLevel = this.getBoundingBox().minY + (double)this.getHeight(); this.waterLevel = this.getBoundingBox().minY + (double) this.getHeight();
this.setPosition(this.posX, (double)(this.getWaterLevelAbove() - this.getHeight()) + 0.101D, this.posZ); this.setPosition(this.posX, (double) (this.getWaterLevelAbove() - this.getHeight()) + 0.101D, this.posZ);
this.setMotion(this.getMotion().mul(1.0D, 0.0D, 1.0D)); this.setMotion(this.getMotion().mul(1.0D, 0.0D, 1.0D));
this.lastYd = 0.0D; this.lastYd = 0.0D;
this.status = BoatEntityBOP.Status.IN_WATER; this.status = Status.IN_WATER;
} else { } else {
if (this.status == BoatEntityBOP.Status.IN_WATER) { if (this.status == Status.IN_WATER) {
d2 = (this.waterLevel - this.getBoundingBox().minY) / (double)this.getHeight(); d2 = (this.waterLevel - this.getBoundingBox().minY) / (double) this.getHeight();
this.momentum = 0.9F; this.momentum = 0.9F;
} else if (this.status == BoatEntityBOP.Status.UNDER_FLOWING_WATER) { } else if (this.status == Status.UNDER_FLOWING_WATER) {
d1 = -7.0E-4D; d1 = -7.0E-4D;
this.momentum = 0.9F; this.momentum = 0.9F;
} else if (this.status == BoatEntityBOP.Status.UNDER_WATER) { } else if (this.status == Status.UNDER_WATER) {
d2 = (double)0.01F; d2 = (double) 0.01F;
this.momentum = 0.45F; this.momentum = 0.45F;
} else if (this.status == BoatEntityBOP.Status.IN_AIR) { } else if (this.status == Status.IN_AIR) {
this.momentum = 0.9F; this.momentum = 0.9F;
} else if (this.status == BoatEntityBOP.Status.ON_LAND) { } else if (this.status == Status.ON_LAND) {
this.momentum = this.boatGlide; this.momentum = this.boatGlide;
if (this.getControllingPassenger() instanceof PlayerEntity) { if (this.getControllingPassenger() instanceof PlayerEntity) {
this.boatGlide /= 2.0F; this.boatGlide /= 2.0F;
@ -640,14 +567,13 @@ public class BoatEntityBOP extends Entity {
} }
Vec3d vec3d = this.getMotion(); Vec3d vec3d = this.getMotion();
this.setMotion(vec3d.x * (double)this.momentum, vec3d.y + d1, vec3d.z * (double)this.momentum); this.setMotion(vec3d.x * (double) this.momentum, vec3d.y + d1, vec3d.z * (double) this.momentum);
this.deltaRotation *= this.momentum; this.deltaRotation *= this.momentum;
if (d2 > 0.0D) { if (d2 > 0.0D) {
Vec3d vec3d1 = this.getMotion(); Vec3d vec3d1 = this.getMotion();
this.setMotion(vec3d1.x, (vec3d1.y + d2 * 0.06153846016296973D) * 0.75D, vec3d1.z); this.setMotion(vec3d1.x, (vec3d1.y + d2 * 0.06153846016296973D) * 0.75D, vec3d1.z);
} }
} }
} }
private void controlBoat() { private void controlBoat() {
@ -674,15 +600,16 @@ public class BoatEntityBOP extends Entity {
f -= 0.005F; f -= 0.005F;
} }
this.setMotion(this.getMotion().add((double)(MathHelper.sin(-this.rotationYaw * ((float)Math.PI / 180F)) * f), 0.0D, (double)(MathHelper.cos(this.rotationYaw * ((float)Math.PI / 180F)) * f))); this.setMotion(this.getMotion().add((double) (MathHelper.sin(-this.rotationYaw * ((float) Math.PI / 180F)) * f), 0.0D, (double) (MathHelper.cos(this.rotationYaw * ((float) Math.PI / 180F)) * f)));
this.setPaddleState(this.rightInputDown && !this.leftInputDown || this.forwardInputDown, this.leftInputDown && !this.rightInputDown || this.forwardInputDown); this.setPaddleState(this.rightInputDown && !this.leftInputDown || this.forwardInputDown, this.leftInputDown && !this.rightInputDown || this.forwardInputDown);
} }
} }
@Override
public void updatePassenger(Entity passenger) { public void updatePassenger(Entity passenger) {
if (this.isPassenger(passenger)) { if (this.isPassenger(passenger)) {
float f = 0.0F; float f = 0.0F;
float f1 = (float)((this.removed ? (double)0.01F : this.getMountedYOffset()) + passenger.getYOffset()); float f1 = (float) ((this.removed ? (double) 0.01F : this.getMountedYOffset()) + passenger.getYOffset());
if (this.getPassengers().size() > 1) { if (this.getPassengers().size() > 1) {
int i = this.getPassengers().indexOf(passenger); int i = this.getPassengers().indexOf(passenger);
if (i == 0) { if (i == 0) {
@ -692,27 +619,27 @@ public class BoatEntityBOP extends Entity {
} }
if (passenger instanceof AnimalEntity) { if (passenger instanceof AnimalEntity) {
f = (float)((double)f + 0.2D); f = (float) ((double) f + 0.2D);
} }
} }
Vec3d vec3d = (new Vec3d((double)f, 0.0D, 0.0D)).rotateYaw(-this.rotationYaw * ((float)Math.PI / 180F) - ((float)Math.PI / 2F)); Vec3d vec3d = (new Vec3d((double) f, 0.0D, 0.0D)).rotateYaw(-this.rotationYaw * ((float) Math.PI / 180F) - ((float) Math.PI / 2F));
passenger.setPosition(this.posX + vec3d.x, this.posY + (double)f1, this.posZ + vec3d.z); passenger.setPosition(this.posX + vec3d.x, this.posY + (double) f1, this.posZ + vec3d.z);
passenger.rotationYaw += this.deltaRotation; passenger.rotationYaw += this.deltaRotation;
passenger.setRotationYawHead(passenger.getRotationYawHead() + this.deltaRotation); passenger.setRotationYawHead(passenger.getRotationYawHead() + this.deltaRotation);
this.applyYawToEntity(passenger); this.applyYawToEntity(passenger);
if (passenger instanceof AnimalEntity && this.getPassengers().size() > 1) { if (passenger instanceof AnimalEntity && this.getPassengers().size() > 1) {
int j = passenger.getEntityId() % 2 == 0 ? 90 : 270; int j = passenger.getEntityId() % 2 == 0 ? 90 : 270;
passenger.setRenderYawOffset(((AnimalEntity)passenger).renderYawOffset + (float)j); passenger.setRenderYawOffset(((AnimalEntity) passenger).renderYawOffset + (float) j);
passenger.setRotationYawHead(passenger.getRotationYawHead() + (float)j); passenger.setRotationYawHead(passenger.getRotationYawHead() + (float) j);
} }
} }
} }
/** /**
* Applies this boat's yaw to the given entity. Used to update the orientation of its passenger. * Applies this boat's yaw to the given entity. Used to update the orientation of its passenger.
*/ */
@Override
protected void applyYawToEntity(Entity entityToUpdate) { protected void applyYawToEntity(Entity entityToUpdate) {
entityToUpdate.setRenderYawOffset(this.rotationYaw); entityToUpdate.setRenderYawOffset(this.rotationYaw);
float f = MathHelper.wrapDegrees(entityToUpdate.rotationYaw - this.rotationYaw); float f = MathHelper.wrapDegrees(entityToUpdate.rotationYaw - this.rotationYaw);
@ -725,6 +652,7 @@ public class BoatEntityBOP extends Entity {
/** /**
* Applies this entity's orientation (pitch/yaw) to another entity. Used to update passenger orientation. * Applies this entity's orientation (pitch/yaw) to another entity. Used to update passenger orientation.
*/ */
@Override
@OnlyIn(Dist.CLIENT) @OnlyIn(Dist.CLIENT)
public void applyOrientationToEntity(Entity entityToUpdate) { public void applyOrientationToEntity(Entity entityToUpdate) {
this.applyYawToEntity(entityToUpdate); this.applyYawToEntity(entityToUpdate);
@ -732,7 +660,7 @@ public class BoatEntityBOP extends Entity {
@Override @Override
protected void writeAdditional(CompoundNBT compound) { protected void writeAdditional(CompoundNBT compound) {
compound.putString("Type", this.getBoatType().getName()); compound.putString("Type", this.getBoatModel().getName());
} }
/** /**
@ -741,20 +669,7 @@ public class BoatEntityBOP extends Entity {
@Override @Override
protected void readAdditional(CompoundNBT compound) { protected void readAdditional(CompoundNBT compound) {
if (compound.contains("Type", 8)) { if (compound.contains("Type", 8)) {
this.setBoatType(Type.getTypeFromString(compound.getString("Type"))); setBoatModel(Type.getTypeFromString(compound.getString("Type")));
}
}
public boolean processInitialInteract(PlayerEntity player, Hand hand) {
if (player.isSneaking()) {
return false;
} else {
if (!this.world.isRemote && this.outOfControlTicks < 60.0F) {
player.startRiding(this);
}
return true;
} }
} }
@ -773,11 +688,11 @@ public class BoatEntityBOP extends Entity {
if (!this.world.isRemote && !this.removed) { if (!this.world.isRemote && !this.removed) {
this.remove(); this.remove();
if (this.world.getGameRules().getBoolean(GameRules.DO_ENTITY_DROPS)) { if (this.world.getGameRules().getBoolean(GameRules.DO_ENTITY_DROPS)) {
for(int i = 0; i < 3; ++i) { for (int i = 0; i < 3; ++i) {
this.entityDropItem(this.getBoatType().asPlank()); this.entityDropItem(this.getBoatType().asPlank());
} }
for(int j = 0; j < 2; ++j) { for (int j = 0; j < 2; ++j) {
this.entityDropItem(Items.STICK); this.entityDropItem(Items.STICK);
} }
} }
@ -786,12 +701,12 @@ public class BoatEntityBOP extends Entity {
this.fallDistance = 0.0F; this.fallDistance = 0.0F;
} else if (!this.world.getFluidState((new BlockPos(this)).down()).isTagged(FluidTags.WATER) && y < 0.0D) { } else if (!this.world.getFluidState((new BlockPos(this)).down()).isTagged(FluidTags.WATER) && y < 0.0D) {
this.fallDistance = (float)((double)this.fallDistance - y); this.fallDistance = (float) ((double) this.fallDistance - y);
} }
} }
} }
@Override
public boolean getPaddleState(int side) { public boolean getPaddleState(int side) {
return this.dataManager.<Boolean>get(side == 0 ? field_199704_e : field_199705_f) && this.getControllingPassenger() != null; return this.dataManager.<Boolean>get(side == 0 ? field_199704_e : field_199705_f) && this.getControllingPassenger() != null;
} }
@ -799,6 +714,7 @@ public class BoatEntityBOP extends Entity {
/** /**
* Sets the damage taken from the last hit. * Sets the damage taken from the last hit.
*/ */
@Override
public void setDamageTaken(float damageTaken) { public void setDamageTaken(float damageTaken) {
this.dataManager.set(DAMAGE_TAKEN, damageTaken); this.dataManager.set(DAMAGE_TAKEN, damageTaken);
} }
@ -806,6 +722,7 @@ public class BoatEntityBOP extends Entity {
/** /**
* Gets the damage taken from the last hit. * Gets the damage taken from the last hit.
*/ */
@Override
public float getDamageTaken() { public float getDamageTaken() {
return this.dataManager.get(DAMAGE_TAKEN); return this.dataManager.get(DAMAGE_TAKEN);
} }
@ -813,6 +730,7 @@ public class BoatEntityBOP extends Entity {
/** /**
* Sets the time to count down from since the last time entity was hit. * Sets the time to count down from since the last time entity was hit.
*/ */
@Override
public void setTimeSinceHit(int timeSinceHit) { public void setTimeSinceHit(int timeSinceHit) {
this.dataManager.set(TIME_SINCE_HIT, timeSinceHit); this.dataManager.set(TIME_SINCE_HIT, timeSinceHit);
} }
@ -820,6 +738,7 @@ public class BoatEntityBOP extends Entity {
/** /**
* Gets the time since the last hit. * Gets the time since the last hit.
*/ */
@Override
public int getTimeSinceHit() { public int getTimeSinceHit() {
return this.dataManager.get(TIME_SINCE_HIT); return this.dataManager.get(TIME_SINCE_HIT);
} }
@ -832,6 +751,7 @@ public class BoatEntityBOP extends Entity {
return this.dataManager.get(ROCKING_TICKS); return this.dataManager.get(ROCKING_TICKS);
} }
@Override
@OnlyIn(Dist.CLIENT) @OnlyIn(Dist.CLIENT)
public float getRockingAngle(float partialTicks) { public float getRockingAngle(float partialTicks) {
return MathHelper.lerp(partialTicks, this.prevRockingAngle, this.rockingAngle); return MathHelper.lerp(partialTicks, this.prevRockingAngle, this.rockingAngle);
@ -840,6 +760,7 @@ public class BoatEntityBOP extends Entity {
/** /**
* Sets the forward direction of the entity. * Sets the forward direction of the entity.
*/ */
@Override
public void setForwardDirection(int forwardDirection) { public void setForwardDirection(int forwardDirection) {
this.dataManager.set(FORWARD_DIRECTION, forwardDirection); this.dataManager.set(FORWARD_DIRECTION, forwardDirection);
} }
@ -847,32 +768,20 @@ public class BoatEntityBOP extends Entity {
/** /**
* Gets the forward direction of the entity. * Gets the forward direction of the entity.
*/ */
@Override
public int getForwardDirection() { public int getForwardDirection() {
return this.dataManager.get(FORWARD_DIRECTION); return this.dataManager.get(FORWARD_DIRECTION);
} }
public void setBoatType(Type boatType) { public void setBoatModel(Type boatType) {
this.dataManager.set(BOAT_TYPE, boatType.ordinal()); this.dataManager.set(BOAT_TYPE, boatType.ordinal());
} }
public Type getBoatType() { public Type getBoatModel() {
return Type.byId(this.dataManager.get(BOAT_TYPE)); return Type.byId(this.dataManager.get(BOAT_TYPE));
} }
protected boolean canFitPassenger(Entity passenger) { @Override
return this.getPassengers().size() < 2 && !this.areEyesInFluid(FluidTags.WATER);
}
/**
* For vehicles, the first passenger is generally considered the controller and "drives" the vehicle. For example,
* Pigs, Horses, and Boats are generally "steered" by the controlling passenger.
*/
@Nullable
public Entity getControllingPassenger() {
List<Entity> list = this.getPassengers();
return list.isEmpty() ? null : list.get(0);
}
@OnlyIn(Dist.CLIENT) @OnlyIn(Dist.CLIENT)
public void updateInputs(boolean p_184442_1_, boolean p_184442_2_, boolean p_184442_3_, boolean p_184442_4_) { public void updateInputs(boolean p_184442_1_, boolean p_184442_2_, boolean p_184442_3_, boolean p_184442_4_) {
this.leftInputDown = p_184442_1_; this.leftInputDown = p_184442_1_;
@ -886,29 +795,7 @@ public class BoatEntityBOP extends Entity {
return NetworkHooks.getEntitySpawningPacket(this); return NetworkHooks.getEntitySpawningPacket(this);
} }
// Forge: Fix MC-119811 by instantly completing lerp on board public enum Type {
@Override
protected void addPassenger(Entity passenger) {
super.addPassenger(passenger);
if (this.canPassengerSteer() && this.lerpSteps > 0) {
this.lerpSteps = 0;
this.posX = this.lerpX;
this.posY = this.lerpY;
this.posZ = this.lerpZ;
this.rotationYaw = (float)this.lerpYaw;
this.rotationPitch = (float)this.lerpPitch;
}
}
public static enum Status {
IN_WATER,
UNDER_WATER,
UNDER_FLOWING_WATER,
ON_LAND,
IN_AIR;
}
public static enum Type {
FIR(BOPBlocks.fir_planks, "fir"), FIR(BOPBlocks.fir_planks, "fir"),
REDWOOD(BOPBlocks.redwood_planks, "redwood"), REDWOOD(BOPBlocks.redwood_planks, "redwood"),
CHERRY(BOPBlocks.cherry_planks, "cherry"), CHERRY(BOPBlocks.cherry_planks, "cherry"),
@ -944,6 +831,7 @@ public class BoatEntityBOP extends Entity {
/** /**
* Get a boat type by it's enum ordinal * Get a boat type by it's enum ordinal
*
* @return * @return
*/ */
public static Type byId(int id) { public static Type byId(int id) {
@ -951,19 +839,17 @@ public class BoatEntityBOP extends Entity {
if (id < 0 || id >= aboatentity$type.length) { if (id < 0 || id >= aboatentity$type.length) {
id = 0; id = 0;
} }
return aboatentity$type[id]; return aboatentity$type[id];
} }
public static Type getTypeFromString(String nameIn) { public static Type getTypeFromString(String nameIn) {
Type[] aboatentity$type = values(); Type[] aboatentity$type = values();
for(int i = 0; i < aboatentity$type.length; ++i) { for (int i = 0; i < aboatentity$type.length; ++i) {
if (aboatentity$type[i].getName().equals(nameIn)) { if (aboatentity$type[i].getName().equals(nameIn)) {
return aboatentity$type[i]; return aboatentity$type[i];
} }
} }
return aboatentity$type[0]; return aboatentity$type[0];
} }
} }

View file

@ -65,7 +65,7 @@ public class BoatRendererBOP extends EntityRenderer<BoatEntityBOP> {
@Override @Override
protected ResourceLocation getEntityTexture(BoatEntityBOP entity) { protected ResourceLocation getEntityTexture(BoatEntityBOP entity) {
return BOAT_TEXTURES[entity.getBoatType().ordinal()]; return BOAT_TEXTURES[entity.getBoatModel().ordinal()];
} }
@Override @Override

View file

@ -0,0 +1,3 @@
@javax.annotation.ParametersAreNonnullByDefault
@mcp.MethodsReturnNonnullByDefault
package biomesoplenty.common.entity.item;

View file

@ -56,7 +56,7 @@ public class BoatItemBOP extends Item {
if (raytraceresult.getType() == RayTraceResult.Type.BLOCK) { if (raytraceresult.getType() == RayTraceResult.Type.BLOCK) {
BoatEntityBOP boatentity = new BoatEntityBOP(worldIn, raytraceresult.getHitVec().x, raytraceresult.getHitVec().y, raytraceresult.getHitVec().z); BoatEntityBOP boatentity = new BoatEntityBOP(worldIn, raytraceresult.getHitVec().x, raytraceresult.getHitVec().y, raytraceresult.getHitVec().z);
boatentity.setBoatType(this.type); boatentity.setBoatModel(this.type);
boatentity.rotationYaw = playerIn.rotationYaw; boatentity.rotationYaw = playerIn.rotationYaw;
if (!worldIn.isCollisionBoxesEmpty(boatentity, boatentity.getBoundingBox().grow(-0.1D))) { if (!worldIn.isCollisionBoxesEmpty(boatentity, boatentity.getBoundingBox().grow(-0.1D))) {
return new ActionResult<>(ActionResultType.FAIL, itemstack); return new ActionResult<>(ActionResultType.FAIL, itemstack);

View file

@ -16,5 +16,3 @@ public-f net.minecraft.item.AxeItem field_203176_a # BLOCK_STRIPPING_MAP
# server.properties world type hackery # server.properties world type hackery
public-f net.minecraft.server.dedicated.ServerProperties * public-f net.minecraft.server.dedicated.ServerProperties *
public net.minecraft.server.dedicated.PropertyManager * public net.minecraft.server.dedicated.PropertyManager *
public net.minecraft.client.entity.player.ClientPlayerEntity field_184844_co # rowingBoat