use of net.minecraft.network.play.client.CPacketSteerBoat in project NetherEx by LogicTechCorp.
the class EntityObsidianBoat method onUpdate.
@Override
public void onUpdate() {
previousStatus = status;
status = getBoatStatus();
if (status != Status.UNDER_LAVA && status != Status.UNDER_FLOWING_LAVA) {
outOfControlTicks = 0.0F;
} else {
++outOfControlTicks;
}
if (!world.isRemote && outOfControlTicks >= 60.0F) {
removePassengers();
}
if (getTimeSinceHit() > 0) {
setTimeSinceHit(getTimeSinceHit() - 1);
}
if (getDamageTaken() > 0.0F) {
setDamageTaken(getDamageTaken() - 1.0F);
}
prevPosX = posX;
prevPosY = posY;
prevPosZ = posZ;
if (!world.isRemote) {
setFlag(6, isGlowing());
}
onEntityUpdate();
tickLerp();
if (canPassengerSteer()) {
if (getPassengers().size() == 0 || !(getPassengers().get(0) instanceof EntityPlayer)) {
setPaddleState(false, false);
}
updateMotion();
if (world.isRemote) {
controlBoat();
world.sendPacketToServer(new CPacketSteerBoat(getPaddleState(0), getPaddleState(1)));
}
move(MoverType.SELF, motionX, motionY, motionZ);
} else {
motionX = 0.0D;
motionY = 0.0D;
motionZ = 0.0D;
}
for (int i = 0; i <= 1; ++i) {
if (getPaddleState(i)) {
paddlePositions[i] = (float) ((double) paddlePositions[i] + 0.01D);
} else {
paddlePositions[i] = 0.0F;
}
}
doBlockCollisions();
List<Entity> list = world.getEntitiesInAABBexcluding(this, getEntityBoundingBox().expand(0.20000000298023224D, -0.009999999776482582D, 0.20000000298023224D), EntitySelectors.getTeamCollisionPredicate(this));
if (!list.isEmpty()) {
boolean flag = !world.isRemote && !(getControllingPassenger() instanceof EntityPlayer);
for (Entity entity : list) {
if (!entity.isPassenger(this)) {
if (flag && getPassengers().size() < 2 && !entity.isRiding() && entity.width < width && entity instanceof EntityLivingBase && !(entity instanceof EntityWaterMob) && !(entity instanceof EntityPlayer)) {
entity.startRiding(this);
} else {
applyEntityCollision(entity);
}
}
}
}
}
Aggregations