SPIGOT-4921: Preserve entity compat with Vanilla

This commit is contained in:
md_5 2019-05-13 16:50:52 +10:00
parent 58db403011
commit 907de3f4ce

View File

@ -303,7 +303,7 @@
nbttagcompound.setString("id", s);
this.save(nbttagcompound);
return true;
@@ -1265,6 +1437,18 @@
@@ -1265,15 +1437,33 @@
Vec3D vec3d = this.getMot();
nbttagcompound.set("Motion", this.a(vec3d.x, vec3d.y, vec3d.z));
@ -322,7 +322,10 @@
nbttagcompound.set("Rotation", this.a(this.yaw, this.pitch));
nbttagcompound.setFloat("FallDistance", this.fallDistance);
nbttagcompound.setShort("Fire", (short) this.fireTicks);
@@ -1274,6 +1458,12 @@
nbttagcompound.setShort("Air", (short) this.getAirTicks());
nbttagcompound.setBoolean("OnGround", this.onGround);
- nbttagcompound.setInt("Dimension", this.dimension.getDimensionID());
+ nbttagcompound.setInt("Dimension", this.dimension.getType().getDimensionID()); // CraftBukkit - preserve Vanilla compat
nbttagcompound.setBoolean("Invulnerable", this.invulnerable);
nbttagcompound.setInt("PortalCooldown", this.portalCooldown);
nbttagcompound.a("UUID", this.getUniqueID());
@ -347,6 +350,15 @@
return nbttagcompound;
} catch (Throwable throwable) {
CrashReport crashreport = CrashReport.a(throwable, "Saving entity NBT");
@@ -1371,7 +1566,7 @@
this.setAirTicks(nbttagcompound.getShort("Air"));
this.onGround = nbttagcompound.getBoolean("OnGround");
if (nbttagcompound.hasKey("Dimension")) {
- this.dimension = DimensionManager.a(nbttagcompound.getInt("Dimension"));
+ // this.dimension = DimensionManager.a(nbttagcompound.getInt("Dimension")); // CraftBukkit - redundant
}
this.invulnerable = nbttagcompound.getBoolean("Invulnerable");
@@ -1414,6 +1609,42 @@
} else {
throw new IllegalStateException("Entity has invalid position");