use of micdoodle8.mods.galacticraft.core.network.PacketEntityUpdate in project Galacticraft by micdoodle8.
the class EntityAdvancedMotion method onUpdate.
@Override
public void onUpdate() {
this.ticks++;
super.onUpdate();
if (this.canSetPositionClient() && this.worldObj.isRemote && (this.riddenByEntity == null || !(this.riddenByEntity instanceof EntityPlayer) || !FMLClientHandler.instance().getClient().thePlayer.equals(this.riddenByEntity))) {
double x;
double y;
double var12;
double z;
if (this.posRotIncrements > 0) {
x = this.posX + (this.advancedPositionX - this.posX) / this.posRotIncrements;
y = this.posY + (this.advancedPositionY - this.posY) / this.posRotIncrements;
z = this.posZ + (this.advancedPositionZ - this.posZ) / this.posRotIncrements;
var12 = MathHelper.wrapAngleTo180_double(this.advancedYaw - this.rotationYaw);
this.rotationYaw = (float) (this.rotationYaw + var12 / this.posRotIncrements);
this.rotationPitch = (float) (this.rotationPitch + (this.advancedPitch - this.rotationPitch) / this.posRotIncrements);
--this.posRotIncrements;
this.setPosition(x, y, z);
this.setRotation(this.rotationYaw, this.rotationPitch);
} else {
// x = this.posX + this.motionX;
// y = this.posY + this.motionY;
// z = this.posZ + this.motionZ;
// this.setPosition(x, y, z);
}
}
if (this.timeSinceHit > 0) {
this.timeSinceHit--;
}
if (this.currentDamage > 0) {
this.currentDamage--;
}
if (this.shouldSpawnParticles() && this.worldObj.isRemote) {
this.spawnParticles(this.getParticleMap());
}
if (this.onGround) {
this.tickOnGround();
} else {
this.tickInAir();
}
if (this.worldObj.isRemote) {
Vector3 mot = this.getMotionVec();
this.motionX = mot.x;
this.motionY = mot.y;
this.motionZ = mot.z;
}
// Necessary on both server and client to achieve a correct this.onGround setting
this.moveEntity(this.motionX, this.motionY, this.motionZ);
if (this.onGround && !this.lastOnGround) {
this.onGroundHit();
}
if (shouldSendAdvancedMotionPacket()) {
if (this.worldObj.isRemote) {
GalacticraftCore.packetPipeline.sendToServer(new PacketEntityUpdate(this));
}
if (!this.worldObj.isRemote && this.ticks % 5 == 0) {
GalacticraftCore.packetPipeline.sendToAllAround(new PacketEntityUpdate(this), new TargetPoint(GCCoreUtil.getDimensionID(this.worldObj), this.posX, this.posY, this.posZ, 50.0D));
}
}
this.prevPosX = this.posX;
this.prevPosY = this.posY;
this.prevPosZ = this.posZ;
this.lastOnGround = this.onGround;
}
Aggregations