SPIGOT-4185: Bubble columns not working on mobs

This commit is contained in:
md_5 2018-07-30 11:17:26 +10:00
parent 23dc9a0271
commit bef764020e

View file

@ -202,30 +202,7 @@
this.setOnFire(15);
}
}
@@ -378,6 +529,22 @@
this.a(this.getBoundingBox().d(d0, d1, d2));
this.recalcPosition();
} else {
+ // CraftBukkit start - Don't do anything if we aren't moving
+ // We need to do this regardless of whether or not we are moving thanks to portals
+ try {
+ this.checkBlockCollisions();
+ } catch (Throwable throwable) {
+ CrashReport crashreport = CrashReport.a(throwable, "Checking entity block collision");
+ CrashReportSystemDetails crashreportsystemdetails = crashreport.a("Entity being checked for collision");
+
+ this.appendEntityCrashDetails(crashreportsystemdetails);
+ throw new ReportedException(crashreport);
+ }
+ // Check if we're moving
+ if (d0 == 0 && d1 == 0 && d2 == 0 && this.isVehicle() && this.isPassenger()) {
+ return;
+ }
+ // CraftBukkit end
if (enummovetype == EnumMoveType.PISTON) {
long i = this.world.getTime();
@@ -505,7 +672,7 @@
@@ -505,7 +656,7 @@
}
}
@ -234,7 +211,7 @@
double d11;
if (this.Q > 0.0F && flag && (d7 != d0 || d9 != d2)) {
@@ -592,7 +759,7 @@
@@ -592,7 +743,7 @@
this.world.methodProfiler.a("rest");
this.recalcPosition();
this.positionChanged = d7 != d0 || d9 != d2;
@ -243,7 +220,7 @@
this.onGround = this.C && d8 < 0.0D;
this.D = this.positionChanged || this.C;
int k = MathHelper.floor(this.locX);
@@ -627,6 +794,28 @@
@@ -627,6 +778,28 @@
block1.a((IBlockAccess) this.world, this);
}
@ -272,25 +249,7 @@
if (this.playStepSound() && (!this.onGround || !this.isSneaking() || !(this instanceof EntityHuman)) && !this.isPassenger()) {
double d22 = this.locX - d4;
double d23 = this.locY - d5;
@@ -662,6 +851,8 @@
}
}
+ // CraftBukkit start - Move to the top of the method
+ /*
try {
this.checkBlockCollisions();
} catch (Throwable throwable) {
@@ -671,6 +862,8 @@
this.appendEntityCrashDetails(crashreportsystemdetails);
throw new ReportedException(crashreport);
}
+ */
+ // CraftBukkit end
boolean flag1 = this.ap();
@@ -679,7 +872,14 @@
@@ -679,7 +852,14 @@
if (!flag1) {
++this.fireTicks;
if (this.fireTicks == 0) {
@ -306,7 +265,7 @@
}
}
} else if (this.fireTicks <= 0) {
@@ -875,7 +1075,7 @@
@@ -875,7 +1055,7 @@
return null;
}
@ -315,7 +274,7 @@
if (!this.fireProof) {
this.damageEntity(DamageSource.FIRE, (float) i);
}
@@ -1094,6 +1294,13 @@
@@ -1094,6 +1274,13 @@
}
public void spawnIn(World world) {
@ -329,7 +288,7 @@
this.world = world;
}
@@ -1318,6 +1525,18 @@
@@ -1318,6 +1505,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}));
@ -348,7 +307,7 @@
nbttagcompound.set("Rotation", this.a(new float[] { this.yaw, this.pitch}));
nbttagcompound.setFloat("FallDistance", this.fallDistance);
nbttagcompound.setShort("Fire", (short) this.fireTicks);
@@ -1327,6 +1546,12 @@
@@ -1327,6 +1526,12 @@
nbttagcompound.setBoolean("Invulnerable", this.invulnerable);
nbttagcompound.setInt("PortalCooldown", this.portalCooldown);
nbttagcompound.a("UUID", this.getUniqueID());
@ -361,7 +320,7 @@
IChatBaseComponent ichatbasecomponent = this.getCustomName();
if (ichatbasecomponent != null) {
@@ -1403,6 +1628,8 @@
@@ -1403,6 +1608,8 @@
this.motX = nbttaglist1.k(0);
this.motY = nbttaglist1.k(1);
this.motZ = nbttaglist1.k(2);
@ -370,7 +329,7 @@
if (Math.abs(this.motX) > 10.0D) {
this.motX = 0.0D;
}
@@ -1414,6 +1641,7 @@
@@ -1414,6 +1621,7 @@
if (Math.abs(this.motZ) > 10.0D) {
this.motZ = 0.0D;
}
@ -378,7 +337,7 @@
this.locX = nbttaglist.k(0);
this.locY = nbttaglist.k(1);
@@ -1470,6 +1698,57 @@
@@ -1470,6 +1678,57 @@
this.setPosition(this.locX, this.locY, this.locZ);
}
@ -436,7 +395,7 @@
} catch (Throwable throwable) {
CrashReport crashreport = CrashReport.a(throwable, "Loading entity NBT");
CrashReportSystemDetails crashreportsystemdetails = crashreport.a("Entity being loaded");
@@ -1543,6 +1822,12 @@
@@ -1543,6 +1802,12 @@
if (itemstack.isEmpty()) {
return null;
} else {
@ -449,7 +408,7 @@
EntityItem entityitem = new EntityItem(this.world, this.locX, this.locY + (double) f, this.locZ, itemstack);
entityitem.n();
@@ -1678,7 +1963,7 @@
@@ -1678,7 +1943,7 @@
Entity entity = this.ax;
this.ax = null;
@ -458,7 +417,7 @@
}
}
@@ -1687,6 +1972,24 @@
@@ -1687,6 +1952,24 @@
if (entity.getVehicle() != this) {
throw new IllegalStateException("Use x.startRiding(y), not y.addPassenger(x)");
} else {
@ -483,7 +442,7 @@
if (!this.world.isClientSide && entity instanceof EntityHuman && !(this.bO() instanceof EntityHuman)) {
this.passengers.add(0, entity);
} else {
@@ -1696,13 +1999,30 @@
@@ -1696,13 +1979,30 @@
}
}
@ -515,7 +474,7 @@
}
protected boolean q(Entity entity) {
@@ -1799,6 +2119,13 @@
@@ -1799,6 +2099,13 @@
}
public void setSwimming(boolean flag) {
@ -529,7 +488,7 @@
this.setFlag(4, flag);
}
@@ -1859,14 +2186,49 @@
@@ -1859,14 +2166,49 @@
}
public void setAirTicks(int i) {
@ -582,7 +541,7 @@
}
}
@@ -2035,19 +2397,76 @@
@@ -2035,19 +2377,76 @@
if (!this.world.isClientSide && !this.dead) {
this.world.methodProfiler.a("changeDimension");
MinecraftServer minecraftserver = this.bK();
@ -662,7 +621,7 @@
BlockPosition blockposition;
if (i == 1) {
@@ -2076,12 +2495,18 @@
@@ -2076,12 +2475,18 @@
blockposition = new BlockPosition(this);
}
@ -682,7 +641,7 @@
if (j == 1 && i == 1) {
BlockPosition blockposition1 = worldserver1.getHighestBlockYAt(HeightMap.Type.MOTION_BLOCKING_NO_LEAVES, worldserver1.getSpawn());
@@ -2089,6 +2514,7 @@
@@ -2089,6 +2494,7 @@
} else {
entity.setPositionRotation(blockposition, entity.yaw, entity.pitch);
}
@ -690,7 +649,7 @@
boolean flag = entity.attachedToPlayer;
@@ -2096,13 +2522,21 @@
@@ -2096,13 +2502,21 @@
worldserver1.addEntity(entity);
entity.attachedToPlayer = flag;
worldserver1.entityJoinedWorld(entity, false);
@ -713,7 +672,7 @@
return entity;
} else {
return null;
@@ -2242,7 +2676,26 @@
@@ -2242,7 +2656,26 @@
}
public void a(AxisAlignedBB axisalignedbb) {