diff --git a/nms-patches/Entity.patch b/nms-patches/Entity.patch index 63a51f350d..b3d4697883 100644 --- a/nms-patches/Entity.patch +++ b/nms-patches/Entity.patch @@ -602,9 +602,12 @@ - BlockPosition blockposition; + BlockPosition blockposition = location; // CraftBukkit -+ if (blockposition == null) { // CraftBukkit - if (this.world.getDimensionKey() == World.THE_END && worldserver.getDimensionKey() == World.OVERWORLD) { +- if (this.world.getDimensionKey() == World.THE_END && worldserver.getDimensionKey() == World.OVERWORLD) { - blockposition = worldserver.getHighestBlockYAt(HeightMap.Type.MOTION_BLOCKING_NO_LEAVES, worldserver.getSpawn()); +- } else if (worldserver.getDimensionKey() == World.THE_END) { +- blockposition = WorldServer.a; ++ if (blockposition == null) { // CraftBukkit ++ if (this.world.getTypeKey() == DimensionManager.THE_END && worldserver.getTypeKey() == DimensionManager.OVERWORLD) { // CraftBukkit + // CraftBukkit start + EntityPortalEvent event = CraftEventFactory.callEntityPortalEvent(this, worldserver, worldserver.getHighestBlockYAt(HeightMap.Type.MOTION_BLOCKING_NO_LEAVES, worldserver.getSpawn()), 0); + if (event == null) { @@ -613,8 +616,7 @@ + worldserver = ((CraftWorld) event.getTo().getWorld()).getHandle(); + blockposition = new BlockPosition(event.getTo().getX(), event.getTo().getY(), event.getTo().getZ()); + // CraftBukkit end - } else if (worldserver.getDimensionKey() == World.THE_END) { -- blockposition = WorldServer.a; ++ } else if (worldserver.getTypeKey() == DimensionManager.THE_END) { // CraftBukkit + // CraftBukkit start + EntityPortalEvent event = CraftEventFactory.callEntityPortalEvent(this, worldserver, WorldServer.a, 0); + if (event == null) { @@ -656,11 +658,13 @@ this.world.getMethodProfiler().exitEnter("reloading"); Entity entity = this.getEntityType().a((World) worldserver); -@@ -2043,8 +2423,16 @@ +@@ -2042,9 +2422,17 @@ + entity.setPositionRotation(blockposition, entity.yaw + f, entity.pitch); entity.setMot(vec3d); worldserver.addEntityTeleport(entity); - if (worldserver.getDimensionKey() == World.THE_END) { +- if (worldserver.getDimensionKey() == World.THE_END) { - WorldServer.a(worldserver); ++ if (worldserver.getTypeKey() == DimensionManager.THE_END) { // CraftBukkit + WorldServer.a(worldserver, this); // CraftBukkit + } + // CraftBukkit start - Forward the CraftEntity to the new entity diff --git a/nms-patches/EntityPlayer.patch b/nms-patches/EntityPlayer.patch index 7017853687..6b45ae8a83 100644 --- a/nms-patches/EntityPlayer.patch +++ b/nms-patches/EntityPlayer.patch @@ -372,9 +372,11 @@ + if (this.isSleeping()) return this; // CraftBukkit - SPIGOT-3154 + // this.worldChangeInvuln = true; // CraftBukkit - Moved down and into PlayerList#changeDimension WorldServer worldserver1 = this.getWorldServer(); - ResourceKey resourcekey = worldserver1.getDimensionKey(); +- ResourceKey resourcekey = worldserver1.getDimensionKey(); ++ ResourceKey resourcekey = worldserver1.getTypeKey(); // CraftBukkit - if (resourcekey == World.THE_END && worldserver.getDimensionKey() == World.OVERWORLD) { +- if (resourcekey == World.THE_END && worldserver.getDimensionKey() == World.OVERWORLD) { ++ if (resourcekey == DimensionManager.THE_END && worldserver.getTypeKey() == DimensionManager.OVERWORLD) { // CraftBukkit + this.worldChangeInvuln = true; // CraftBukkit - Moved down from above this.decouple(); this.getWorldServer().removePlayer(this); @@ -397,14 +399,25 @@ double d0 = this.locX(); double d1 = this.locY(); double d2 = this.locZ(); -@@ -567,6 +777,7 @@ +@@ -567,7 +777,8 @@ worldserver1.getMethodProfiler().enter("moving"); double d3; +- if (worldserver.getDimensionKey() == World.THE_END) { + if (worldserver == null) { } else // CraftBukkit - empty to fall through to null to event - if (worldserver.getDimensionKey() == World.THE_END) { ++ if (worldserver.getTypeKey() == DimensionManager.THE_END) { // CraftBukkit BlockPosition blockposition = WorldServer.a; + d0 = (double) blockposition.getX(); +@@ -576,7 +787,7 @@ + f1 = 90.0F; + f = 0.0F; + } else { +- if (resourcekey == World.OVERWORLD && worldserver.getDimensionKey() == World.THE_NETHER) { ++ if (resourcekey == DimensionManager.OVERWORLD && worldserver.getTypeKey() == DimensionManager.THE_NETHER) { // CraftBukkit + this.cp = this.getPositionVector(); + } + @@ -593,7 +804,26 @@ } } @@ -413,7 +426,7 @@ + // CraftBukkit start + Location enter = this.getBukkitEntity().getLocation(); + Location exit = (worldserver == null) ? null : new Location(worldserver.getWorld(), d0, d1, d2, f1, f); -+ PlayerPortalEvent event = new PlayerPortalEvent(this.getBukkitEntity(), enter, exit, cause, 128, true, resourcekey == World.THE_END ? 0 : 16); ++ PlayerPortalEvent event = new PlayerPortalEvent(this.getBukkitEntity(), enter, exit, cause, 128, true, resourcekey == DimensionManager.THE_END ? 0 : 16); + Bukkit.getServer().getPluginManager().callEvent(event); + if (event.isCancelled() || event.getTo() == null) { + return null; @@ -438,11 +451,7 @@ d0 = MathHelper.a(d0, d4, d5); d2 = MathHelper.a(d2, d3, d6); - this.setPositionRotation(d0, d1, d2, f1, f); -+ // this.setPositionRotation(d0, d1, d2, f1, f); // CraftBukkit - PlayerTeleportEvent handles position changes -+ // CraftBukkit start - PlayerPortalEvent implementation -+ Vec3D exitVelocity = Vec3D.a; -+ BlockPosition exitPosition = new BlockPosition(d0, d1, d2); - if (worldserver.getDimensionKey() == World.THE_END) { +- if (worldserver.getDimensionKey() == World.THE_END) { - int i = MathHelper.floor(this.locX()); - int j = MathHelper.floor(this.locY()) - 1; - int k = MathHelper.floor(this.locZ()); @@ -453,6 +462,11 @@ - } else if (!worldserver.getTravelAgent().findAndTeleport(this, f2)) { - worldserver.getTravelAgent().createPortal(this); - worldserver.getTravelAgent().findAndTeleport(this, f2); ++ // this.setPositionRotation(d0, d1, d2, f1, f); // CraftBukkit - PlayerTeleportEvent handles position changes ++ // CraftBukkit start - PlayerPortalEvent implementation ++ Vec3D exitVelocity = Vec3D.a; ++ BlockPosition exitPosition = new BlockPosition(d0, d1, d2); ++ if (worldserver.getTypeKey() == DimensionManager.THE_END) { // CraftBukkit + int i = exitPosition.getX(); + int j = exitPosition.getY() - 1; + int k = exitPosition.getZ();