cleanup setClientPosition

This commit is contained in:
Sen 2025-06-16 11:14:56 +02:00
parent 431d54f779
commit 256721aa12
Signed by: sen
GPG key ID: 3AC50A6F47D1B722
9 changed files with 246 additions and 282 deletions

View file

@ -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) 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 else
{ {
entity.setPositionAndRotation2(d0, d1, d2, f, f1, 3, true); entity.setClientPosition(d0, d1, d2, f, f1, true);
} }
entity.onGround = packetIn.getOnGround(); entity.onGround = packetIn.getOnGround();
@ -597,7 +597,7 @@ public class ClientPlayer implements IClientPlayer
double d2 = (double)entity.serverPosZ / 32.0D; double d2 = (double)entity.serverPosZ / 32.0D;
float f = packetIn.hasRotations() ? (float)(packetIn.getYaw() * 360) / 256.0F : entity.rotYaw; float f = packetIn.hasRotations() ? (float)(packetIn.getYaw() * 360) / 256.0F : entity.rotYaw;
float f1 = packetIn.hasRotations() ? (float)(packetIn.getPitch() * 360) / 256.0F : entity.rotPitch; 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(); entity.onGround = packetIn.getOnGround();
} }
} }

View file

@ -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.setPosition(x, y, z);
this.setRotation(yaw, pitch); this.setRotation(yaw, pitch);

View file

@ -172,9 +172,9 @@ public class EntityBoat extends Entity
return !this.dead; 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.prevX = this.posX = x;
this.prevY = this.posY = y; this.prevY = this.posY = y;
@ -191,7 +191,7 @@ public class EntityBoat extends Entity
{ {
if (this.isBoatEmpty) if (this.isBoatEmpty)
{ {
this.boatPosRotationIncrements = posRotationIncrements + 5; this.boatPosRotationIncrements = 8;
} }
else else
{ {

View file

@ -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.minecartX = x;
this.minecartY = y; this.minecartY = y;
this.minecartZ = z; this.minecartZ = z;
this.minecartYaw = (double)yaw; this.minecartYaw = (double)yaw;
this.minecartPitch = (double)pitch; this.minecartPitch = (double)pitch;
this.turnProgress = posRotationIncrements + 2; this.turnProgress = 5;
this.motionX = this.velocityX; this.motionX = this.velocityX;
this.motionY = this.velocityY; this.motionY = this.velocityY;
this.motionZ = this.velocityZ; this.motionZ = this.velocityZ;

View file

@ -2791,7 +2791,7 @@ public abstract class EntityNPC extends EntityLiving
// START OTHER // 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) { if(this.slave && this.client == null) {
this.otherPlayerMPX = x; this.otherPlayerMPX = x;
@ -2799,10 +2799,10 @@ public abstract class EntityNPC extends EntityLiving
this.otherPlayerMPZ = z; this.otherPlayerMPZ = z;
this.otherPlayerMPYaw = (double)yaw; this.otherPlayerMPYaw = (double)yaw;
this.otherPlayerMPPitch = (double)pitch; this.otherPlayerMPPitch = (double)pitch;
this.otherPlayerMPPosRotationIncrements = posRotationIncrements; this.otherPlayerMPPosRotationIncrements = 3;
} }
else { else {
super.setPositionAndRotation2(x, y, z, yaw, pitch, posRotationIncrements, p_180426_10_); super.setClientPosition(x, y, z, yaw, pitch, teleport);
} }
} }

View file

@ -156,7 +156,7 @@ public class EntityArrow extends Entity implements IProjectile, IObjectData
this.ticksInGround = 0; 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.setPosition(x, y, z);
this.setRotation(yaw, pitch); this.setRotation(yaw, pitch);

View file

