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