From 256721aa12f0b09c3a6e97eff504aef895be671b Mon Sep 17 00:00:00 2001 From: Sen Date: Mon, 16 Jun 2025 11:14:56 +0200 Subject: [PATCH] cleanup setClientPosition --- .../java/client/network/ClientPlayer.java | 6 +- .../src/main/java/common/entity/Entity.java | 2 +- .../java/common/entity/item/EntityBoat.java | 6 +- .../java/common/entity/item/EntityCart.java | 4 +- .../java/common/entity/npc/EntityNPC.java | 6 +- .../common/entity/projectile/EntityArrow.java | 2 +- .../entity/projectile/EntityBullet.java | 494 ++++++++---------- .../common/entity/projectile/EntityHook.java | 4 +- .../common/entity/types/EntityLiving.java | 4 +- 9 files changed, 246 insertions(+), 282 deletions(-) diff --git a/client/src/main/java/client/network/ClientPlayer.java b/client/src/main/java/client/network/ClientPlayer.java index 3671a57..5981cfc 100755 --- a/client/src/main/java/client/network/ClientPlayer.java +++ b/client/src/main/java/client/network/ClientPlayer.java @@ -553,11 +553,11 @@ public class ClientPlayer implements IClientPlayer if (Math.abs(entity.posX - d0) < 0.03125D && Math.abs(entity.posY - d1) < 0.015625D && Math.abs(entity.posZ - d2) < 0.03125D) { - entity.setPositionAndRotation2(entity.posX, entity.posY, entity.posZ, f, f1, 3, true); + entity.setClientPosition(entity.posX, entity.posY, entity.posZ, f, f1, true); } else { - entity.setPositionAndRotation2(d0, d1, d2, f, f1, 3, true); + entity.setClientPosition(d0, d1, d2, f, f1, true); } entity.onGround = packetIn.getOnGround(); @@ -597,7 +597,7 @@ public class ClientPlayer implements IClientPlayer double d2 = (double)entity.serverPosZ / 32.0D; float f = packetIn.hasRotations() ? (float)(packetIn.getYaw() * 360) / 256.0F : entity.rotYaw; float f1 = packetIn.hasRotations() ? (float)(packetIn.getPitch() * 360) / 256.0F : entity.rotPitch; - entity.setPositionAndRotation2(d0, d1, d2, f, f1, 3, false); + entity.setClientPosition(d0, d1, d2, f, f1, false); entity.onGround = packetIn.getOnGround(); } } diff --git a/common/src/main/java/common/entity/Entity.java b/common/src/main/java/common/entity/Entity.java index 6fcfe73..94e43a1 100755 --- a/common/src/main/java/common/entity/Entity.java +++ b/common/src/main/java/common/entity/Entity.java @@ -1875,7 +1875,7 @@ public abstract class Entity } } - public void setPositionAndRotation2(double x, double y, double z, float yaw, float pitch, int posRotationIncrements, boolean p_180426_10_) + public void setClientPosition(double x, double y, double z, float yaw, float pitch, boolean teleport) { this.setPosition(x, y, z); this.setRotation(yaw, pitch); diff --git a/common/src/main/java/common/entity/item/EntityBoat.java b/common/src/main/java/common/entity/item/EntityBoat.java index e2796b2..1a17e85 100755 --- a/common/src/main/java/common/entity/item/EntityBoat.java +++ b/common/src/main/java/common/entity/item/EntityBoat.java @@ -172,9 +172,9 @@ public class EntityBoat extends Entity return !this.dead; } - public void setPositionAndRotation2(double x, double y, double z, float yaw, float pitch, int posRotationIncrements, boolean p_180426_10_) + public void setClientPosition(double x, double y, double z, float yaw, float pitch, boolean teleport) { - if (p_180426_10_ && this.passenger != null) + if (teleport && this.passenger != null) { this.prevX = this.posX = x; this.prevY = this.posY = y; @@ -191,7 +191,7 @@ public class EntityBoat extends Entity { if (this.isBoatEmpty) { - this.boatPosRotationIncrements = posRotationIncrements + 5; + this.boatPosRotationIncrements = 8; } else { diff --git a/common/src/main/java/common/entity/item/EntityCart.java b/common/src/main/java/common/entity/item/EntityCart.java index 65dfb46..612c4ce 100755 --- a/common/src/main/java/common/entity/item/EntityCart.java +++ b/common/src/main/java/common/entity/item/EntityCart.java @@ -896,14 +896,14 @@ public abstract class EntityCart extends Entity implements IWorldNameable } } - public void setPositionAndRotation2(double x, double y, double z, float yaw, float pitch, int posRotationIncrements, boolean p_180426_10_) + public void setClientPosition(double x, double y, double z, float yaw, float pitch, boolean teleport) { this.minecartX = x; this.minecartY = y; this.minecartZ = z; this.minecartYaw = (double)yaw; this.minecartPitch = (double)pitch; - this.turnProgress = posRotationIncrements + 2; + this.turnProgress = 5; this.motionX = this.velocityX; this.motionY = this.velocityY; this.motionZ = this.velocityZ; diff --git a/common/src/main/java/common/entity/npc/EntityNPC.java b/common/src/main/java/common/entity/npc/EntityNPC.java index 0e2dc24..9c8728f 100755 --- a/common/src/main/java/common/entity/npc/EntityNPC.java +++ b/common/src/main/java/common/entity/npc/EntityNPC.java @@ -2791,7 +2791,7 @@ public abstract class EntityNPC extends EntityLiving // START OTHER - public void setPositionAndRotation2(double x, double y, double z, float yaw, float pitch, int posRotationIncrements, boolean p_180426_10_) + public void setClientPosition(double x, double y, double z, float yaw, float pitch, boolean teleport) { if(this.slave && this.client == null) { this.otherPlayerMPX = x; @@ -2799,10 +2799,10 @@ public abstract class EntityNPC extends EntityLiving this.otherPlayerMPZ = z; this.otherPlayerMPYaw = (double)yaw; this.otherPlayerMPPitch = (double)pitch; - this.otherPlayerMPPosRotationIncrements = posRotationIncrements; + this.otherPlayerMPPosRotationIncrements = 3; } else { - super.setPositionAndRotation2(x, y, z, yaw, pitch, posRotationIncrements, p_180426_10_); + super.setClientPosition(x, y, z, yaw, pitch, teleport); } } diff --git a/common/src/main/java/common/entity/projectile/EntityArrow.java b/common/src/main/java/common/entity/projectile/EntityArrow.java index 6209416..46ef690 100755 --- a/common/src/main/java/common/entity/projectile/EntityArrow.java +++ b/common/src/main/java/common/entity/projectile/EntityArrow.java @@ -156,7 +156,7 @@ public class EntityArrow extends Entity implements IProjectile, IObjectData this.ticksInGround = 0; } - public void setPositionAndRotation2(double x, double y, double z, float yaw, float pitch, int posRotationIncrements, boolean p_180426_10_) + public void setClientPosition(double x, double y, double z, float yaw, float pitch, boolean teleport) { this.setPosition(x, y, z); this.setRotation(yaw, pitch); diff --git a/common/src/main/java/common/entity/projectile/EntityBullet.java b/common/src/main/java/common/entity/projectile/EntityBullet.java index d479c7d..b471f48 100755 --- a/common/src/main/java/common/entity/projectile/EntityBullet.java +++ b/common/src/main/java/common/entity/projectile/EntityBullet.java @@ -19,307 +19,271 @@ import common.vars.Vars; import common.world.State; import common.world.World; -public class EntityBullet extends Entity implements IProjectile, IObjectData -{ - private Entity shooter; - private int ticksMoved; - private int age; - private int damage = 5; +public class EntityBullet extends Entity implements IProjectile, IObjectData { + private Entity shooter; + private int ticksMoved; + private int age; + private int damage = 5; - public EntityBullet(World world) - { - super(world); - this.renderDistWeight = 10.0D; - this.setSize(0.5F, 0.5F); - } + public EntityBullet(World world) { + super(world); + this.renderDistWeight = 10.0D; + this.setSize(0.5F, 0.5F); + } - public EntityBullet(World world, double x, double y, double z) - { - super(world); - this.renderDistWeight = 10.0D; - this.setSize(0.5F, 0.5F); - this.setPosition(x, y, z); - } + public EntityBullet(World world, double x, double y, double z) { + super(world); + this.renderDistWeight = 10.0D; + this.setSize(0.5F, 0.5F); + this.setPosition(x, y, z); + } - public EntityBullet(World world, double x, double y, double z, int data) - { - this(world, x, y, z); - Entity entity = world.getEntityByID(data); - if(entity instanceof EntityLiving) - this.shooter = entity; - } + public EntityBullet(World world, double x, double y, double z, int data) { + this(world, x, y, z); + Entity entity = world.getEntityByID(data); + if(entity instanceof EntityLiving) + this.shooter = entity; + } - public EntityBullet(World world, EntityLiving shooter, EntityLiving target, float velocity, float innacuracy) - { - super(world); - this.renderDistWeight = 10.0D; - this.shooter = shooter; - this.posY = shooter.posY + (double)shooter.getEyeHeight() - 0.10000000149011612D; - double xd = target.posX - shooter.posX; - double yd = target.getEntityBoundingBox().minY + (double)(target.height * 0.7f) - this.posY; - double zd = target.posZ - shooter.posZ; - double xzd = (double)ExtMath.sqrtd(xd * xd + zd * zd); - if (xzd >= 1.0E-7D) - { - float yaw = (float)(ExtMath.atan2(zd, xd) * 180.0D / Math.PI) - 90.0F; - float pitch = (float)(-(ExtMath.atan2(yd, xzd) * 180.0D / Math.PI)); - double x = xd / xzd; - double z = zd / xzd; - this.setLocationAndAngles(shooter.posX + x, this.posY, shooter.posZ + z, yaw, pitch); - this.setThrowableHeading(xd, yd, zd, velocity, innacuracy); - } - } + public EntityBullet(World world, EntityLiving shooter, EntityLiving target, float velocity, float innacuracy) { + super(world); + this.renderDistWeight = 10.0D; + this.shooter = shooter; + this.posY = shooter.posY + (double)shooter.getEyeHeight() - 0.10000000149011612D; + double xd = target.posX - shooter.posX; + double yd = target.getEntityBoundingBox().minY + (double)(target.height * 0.7f) - this.posY; + double zd = target.posZ - shooter.posZ; + double xzd = (double)ExtMath.sqrtd(xd * xd + zd * zd); + if(xzd >= 1.0E-7D) { + float yaw = (float)(ExtMath.atan2(zd, xd) * 180.0D / Math.PI) - 90.0F; + float pitch = (float)(-(ExtMath.atan2(yd, xzd) * 180.0D / Math.PI)); + double x = xd / xzd; + double z = zd / xzd; + this.setLocationAndAngles(shooter.posX + x, this.posY, shooter.posZ + z, yaw, pitch); + this.setThrowableHeading(xd, yd, zd, velocity, innacuracy); + } + } - public EntityBullet(World world, EntityLiving shooter, float velocity) - { - super(world); - this.renderDistWeight = 10.0D; - this.shooter = shooter; - this.setSize(0.5F, 0.5F); - this.setLocationAndAngles(shooter.posX, shooter.posY + (double)shooter.getEyeHeight(), shooter.posZ, shooter.rotYaw, shooter.rotPitch); - this.posX -= (double)(ExtMath.cos(this.rotYaw / 180.0F * (float)Math.PI) * 0.16F); - this.posY -= 0.10000000149011612D; - this.posZ -= (double)(ExtMath.sin(this.rotYaw / 180.0F * (float)Math.PI) * 0.16F); - this.setPosition(this.posX, this.posY, this.posZ); - this.motionX = (double)(-ExtMath.sin(this.rotYaw / 180.0F * (float)Math.PI) * ExtMath.cos(this.rotPitch / 180.0F * (float)Math.PI)); - this.motionZ = (double)(ExtMath.cos(this.rotYaw / 180.0F * (float)Math.PI) * ExtMath.cos(this.rotPitch / 180.0F * (float)Math.PI)); - this.motionY = (double)(-ExtMath.sin(this.rotPitch / 180.0F * (float)Math.PI)); - this.setThrowableHeading(this.motionX, this.motionY, this.motionZ, velocity, 0.5F); - } + public EntityBullet(World world, EntityLiving shooter, float velocity) { + super(world); + this.renderDistWeight = 10.0D; + this.shooter = shooter; + this.setSize(0.5F, 0.5F); + this.setLocationAndAngles(shooter.posX, shooter.posY + (double)shooter.getEyeHeight(), shooter.posZ, shooter.rotYaw, shooter.rotPitch); + this.posX -= (double)(ExtMath.cos(this.rotYaw / 180.0F * (float)Math.PI) * 0.16F); + this.posY -= 0.10000000149011612D; + this.posZ -= (double)(ExtMath.sin(this.rotYaw / 180.0F * (float)Math.PI) * 0.16F); + this.setPosition(this.posX, this.posY, this.posZ); + this.motionX = (double)(-ExtMath.sin(this.rotYaw / 180.0F * (float)Math.PI) * ExtMath.cos(this.rotPitch / 180.0F * (float)Math.PI)); + this.motionZ = (double)(ExtMath.cos(this.rotYaw / 180.0F * (float)Math.PI) * ExtMath.cos(this.rotPitch / 180.0F * (float)Math.PI)); + this.motionY = (double)(-ExtMath.sin(this.rotPitch / 180.0F * (float)Math.PI)); + this.setThrowableHeading(this.motionX, this.motionY, this.motionZ, velocity, 0.5F); + } - protected void entityInit() - { - } + protected void entityInit() { + } - public void setThrowableHeading(double x, double y, double z, float velocity, float inaccuracy) - { - float sq = ExtMath.sqrtd(x * x + y * y + z * z); - x = x / (double)sq; - y = y / (double)sq; - z = z / (double)sq; - x = x + this.rand.gaussian() * (double)(this.rand.chance() ? -1 : 1) * 0.007499999832361937D * (double)inaccuracy; - y = y + this.rand.gaussian() * (double)(this.rand.chance() ? -1 : 1) * 0.007499999832361937D * (double)inaccuracy; - z = z + this.rand.gaussian() * (double)(this.rand.chance() ? -1 : 1) * 0.007499999832361937D * (double)inaccuracy; - x = x * (double)velocity; - y = y * (double)velocity; - z = z * (double)velocity; - this.motionX = x; - this.motionY = y; - this.motionZ = z; - float f1 = ExtMath.sqrtd(x * x + z * z); - this.prevYaw = this.rotYaw = (float)(ExtMath.atan2(x, z) * 180.0D / Math.PI); - this.prevPitch = this.rotPitch = (float)(ExtMath.atan2(y, (double)f1) * 180.0D / Math.PI); - } + public void setThrowableHeading(double x, double y, double z, float velocity, float inaccuracy) { + float sq = ExtMath.sqrtd(x * x + y * y + z * z); + x = x / (double)sq; + y = y / (double)sq; + z = z / (double)sq; + x = x + this.rand.gaussian() * (double)(this.rand.chance() ? -1 : 1) * 0.007499999832361937D * (double)inaccuracy; + y = y + this.rand.gaussian() * (double)(this.rand.chance() ? -1 : 1) * 0.007499999832361937D * (double)inaccuracy; + z = z + this.rand.gaussian() * (double)(this.rand.chance() ? -1 : 1) * 0.007499999832361937D * (double)inaccuracy; + x = x * (double)velocity; + y = y * (double)velocity; + z = z * (double)velocity; + this.motionX = x; + this.motionY = y; + this.motionZ = z; + float f1 = ExtMath.sqrtd(x * x + z * z); + this.prevYaw = this.rotYaw = (float)(ExtMath.atan2(x, z) * 180.0D / Math.PI); + this.prevPitch = this.rotPitch = (float)(ExtMath.atan2(y, (double)f1) * 180.0D / Math.PI); + } - public void setPositionAndRotation2(double x, double y, double z, float yaw, float pitch, int posRotationIncrements, boolean p_180426_10_) - { - this.setPosition(x, y, z); - this.setRotation(yaw, pitch); - } + public void setClientPosition(double x, double y, double z, float yaw, float pitch, boolean teleport) { + this.setPosition(x, y, z); + this.setRotation(yaw, pitch); + } - public void setVelocity(double x, double y, double z) - { - this.motionX = x; - this.motionY = y; - this.motionZ = z; - if (this.prevPitch == 0.0F && this.prevYaw == 0.0F) - { - float xz = ExtMath.sqrtd(x * x + z * z); - this.prevYaw = this.rotYaw = (float)(ExtMath.atan2(x, z) * 180.0D / Math.PI); - this.prevPitch = this.rotPitch = (float)(ExtMath.atan2(y, (double)xz) * 180.0D / Math.PI); - this.prevPitch = this.rotPitch; - this.prevYaw = this.rotYaw; - this.setLocationAndAngles(this.posX, this.posY, this.posZ, this.rotYaw, this.rotPitch); - } - } + public void setVelocity(double x, double y, double z) { + this.motionX = x; + this.motionY = y; + this.motionZ = z; + if(this.prevPitch == 0.0F && this.prevYaw == 0.0F) { + float xz = ExtMath.sqrtd(x * x + z * z); + this.prevYaw = this.rotYaw = (float)(ExtMath.atan2(x, z) * 180.0D / Math.PI); + this.prevPitch = this.rotPitch = (float)(ExtMath.atan2(y, (double)xz) * 180.0D / Math.PI); + this.prevPitch = this.rotPitch; + this.prevYaw = this.rotYaw; + this.setLocationAndAngles(this.posX, this.posY, this.posZ, this.rotYaw, this.rotPitch); + } + } - public void onUpdate() - { - super.onUpdate(); + public void onUpdate() { + super.onUpdate(); - if (this.prevPitch == 0.0F && this.prevYaw == 0.0F) - { - float xz = ExtMath.sqrtd(this.motionX * this.motionX + this.motionZ * this.motionZ); - this.prevYaw = this.rotYaw = (float)(ExtMath.atan2(this.motionX, this.motionZ) * 180.0D / Math.PI); - this.prevPitch = this.rotPitch = (float)(ExtMath.atan2(this.motionY, (double)xz) * 180.0D / Math.PI); - } + if(this.prevPitch == 0.0F && this.prevYaw == 0.0F) { + float xz = ExtMath.sqrtd(this.motionX * this.motionX + this.motionZ * this.motionZ); + this.prevYaw = this.rotYaw = (float)(ExtMath.atan2(this.motionX, this.motionZ) * 180.0D / Math.PI); + this.prevPitch = this.rotPitch = (float)(ExtMath.atan2(this.motionY, (double)xz) * 180.0D / Math.PI); + } - if(!this.worldObj.client && ++this.age >= 200) { - this.setDead(); - return; - } - ++this.ticksMoved; - Vec3 current = new Vec3(this.posX, this.posY, this.posZ); - Vec3 next = new Vec3(this.posX + this.motionX, this.posY + this.motionY, this.posZ + this.motionZ); - HitPosition hit = this.worldObj.rayTraceBlocks(current, next, false, true, false); - current = new Vec3(this.posX, this.posY, this.posZ); - next = new Vec3(this.posX + this.motionX, this.posY + this.motionY, this.posZ + this.motionZ); + if(!this.worldObj.client && ++this.age >= 200) { + this.setDead(); + return; + } + ++this.ticksMoved; + Vec3 current = new Vec3(this.posX, this.posY, this.posZ); + Vec3 next = new Vec3(this.posX + this.motionX, this.posY + this.motionY, this.posZ + this.motionZ); + HitPosition hit = this.worldObj.rayTraceBlocks(current, next, false, true, false); + current = new Vec3(this.posX, this.posY, this.posZ); + next = new Vec3(this.posX + this.motionX, this.posY + this.motionY, this.posZ + this.motionZ); - if (hit != null) - { - next = new Vec3(hit.vec.xCoord, hit.vec.yCoord, hit.vec.zCoord); - } + if(hit != null) { + next = new Vec3(hit.vec.xCoord, hit.vec.yCoord, hit.vec.zCoord); + } - Entity entity = null; - List list = this.worldObj.getEntitiesWithinAABBExcludingEntity(this, this.getEntityBoundingBox().addCoord(this.motionX, this.motionY, this.motionZ).expand(1.0D, 1.0D, 1.0D)); - double min = 0.0D; + Entity entity = null; + List list = this.worldObj.getEntitiesWithinAABBExcludingEntity(this, + this.getEntityBoundingBox().addCoord(this.motionX, this.motionY, this.motionZ).expand(1.0D, 1.0D, 1.0D)); + double min = 0.0D; - for (int i = 0; i < list.size(); ++i) - { - Entity ent = list.get(i); + for(int i = 0; i < list.size(); ++i) { + Entity ent = list.get(i); - if (ent.canBeCollidedWith() && (ent != this.shooter || this.ticksMoved >= 5)) - { - float expand = 0.3F; - BoundingBox bb = ent.getEntityBoundingBox().expand((double)expand, (double)expand, (double)expand); - HitPosition entityHit = bb.calculateIntercept(current, next); + if(ent.canBeCollidedWith() && (ent != this.shooter || this.ticksMoved >= 5)) { + float expand = 0.3F; + BoundingBox bb = ent.getEntityBoundingBox().expand((double)expand, (double)expand, (double)expand); + HitPosition entityHit = bb.calculateIntercept(current, next); - if (entityHit != null) - { - double dist = current.squareDistanceTo(entityHit.vec); + if(entityHit != null) { + double dist = current.squareDistanceTo(entityHit.vec); - if (dist < min || min == 0.0D) - { - entity = ent; - min = dist; - } - } - } - } + if(dist < min || min == 0.0D) { + entity = ent; + min = dist; + } + } + } + } - if (entity != null) - { - hit = new HitPosition(entity); - } + if(entity != null) { + hit = new HitPosition(entity); + } - if (hit != null) - { - if (hit.entity != null) - { - float velo = ExtMath.sqrtd(this.motionX * this.motionX + this.motionY * this.motionY + this.motionZ * this.motionZ); - int damage = ExtMath.ceild((double)velo * (double)this.damage); + if(hit != null) { + if(hit.entity != null) { + float velo = ExtMath.sqrtd(this.motionX * this.motionX + this.motionY * this.motionY + this.motionZ * this.motionZ); + int damage = ExtMath.ceild((double)velo * (double)this.damage); - DamageSource source; + DamageSource source; - if (this.shooter == null) - { - source = DamageSource.causeShotDamage(this, this); - } - else - { - source = DamageSource.causeShotDamage(this, this.shooter); - } + if(this.shooter == null) { + source = DamageSource.causeShotDamage(this, this); + } + else { + source = DamageSource.causeShotDamage(this, this.shooter); + } - if ((this.worldObj.client || Vars.damageBullet) && hit.entity.attackEntityFrom(source, damage)) - { - if (hit.entity instanceof EntityLiving living && this.shooter instanceof EntityLiving shooter) - { - EnchantmentHelper.applyThornEnchantments(living, shooter); - EnchantmentHelper.applyArthropodEnchantments(shooter, living); - } - this.playSound(SoundEvent.METALHIT, 0.2F); - } - this.setDead(); - } - else if(!this.worldObj.client) - { - State state = hit.block != null ? this.worldObj.getState(hit.block) : null; - if(state == null || state.getBlock().onShot(this.worldObj, hit.block, state, this)) { - this.playSound(SoundEvent.METALHIT, 0.5F); - this.setDead(); - } - } - } + if((this.worldObj.client || Vars.damageBullet) && hit.entity.attackEntityFrom(source, damage)) { + if(hit.entity instanceof EntityLiving living && this.shooter instanceof EntityLiving shooter) { + EnchantmentHelper.applyThornEnchantments(living, shooter); + EnchantmentHelper.applyArthropodEnchantments(shooter, living); + } + this.playSound(SoundEvent.METALHIT, 0.2F); + } + this.setDead(); + } + else if(!this.worldObj.client) { + State state = hit.block != null ? this.worldObj.getState(hit.block) : null; + if(state == null || state.getBlock().onShot(this.worldObj, hit.block, state, this)) { + this.playSound(SoundEvent.METALHIT, 0.5F); + this.setDead(); + } + } + } - this.posX += this.motionX; - this.posY += this.motionY; - this.posZ += this.motionZ; - float xzMotion = ExtMath.sqrtd(this.motionX * this.motionX + this.motionZ * this.motionZ); - this.rotYaw = (float)(ExtMath.atan2(this.motionX, this.motionZ) * 180.0D / Math.PI); + this.posX += this.motionX; + this.posY += this.motionY; + this.posZ += this.motionZ; + float xzMotion = ExtMath.sqrtd(this.motionX * this.motionX + this.motionZ * this.motionZ); + this.rotYaw = (float)(ExtMath.atan2(this.motionX, this.motionZ) * 180.0D / Math.PI); - for (this.rotPitch = (float)(ExtMath.atan2(this.motionY, (double)xzMotion) * 180.0D / Math.PI); this.rotPitch - this.prevPitch < -180.0F; this.prevPitch -= 360.0F) - { - ; - } + for(this.rotPitch = (float)(ExtMath.atan2(this.motionY, (double)xzMotion) * 180.0D / Math.PI); this.rotPitch + - this.prevPitch < -180.0F; this.prevPitch -= 360.0F) { + ; + } - while (this.rotPitch - this.prevPitch >= 180.0F) - { - this.prevPitch += 360.0F; - } + while(this.rotPitch - this.prevPitch >= 180.0F) { + this.prevPitch += 360.0F; + } - while (this.rotYaw - this.prevYaw < -180.0F) - { - this.prevYaw -= 360.0F; - } + while(this.rotYaw - this.prevYaw < -180.0F) { + this.prevYaw -= 360.0F; + } - while (this.rotYaw - this.prevYaw >= 180.0F) - { - this.prevYaw += 360.0F; - } + while(this.rotYaw - this.prevYaw >= 180.0F) { + this.prevYaw += 360.0F; + } - this.rotPitch = this.prevPitch + (this.rotPitch - this.prevPitch) * 0.2F; - this.rotYaw = this.prevYaw + (this.rotYaw - this.prevYaw) * 0.2F; - this.setPosition(this.posX, this.posY, this.posZ); - } - - public void writeEntity(TagObject tag) - { - tag.setInt("damage", this.damage); - tag.setInt("age", this.age); - } - - public void readEntity(TagObject tag) - { - this.damage = tag.getInt("damage"); - this.age = tag.getInt("age"); - } - - protected boolean canTriggerWalking() - { - return false; - } + this.rotPitch = this.prevPitch + (this.rotPitch - this.prevPitch) * 0.2F; + this.rotYaw = this.prevYaw + (this.rotYaw - this.prevYaw) * 0.2F; + this.setPosition(this.posX, this.posY, this.posZ); + } - public void setDamage(int damage) - { - this.damage = damage; - } + public void writeEntity(TagObject tag) { + tag.setInt("damage", this.damage); + tag.setInt("age", this.age); + } - public int getDamage() - { - return this.damage; - } - - public boolean canAttackWithItem() - { - return false; - } + public void readEntity(TagObject tag) { + this.damage = tag.getInt("damage"); + this.age = tag.getInt("age"); + } + + protected boolean canTriggerWalking() { + return false; + } + + public void setDamage(int damage) { + this.damage = damage; + } + + public int getDamage() { + return this.damage; + } + + public boolean canAttackWithItem() { + return false; + } + + public float getEyeHeight() { + return 0.0F; + } + + public int getTrackingRange() { + return 96; + } + + public int getUpdateFrequency() { + return 1; + } + + public boolean isSendingVeloUpdates() { + return false; + } - public float getEyeHeight() - { - return 0.0F; - } - - public int getTrackingRange() { - return 96; - } - - public int getUpdateFrequency() { - return 1; - } - - public boolean isSendingVeloUpdates() { - return false; - } - public int getPacketData() { return this.shooter != null ? this.shooter.getId() : this.getId(); } - + public boolean hasSpawnVelocity() { return true; } - - public EntityType getType() { - return EntityType.PROJECTILE; - } + + public EntityType getType() { + return EntityType.PROJECTILE; + } } diff --git a/common/src/main/java/common/entity/projectile/EntityHook.java b/common/src/main/java/common/entity/projectile/EntityHook.java index c5a2e8a..f01f65e 100755 --- a/common/src/main/java/common/entity/projectile/EntityHook.java +++ b/common/src/main/java/common/entity/projectile/EntityHook.java @@ -164,14 +164,14 @@ public class EntityHook extends Entity implements IObjectData this.ticksInGround = 0; } - public void setPositionAndRotation2(double x, double y, double z, float yaw, float pitch, int posRotationIncrements, boolean p_180426_10_) + public void setClientPosition(double x, double y, double z, float yaw, float pitch, boolean teleport) { this.fishX = x; this.fishY = y; this.fishZ = z; this.fishYaw = (double)yaw; this.fishPitch = (double)pitch; - this.fishPosRotationIncrements = posRotationIncrements; + this.fishPosRotationIncrements = 3; this.motionX = this.clientMotionX; this.motionY = this.clientMotionY; this.motionZ = this.clientMotionZ; diff --git a/common/src/main/java/common/entity/types/EntityLiving.java b/common/src/main/java/common/entity/types/EntityLiving.java index 032f859..46a66ca 100755 --- a/common/src/main/java/common/entity/types/EntityLiving.java +++ b/common/src/main/java/common/entity/types/EntityLiving.java @@ -2135,14 +2135,14 @@ public abstract class EntityLiving extends Entity this.fallDistance = 0.0F; } - public void setPositionAndRotation2(double x, double y, double z, float yaw, float pitch, int posRotationIncrements, boolean p_180426_10_) + public void setClientPosition(double x, double y, double z, float yaw, float pitch, boolean teleport) { this.newX = x; this.newY = y; this.newZ = z; this.newYaw = (double)yaw; this.newPitch = (double)pitch; - this.moveIncrements = posRotationIncrements; + this.moveIncrements = 3; } public void setJumping(boolean jumping)