@ -19,307 +19,271 @@ import common.vars.Vars;
import common.world.State; import common.world.State;
import common.world.World; import common.world.World;
public class EntityBullet extends Entity implements IProjectile, IObjectData public class EntityBullet extends Entity implements IProjectile, IObjectData {
{ private Entity shooter;
private Entity shooter; private int ticksMoved;
private int ticksMoved; private int age;
private int age; private int damage = 5;
private int damage = 5;
public EntityBullet(World world) public EntityBullet(World world) {
{ super(world);
super(world); this.renderDistWeight = 10.0D;
this.renderDistWeight = 10.0D; this.setSize(0.5F, 0.5F);
this.setSize(0.5F, 0.5F); }
}
public EntityBullet(World world, double x, double y, double z) public EntityBullet(World world, double x, double y, double z) {
{ super(world);
super(world); this.renderDistWeight = 10.0D;
this.renderDistWeight = 10.0D; this.setSize(0.5F, 0.5F);
this.setSize(0.5F, 0.5F); this.setPosition(x, y, z);
this.setPosition(x, y, z); }
}
public EntityBullet(World world, double x, double y, double z, int data) public EntityBullet(World world, double x, double y, double z, int data) {
{ this(world, x, y, z);
this(world, x, y, z); Entity entity = world.getEntityByID(data);
Entity entity = world.getEntityByID(data); if(entity instanceof EntityLiving)
if(entity instanceof EntityLiving) this.shooter = entity;
this.shooter = entity; }
}
public EntityBullet(World world, EntityLiving shooter, EntityLiving target, float velocity, float innacuracy) public EntityBullet(World world, EntityLiving shooter, EntityLiving target, float velocity, float innacuracy) {
{ super(world);
super(world); this.renderDistWeight = 10.0D;
this.renderDistWeight = 10.0D; this.shooter = shooter;
this.shooter = shooter; this.posY = shooter.posY + (double)shooter.getEyeHeight() - 0.10000000149011612D;
this.posY = shooter.posY + (double)shooter.getEyeHeight() - 0.10000000149011612D; double xd = target.posX - shooter.posX;
double xd = target.posX - shooter.posX; double yd = target.getEntityBoundingBox().minY + (double)(target.height * 0.7f) - this.posY;
double yd = target.getEntityBoundingBox().minY + (double)(target.height * 0.7f) - this.posY; double zd = target.posZ - shooter.posZ;
double zd = target.posZ - shooter.posZ; double xzd = (double)ExtMath.sqrtd(xd * xd + zd * zd);
double xzd = (double)ExtMath.sqrtd(xd * xd + zd * zd); if(xzd >= 1.0E-7D) {
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));
float yaw = (float)(ExtMath.atan2(zd, xd) * 180.0D / Math.PI) - 90.0F; double x = xd / xzd;
float pitch = (float)(-(ExtMath.atan2(yd, xzd) * 180.0D / Math.PI)); double z = zd / xzd;
double x = xd / xzd; this.setLocationAndAngles(shooter.posX + x, this.posY, shooter.posZ + z, yaw, pitch);
double z = zd / xzd; this.setThrowableHeading(xd, yd, zd, velocity, innacuracy);
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) public EntityBullet(World world, EntityLiving shooter, float velocity) {
{ super(world);
super(world); this.renderDistWeight = 10.0D;
this.renderDistWeight = 10.0D; this.shooter = shooter;
this.shooter = shooter; this.setSize(0.5F, 0.5F);
this.setSize(0.5F, 0.5F); this.setLocationAndAngles(shooter.posX, shooter.posY + (double)shooter.getEyeHeight(), shooter.posZ, shooter.rotYaw, shooter.rotPitch);
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.posX -= (double)(ExtMath.cos(this.rotYaw / 180.0F * (float)Math.PI) * 0.16F); this.posY -= 0.10000000149011612D;
this.posY -= 0.10000000149011612D; this.posZ -= (double)(ExtMath.sin(this.rotYaw / 180.0F * (float)Math.PI) * 0.16F);
this.posZ -= (double)(ExtMath.sin(this.rotYaw / 180.0F * (float)Math.PI) * 0.16F); this.setPosition(this.posX, this.posY, this.posZ);
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.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.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.motionY = (double)(-ExtMath.sin(this.rotPitch / 180.0F * (float)Math.PI)); this.setThrowableHeading(this.motionX, this.motionY, this.motionZ, velocity, 0.5F);
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) public void setThrowableHeading(double x, double y, double z, float velocity, float inaccuracy) {
{ float sq = ExtMath.sqrtd(x * x + y * y + z * z);
float sq = ExtMath.sqrtd(x * x + y * y + z * z); x = x / (double)sq;
x = x / (double)sq; y = y / (double)sq;
y = y / (double)sq; z = z / (double)sq;
z = z / (double)sq; x = x + this.rand.gaussian() * (double)(this.rand.chance() ? -1 : 1) * 0.007499999832361937D * (double)inaccuracy;
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;
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;
z = z + this.rand.gaussian() * (double)(this.rand.chance() ? -1 : 1) * 0.007499999832361937D * (double)inaccuracy; x = x * (double)velocity;
x = x * (double)velocity; y = y * (double)velocity;
y = y * (double)velocity; z = z * (double)velocity;
z = z * (double)velocity; this.motionX = x;
this.motionX = x; this.motionY = y;
this.motionY = y; this.motionZ = z;
this.motionZ = z; float f1 = ExtMath.sqrtd(x * x + z * z);
float f1 = ExtMath.sqrtd(x * x + z * z); this.prevYaw = this.rotYaw = (float)(ExtMath.atan2(x, z) * 180.0D / Math.PI);
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);
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_) public void setClientPosition(double x, double y, double z, float yaw, float pitch, boolean teleport) {
{ this.setPosition(x, y, z);
this.setPosition(x, y, z); this.setRotation(yaw, pitch);
this.setRotation(yaw, pitch); }
}
public void setVelocity(double x, double y, double z) public void setVelocity(double x, double y, double z) {
{ this.motionX = x;
this.motionX = x; this.motionY = y;
this.motionY = y; this.motionZ = z;
this.motionZ = z; if(this.prevPitch == 0.0F && this.prevYaw == 0.0F) {
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);
float xz = ExtMath.sqrtd(x * x + z * z); this.prevPitch = this.rotPitch = (float)(ExtMath.atan2(y, (double)xz) * 180.0D / Math.PI);
this.prevYaw = this.rotYaw = (float)(ExtMath.atan2(x, z) * 180.0D / Math.PI); this.prevPitch = this.rotPitch;
this.prevPitch = this.rotPitch = (float)(ExtMath.atan2(y, (double)xz) * 180.0D / Math.PI); this.prevYaw = this.rotYaw;
this.prevPitch = this.rotPitch; this.setLocationAndAngles(this.posX, this.posY, this.posZ, this.rotYaw, this.rotPitch);
this.prevYaw = this.rotYaw; }
this.setLocationAndAngles(this.posX, this.posY, this.posZ, this.rotYaw, this.rotPitch); }
}
}
public void onUpdate() public void onUpdate() {
{ super.onUpdate();
super.onUpdate();
if (this.prevPitch == 0.0F && this.prevYaw == 0.0F) if(this.prevPitch == 0.0F && this.prevYaw == 0.0F) {
{ float xz = ExtMath.sqrtd(this.motionX * this.motionX + this.motionZ * this.motionZ);
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.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);
this.prevPitch = this.rotPitch = (float)(ExtMath.atan2(this.motionY, (double)xz) * 180.0D / Math.PI); }
}
if(!this.worldObj.client && ++this.age >= 200) { if(!this.worldObj.client && ++this.age >= 200) {
this.setDead(); this.setDead();
return; return;
} }
++this.ticksMoved; ++this.ticksMoved;
Vec3 current = new Vec3(this.posX, this.posY, this.posZ); 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); 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); HitPosition hit = this.worldObj.rayTraceBlocks(current, next, false, true, false);
current = new Vec3(this.posX, this.posY, this.posZ); current = new Vec3(this.posX, this.posY, this.posZ);
next = new Vec3(this.posX + this.motionX, this.posY + this.motionY, this.posZ + this.motionZ); next = new Vec3(this.posX + this.motionX, this.posY + this.motionY, this.posZ + this.motionZ);
if (hit != null) if(hit != null) {
{ next = new Vec3(hit.vec.xCoord, hit.vec.yCoord, hit.vec.zCoord);
next = new Vec3(hit.vec.xCoord, hit.vec.yCoord, hit.vec.zCoord); }
}
Entity entity = null; Entity entity = null;
List<Entity> list = this.worldObj.getEntitiesWithinAABBExcludingEntity(this, this.getEntityBoundingBox().addCoord(this.motionX, this.motionY, this.motionZ).expand(1.0D, 1.0D, 1.0D)); List<Entity> list = this.worldObj.getEntitiesWithinAABBExcludingEntity(this,
double min = 0.0D; 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) for(int i = 0; i < list.size(); ++i) {
{ Entity ent = list.get(i);
Entity ent = list.get(i);
if (ent.canBeCollidedWith() && (ent != this.shooter || this.ticksMoved >= 5)) if(ent.canBeCollidedWith() && (ent != this.shooter || this.ticksMoved >= 5)) {
{ float expand = 0.3F;
float expand = 0.3F; BoundingBox bb = ent.getEntityBoundingBox().expand((double)expand, (double)expand, (double)expand);
BoundingBox bb = ent.getEntityBoundingBox().expand((double)expand, (double)expand, (double)expand); HitPosition entityHit = bb.calculateIntercept(current, next);
HitPosition entityHit = bb.calculateIntercept(current, next);
if (entityHit != null) if(entityHit != null) {
{ double dist = current.squareDistanceTo(entityHit.vec);
double dist = current.squareDistanceTo(entityHit.vec);
if (dist < min || min == 0.0D) if(dist < min || min == 0.0D) {
{ entity = ent;
entity = ent; min = dist;
min = dist; }
} }
} }
} }
}
if (entity != null) if(entity != null) {
{ hit = new HitPosition(entity);
hit = new HitPosition(entity); }
}
if (hit != null) if(hit != null) {
{ if(hit.entity != 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);
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) if(this.shooter == null) {
{ source = DamageSource.causeShotDamage(this, this);
source = DamageSource.causeShotDamage(this, this); }
} else {
else source = DamageSource.causeShotDamage(this, this.shooter);
{ }
source = DamageSource.causeShotDamage(this, this.shooter);
}
if ((this.worldObj.client || Vars.damageBullet) && hit.entity.attackEntityFrom(source, damage)) if((this.worldObj.client || Vars.damageBullet) && hit.entity.attackEntityFrom(source, damage)) {
{ if(hit.entity instanceof EntityLiving living && this.shooter instanceof EntityLiving shooter) {
if (hit.entity instanceof EntityLiving living && this.shooter instanceof EntityLiving shooter) EnchantmentHelper.applyThornEnchantments(living, shooter);
{ EnchantmentHelper.applyArthropodEnchantments(shooter, living);
EnchantmentHelper.applyThornEnchantments(living, shooter); }
EnchantmentHelper.applyArthropodEnchantments(shooter, living); this.playSound(SoundEvent.METALHIT, 0.2F);
} }
this.playSound(SoundEvent.METALHIT, 0.2F); this.setDead();
} }
this.setDead(); else if(!this.worldObj.client) {
} State state = hit.block != null ? this.worldObj.getState(hit.block) : null;
else if(!this.worldObj.client) if(state == null || state.getBlock().onShot(this.worldObj, hit.block, state, this)) {
{ this.playSound(SoundEvent.METALHIT, 0.5F);
State state = hit.block != null ? this.worldObj.getState(hit.block) : null; this.setDead();
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.posX += this.motionX;
this.posY += this.motionY; this.posY += this.motionY;
this.posZ += this.motionZ; this.posZ += this.motionZ;
float xzMotion = ExtMath.sqrtd(this.motionX * this.motionX + this.motionZ * 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.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) while(this.rotPitch - this.prevPitch >= 180.0F) {
{ this.prevPitch += 360.0F;
this.prevPitch += 360.0F; }
}
while (this.rotYaw - this.prevYaw < -180.0F) while(this.rotYaw - this.prevYaw < -180.0F) {
{ this.prevYaw -= 360.0F;
this.prevYaw -= 360.0F; }
}
while (this.rotYaw - this.prevYaw >= 180.0F) while(this.rotYaw - this.prevYaw >= 180.0F) {
{ this.prevYaw += 360.0F;
this.prevYaw += 360.0F; }
}
this.rotPitch = this.prevPitch + (this.rotPitch - this.prevPitch) * 0.2F; this.rotPitch = this.prevPitch + (this.rotPitch - this.prevPitch) * 0.2F;
this.rotYaw = this.prevYaw + (this.rotYaw - this.prevYaw) * 0.2F; this.rotYaw = this.prevYaw + (this.rotYaw - this.prevYaw) * 0.2F;
this.setPosition(this.posX, this.posY, this.posZ); 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;
}
public void setDamage(int damage) public void writeEntity(TagObject tag) {
{ tag.setInt("damage", this.damage);
this.damage = damage; tag.setInt("age", this.age);
} }
public int getDamage() public void readEntity(TagObject tag) {
{ this.damage = tag.getInt("damage");
return this.damage; this.age = tag.getInt("age");
} }
public boolean canAttackWithItem() protected boolean canTriggerWalking() {
{ return false;
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() { public int getPacketData() {
return this.shooter != null ? this.shooter.getId() : this.getId(); return this.shooter != null ? this.shooter.getId() : this.getId();
} }
public boolean hasSpawnVelocity() { public boolean hasSpawnVelocity() {
return true; return true;
} }
public EntityType getType() { public EntityType getType() {
return EntityType.PROJECTILE; return EntityType.PROJECTILE;
} }
} }

View file

@ -164,14 +164,14 @@ public class EntityHook extends Entity implements IObjectData
this.ticksInGround = 0; 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.fishX = x;
this.fishY = y; this.fishY = y;
this.fishZ = z; this.fishZ = z;
this.fishYaw = (double)yaw; this.fishYaw = (double)yaw;
this.fishPitch = (double)pitch; this.fishPitch = (double)pitch;
this.fishPosRotationIncrements = posRotationIncrements; this.fishPosRotationIncrements = 3;
this.motionX = this.clientMotionX; this.motionX = this.clientMotionX;
this.motionY = this.clientMotionY; this.motionY = this.clientMotionY;
this.motionZ = this.clientMotionZ; this.motionZ = this.clientMotionZ;

View file

@ -2135,14 +2135,14 @@ public abstract class EntityLiving extends Entity
this.fallDistance = 0.0F; 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.newX = x;
this.newY = y; this.newY = y;
this.newZ = z; this.newZ = z;
this.newYaw = (double)yaw; this.newYaw = (double)yaw;
this.newPitch = (double)pitch; this.newPitch = (double)pitch;
this.moveIncrements = posRotationIncrements; this.moveIncrements = 3;
} }
public void setJumping(boolean jumping) public void setJumping(boolean jumping)