Fix reading custom persistent entity data

This commit is contained in:
md_5 2019-05-25 11:22:18 +10:00
parent 8378335737
commit 17da34209f

View file

@ -363,7 +363,7 @@
}
this.invulnerable = nbttagcompound.getBoolean("Invulnerable");
@@ -1414,6 +1613,42 @@
@@ -1414,6 +1613,43 @@
} else {
throw new IllegalStateException("Entity has invalid position");
}
@ -399,14 +399,15 @@
+ bworld = ((org.bukkit.craftbukkit.CraftServer) server).getServer().getWorldServer(DimensionManager.OVERWORLD).getWorld();
+ }
+
+ spawnIn(bworld == null? null : ((CraftWorld) bworld).getHandle());
+ spawnIn(bworld == null ? null : ((CraftWorld) bworld).getHandle());
+ }
+ this.getBukkitEntity().readBukkitValues(nbttagcompound);
+ // CraftBukkit end
+
} catch (Throwable throwable) {
CrashReport crashreport = CrashReport.a(throwable, "Loading entity NBT");
CrashReportSystemDetails crashreportsystemdetails = crashreport.a("Entity being loaded");
@@ -1489,9 +1724,22 @@
@@ -1489,9 +1725,22 @@
} else if (this.world.isClientSide) {
return null;
} else {
@ -429,7 +430,7 @@
this.world.addEntity(entityitem);
return entityitem;
}
@@ -1595,7 +1843,7 @@
@@ -1595,7 +1844,7 @@
}
this.vehicle = entity;
@ -438,7 +439,7 @@
return true;
}
}
@@ -1620,15 +1868,36 @@
@@ -1620,15 +1869,36 @@
Entity entity = this.vehicle;
this.vehicle = null;
@ -477,7 +478,7 @@
if (!this.world.isClientSide && entity instanceof EntityHuman && !(this.getRidingPassenger() instanceof EntityHuman)) {
this.passengers.add(0, entity);
} else {
@@ -1636,15 +1905,33 @@
@@ -1636,15 +1906,33 @@
}
}
@ -512,7 +513,7 @@
}
protected boolean q(Entity entity) {
@@ -1687,11 +1974,17 @@
@@ -1687,11 +1975,17 @@
int i = this.ab();
if (this.ai) {
@ -532,7 +533,7 @@
this.world.getMethodProfiler().exit();
}
@@ -1771,6 +2064,13 @@
@@ -1771,6 +2065,13 @@
}
public void setSwimming(boolean flag) {
@ -546,7 +547,7 @@
this.setFlag(4, flag);
}
@@ -1831,16 +2131,56 @@
@@ -1831,16 +2132,56 @@
}
public void setAirTicks(int i) {
@ -606,7 +607,7 @@
}
public void j(boolean flag) {
@@ -1988,20 +2328,33 @@
@@ -1988,20 +2329,33 @@
@Nullable
public Entity a(DimensionManager dimensionmanager) {
@ -643,7 +644,7 @@
if (dimensionmanager1 == DimensionManager.THE_END && dimensionmanager == DimensionManager.OVERWORLD) {
blockposition = worldserver1.getHighestBlockYAt(HeightMap.Type.MOTION_BLOCKING_NO_LEAVES, worldserver1.getSpawn());
} else if (dimensionmanager == DimensionManager.THE_END) {
@@ -2039,6 +2392,25 @@
@@ -2039,6 +2393,25 @@
vec3d = shapedetector_c.b;
f = (float) shapedetector_c.c;
}
@ -669,7 +670,7 @@
this.world.getMethodProfiler().exitEnter("reloading");
Entity entity = this.getEntityType().a((World) worldserver1);
@@ -2048,6 +2420,14 @@
@@ -2048,6 +2421,14 @@
entity.setPositionRotation(blockposition, entity.yaw + f, entity.pitch);
entity.setMot(vec3d);
worldserver1.addEntityTeleport(entity);
@ -684,7 +685,7 @@
}
this.dead = true;
@@ -2239,7 +2619,26 @@
@@ -2239,7 +2620,26 @@
}
public void a(AxisAlignedBB axisalignedbb) {