mirror of
https://github.com/PaperMC/Paper.git
synced 2025-08-01 12:42:05 -07:00
SPIGOT-4396: Improve vehicle movement
This commit is contained in:
@@ -107,7 +107,15 @@
|
||||
this.yaw = f % 360.0F;
|
||||
this.pitch = f1 % 360.0F;
|
||||
}
|
||||
@@ -234,6 +318,51 @@
|
||||
@@ -224,6 +308,7 @@
|
||||
float f1 = this.length;
|
||||
|
||||
this.a(new AxisAlignedBB(d0 - (double) f, d1, d2 - (double) f, d0 + (double) f, d1 + (double) f1, d2 + (double) f));
|
||||
+ if (valid) world.entityJoinedWorld(this, false); // CraftBukkit
|
||||
}
|
||||
|
||||
public void tick() {
|
||||
@@ -234,6 +319,51 @@
|
||||
this.W();
|
||||
}
|
||||
|
||||
@@ -159,7 +167,7 @@
|
||||
public void W() {
|
||||
this.world.methodProfiler.a("entityBaseTick");
|
||||
if (this.isPassenger() && this.getVehicle().dead) {
|
||||
@@ -250,6 +379,8 @@
|
||||
@@ -250,6 +380,8 @@
|
||||
this.lastZ = this.locZ;
|
||||
this.lastPitch = this.pitch;
|
||||
this.lastYaw = this.yaw;
|
||||
@@ -168,7 +176,7 @@
|
||||
if (!this.world.isClientSide && this.world instanceof WorldServer) {
|
||||
this.world.methodProfiler.a("portal");
|
||||
if (this.an) {
|
||||
@@ -289,6 +420,7 @@
|
||||
@@ -289,6 +421,7 @@
|
||||
this.E();
|
||||
this.world.methodProfiler.e();
|
||||
}
|
||||
@@ -176,7 +184,7 @@
|
||||
|
||||
this.av();
|
||||
this.r();
|
||||
@@ -339,7 +471,23 @@
|
||||
@@ -339,7 +472,23 @@
|
||||
|
||||
protected void burnFromLava() {
|
||||
if (!this.fireProof) {
|
||||
@@ -201,7 +209,7 @@
|
||||
this.damageEntity(DamageSource.LAVA, 4.0F);
|
||||
}
|
||||
}
|
||||
@@ -505,7 +653,7 @@
|
||||
@@ -505,7 +654,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -210,7 +218,7 @@
|
||||
double d11;
|
||||
|
||||
if (this.Q > 0.0F && flag && (d7 != d0 || d9 != d2)) {
|
||||
@@ -592,7 +740,7 @@
|
||||
@@ -592,7 +741,7 @@
|
||||
this.world.methodProfiler.a("rest");
|
||||
this.recalcPosition();
|
||||
this.positionChanged = d7 != d0 || d9 != d2;
|
||||
@@ -219,7 +227,7 @@
|
||||
this.onGround = this.C && d8 < 0.0D;
|
||||
this.D = this.positionChanged || this.C;
|
||||
int k = MathHelper.floor(this.locX);
|
||||
@@ -627,6 +775,28 @@
|
||||
@@ -627,6 +776,28 @@
|
||||
block1.a((IBlockAccess) this.world, this);
|
||||
}
|
||||
|
||||
@@ -248,7 +256,7 @@
|
||||
if (this.playStepSound() && (!this.onGround || !this.isSneaking() || !(this instanceof EntityHuman)) && !this.isPassenger()) {
|
||||
double d22 = this.locX - d4;
|
||||
double d23 = this.locY - d5;
|
||||
@@ -678,7 +848,14 @@
|
||||
@@ -678,7 +849,14 @@
|
||||
if (!flag1) {
|
||||
++this.fireTicks;
|
||||
if (this.fireTicks == 0) {
|
||||
@@ -264,7 +272,15 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -876,7 +1053,7 @@
|
||||
@@ -706,6 +884,7 @@
|
||||
this.locX = (axisalignedbb.a + axisalignedbb.d) / 2.0D;
|
||||
this.locY = axisalignedbb.b;
|
||||
this.locZ = (axisalignedbb.c + axisalignedbb.f) / 2.0D;
|
||||
+ if (valid) world.entityJoinedWorld(this, false); // CraftBukkit
|
||||
}
|
||||
|
||||
protected SoundEffect ad() {
|
||||
@@ -876,7 +1055,7 @@
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -273,7 +289,7 @@
|
||||
if (!this.fireProof) {
|
||||
this.damageEntity(DamageSource.FIRE, (float) i);
|
||||
}
|
||||
@@ -1095,6 +1272,13 @@
|
||||
@@ -1095,6 +1274,13 @@
|
||||
}
|
||||
|
||||
public void spawnIn(World world) {
|
||||
@@ -287,7 +303,15 @@
|
||||
this.world = world;
|
||||
}
|
||||
|
||||
@@ -1302,7 +1486,7 @@
|
||||
@@ -1120,6 +1306,7 @@
|
||||
this.lastYaw -= 360.0F;
|
||||
}
|
||||
|
||||
+ world.getChunkAt((int) Math.floor(this.locX) >> 4, (int) Math.floor(this.locZ) >> 4); // CraftBukkit
|
||||
this.setPosition(this.locX, this.locY, this.locZ);
|
||||
this.setYawPitch(f, f1);
|
||||
}
|
||||
@@ -1302,7 +1489,7 @@
|
||||
public boolean c(NBTTagCompound nbttagcompound) {
|
||||
String s = this.getSaveID();
|
||||
|
||||
@@ -296,7 +320,7 @@
|
||||
nbttagcompound.setString("id", s);
|
||||
this.save(nbttagcompound);
|
||||
return true;
|
||||
@@ -1319,6 +1503,18 @@
|
||||
@@ -1319,6 +1506,18 @@
|
||||
try {
|
||||
nbttagcompound.set("Pos", this.a(new double[] { this.locX, this.locY, this.locZ}));
|
||||
nbttagcompound.set("Motion", this.a(new double[] { this.motX, this.motY, this.motZ}));
|
||||
@@ -315,7 +339,7 @@
|
||||
nbttagcompound.set("Rotation", this.a(new float[] { this.yaw, this.pitch}));
|
||||
nbttagcompound.setFloat("FallDistance", this.fallDistance);
|
||||
nbttagcompound.setShort("Fire", (short) this.fireTicks);
|
||||
@@ -1328,6 +1524,12 @@
|
||||
@@ -1328,6 +1527,12 @@
|
||||
nbttagcompound.setBoolean("Invulnerable", this.invulnerable);
|
||||
nbttagcompound.setInt("PortalCooldown", this.portalCooldown);
|
||||
nbttagcompound.a("UUID", this.getUniqueID());
|
||||
@@ -328,7 +352,7 @@
|
||||
IChatBaseComponent ichatbasecomponent = this.getCustomName();
|
||||
|
||||
if (ichatbasecomponent != null) {
|
||||
@@ -1404,6 +1606,8 @@
|
||||
@@ -1404,6 +1609,8 @@
|
||||
this.motX = nbttaglist1.k(0);
|
||||
this.motY = nbttaglist1.k(1);
|
||||
this.motZ = nbttaglist1.k(2);
|
||||
@@ -337,7 +361,7 @@
|
||||
if (Math.abs(this.motX) > 10.0D) {
|
||||
this.motX = 0.0D;
|
||||
}
|
||||
@@ -1415,6 +1619,7 @@
|
||||
@@ -1415,6 +1622,7 @@
|
||||
if (Math.abs(this.motZ) > 10.0D) {
|
||||
this.motZ = 0.0D;
|
||||
}
|
||||
@@ -345,7 +369,7 @@
|
||||
|
||||
this.locX = nbttaglist.k(0);
|
||||
this.locY = nbttaglist.k(1);
|
||||
@@ -1471,6 +1676,56 @@
|
||||
@@ -1471,6 +1679,56 @@
|
||||
this.setPosition(this.locX, this.locY, this.locZ);
|
||||
}
|
||||
|
||||
@@ -402,7 +426,7 @@
|
||||
} catch (Throwable throwable) {
|
||||
CrashReport crashreport = CrashReport.a(throwable, "Loading entity NBT");
|
||||
CrashReportSystemDetails crashreportsystemdetails = crashreport.a("Entity being loaded");
|
||||
@@ -1544,9 +1799,22 @@
|
||||
@@ -1544,9 +1802,22 @@
|
||||
if (itemstack.isEmpty()) {
|
||||
return null;
|
||||
} else {
|
||||
@@ -425,7 +449,7 @@
|
||||
this.world.addEntity(entityitem);
|
||||
return entityitem;
|
||||
}
|
||||
@@ -1658,7 +1926,7 @@
|
||||
@@ -1658,7 +1929,7 @@
|
||||
}
|
||||
|
||||
this.vehicle = entity;
|
||||
@@ -434,7 +458,7 @@
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -1679,15 +1947,33 @@
|
||||
@@ -1679,15 +1950,33 @@
|
||||
Entity entity = this.vehicle;
|
||||
|
||||
this.vehicle = null;
|
||||
@@ -470,7 +494,7 @@
|
||||
if (!this.world.isClientSide && entity instanceof EntityHuman && !(this.bO() instanceof EntityHuman)) {
|
||||
this.passengers.add(0, entity);
|
||||
} else {
|
||||
@@ -1695,15 +1981,33 @@
|
||||
@@ -1695,15 +1984,33 @@
|
||||
}
|
||||
|
||||
}
|
||||
@@ -505,7 +529,7 @@
|
||||
}
|
||||
|
||||
protected boolean q(Entity entity) {
|
||||
@@ -1800,6 +2104,13 @@
|
||||
@@ -1800,6 +2107,13 @@
|
||||
}
|
||||
|
||||
public void setSwimming(boolean flag) {
|
||||
@@ -519,7 +543,7 @@
|
||||
this.setFlag(4, flag);
|
||||
}
|
||||
|
||||
@@ -1860,16 +2171,53 @@
|
||||
@@ -1860,16 +2174,53 @@
|
||||
}
|
||||
|
||||
public void setAirTicks(int i) {
|
||||
@@ -576,7 +600,7 @@
|
||||
}
|
||||
|
||||
public void j(boolean flag) {
|
||||
@@ -2036,19 +2384,72 @@
|
||||
@@ -2036,19 +2387,72 @@
|
||||
if (!this.world.isClientSide && !this.dead) {
|
||||
this.world.methodProfiler.a("changeDimension");
|
||||
MinecraftServer minecraftserver = this.bK();
|
||||
@@ -652,7 +676,7 @@
|
||||
BlockPosition blockposition;
|
||||
|
||||
if (dimensionmanager == DimensionManager.THE_END) {
|
||||
@@ -2077,12 +2478,18 @@
|
||||
@@ -2077,12 +2481,18 @@
|
||||
blockposition = new BlockPosition(this);
|
||||
}
|
||||
|
||||
@@ -672,7 +696,7 @@
|
||||
if (dimensionmanager1 == DimensionManager.THE_END && dimensionmanager == DimensionManager.THE_END) {
|
||||
BlockPosition blockposition1 = worldserver1.getHighestBlockYAt(HeightMap.Type.MOTION_BLOCKING_NO_LEAVES, worldserver1.getSpawn());
|
||||
|
||||
@@ -2090,6 +2497,7 @@
|
||||
@@ -2090,6 +2500,7 @@
|
||||
} else {
|
||||
entity.setPositionRotation(blockposition, entity.yaw, entity.pitch);
|
||||
}
|
||||
@@ -680,7 +704,7 @@
|
||||
|
||||
boolean flag = entity.attachedToPlayer;
|
||||
|
||||
@@ -2097,13 +2505,21 @@
|
||||
@@ -2097,13 +2508,21 @@
|
||||
worldserver1.addEntity(entity);
|
||||
entity.attachedToPlayer = flag;
|
||||
worldserver1.entityJoinedWorld(entity, false);
|
||||
@@ -703,7 +727,7 @@
|
||||
return entity;
|
||||
} else {
|
||||
return null;
|
||||
@@ -2243,7 +2659,26 @@
|
||||
@@ -2243,7 +2662,26 @@
|
||||
}
|
||||
|
||||
public void a(AxisAlignedBB axisalignedbb) {
|
||||
|
Reference in New Issue
Block a user