SPIGOT-5133: Throwing items into secondary end world portal causes crash

This commit is contained in:
md_5 2019-07-02 10:47:00 +10:00
parent a0e47473ce
commit bf32933484

View file

@ -598,7 +598,7 @@
} }
public void j(boolean flag) { public void j(boolean flag) {
@@ -2037,20 +2378,33 @@ @@ -2037,33 +2378,46 @@
@Nullable @Nullable
public Entity a(DimensionManager dimensionmanager) { public Entity a(DimensionManager dimensionmanager) {
@ -631,10 +631,27 @@
- BlockPosition blockposition; - BlockPosition blockposition;
+ BlockPosition blockposition = location; // CraftBukkit + BlockPosition blockposition = location; // CraftBukkit
- if (dimensionmanager1 == DimensionManager.THE_END && dimensionmanager == DimensionManager.OVERWORLD) {
+ if (blockposition == null) { // CraftBukkit + if (blockposition == null) { // CraftBukkit
if (dimensionmanager1 == DimensionManager.THE_END && dimensionmanager == DimensionManager.OVERWORLD) { + if (dimensionmanager1.getType() == DimensionManager.THE_END && dimensionmanager == DimensionManager.OVERWORLD) { // CraftBukkit
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) {
+ } else if (dimensionmanager.getType() == DimensionManager.THE_END) { // CraftBukkit
blockposition = worldserver1.getDimensionSpawn();
} else {
double d0 = this.locX;
double d1 = this.locZ;
double d2 = 8.0D;
- if (dimensionmanager1 == DimensionManager.OVERWORLD && dimensionmanager == DimensionManager.NETHER) {
+ if (dimensionmanager1.getType() == DimensionManager.OVERWORLD && dimensionmanager.getType() == DimensionManager.NETHER) { // CraftBukkit
d0 /= 8.0D;
d1 /= 8.0D;
- } else if (dimensionmanager1 == DimensionManager.NETHER && dimensionmanager == DimensionManager.OVERWORLD) {
+ } else if (dimensionmanager1.getType() == DimensionManager.NETHER && dimensionmanager.getType() == DimensionManager.OVERWORLD) { // CraftBukkit
d0 *= 8.0D;
d1 *= 8.0D;
}
@@ -2088,6 +2442,25 @@ @@ -2088,6 +2442,25 @@
vec3d = shapedetector_shape.velocity; vec3d = shapedetector_shape.velocity;
f = (float) shapedetector_shape.yaw; f = (float) shapedetector_shape.yaw;