diff --git a/patches/server/0582-Add-back-EntityPortalExitEvent.patch b/patches/server/0582-Add-back-EntityPortalExitEvent.patch index fcaf6caca5..b39d47b31a 100644 --- a/patches/server/0582-Add-back-EntityPortalExitEvent.patch +++ b/patches/server/0582-Add-back-EntityPortalExitEvent.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Add back EntityPortalExitEvent diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java -index 9844550e4ed6c150250b165acc26d52ec9401184..836356ecb3c91fd7886ac9ae83f1cc835469e198 100644 +index 9844550e4ed6c150250b165acc26d52ec9401184..65b1833125ce4b1190bf276a69ad4c0c88875d58 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java @@ -3363,7 +3363,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess @@ -17,29 +17,31 @@ index 9844550e4ed6c150250b165acc26d52ec9401184..836356ecb3c91fd7886ac9ae83f1cc83 // Paper start - gateway-specific teleport event final EntityTeleportEvent teleEvent; if (this.portalProcess != null && this.portalProcess.isSamePortal(((net.minecraft.world.level.block.EndGatewayBlock) net.minecraft.world.level.block.Blocks.END_GATEWAY)) && this.level.getBlockEntity(this.portalProcess.getEntryPosition()) instanceof net.minecraft.world.level.block.entity.TheEndGatewayBlockEntity theEndGatewayBlockEntity) { -@@ -3377,7 +3377,25 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess +@@ -3377,7 +3377,27 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess return null; } to = teleEvent.getTo(); - teleportTarget = new DimensionTransition(((CraftWorld) to.getWorld()).getHandle(), CraftLocation.toVec3D(to), teleportTarget.speed(), to.getYaw(), to.getPitch(), teleportTarget.missingRespawnBlock(), teleportTarget.postDimensionTransition(), teleportTarget.cause()); + // Paper start - Call EntityPortalExitEvent -+ CraftEntity bukkitEntity = this.getBukkitEntity(); -+ Vec3 velocity = teleportTarget.speed(); -+ org.bukkit.event.entity.EntityPortalExitEvent event = new org.bukkit.event.entity.EntityPortalExitEvent( -+ bukkitEntity, -+ bukkitEntity.getLocation(), to.clone(), -+ bukkitEntity.getVelocity(), org.bukkit.craftbukkit.util.CraftVector.toBukkit(velocity) -+ ); -+ event.callEvent(); ++ if (this.portalProcess != null) { // if in a portal ++ CraftEntity bukkitEntity = this.getBukkitEntity(); ++ Vec3 velocity = teleportTarget.speed(); ++ org.bukkit.event.entity.EntityPortalExitEvent event = new org.bukkit.event.entity.EntityPortalExitEvent( ++ bukkitEntity, ++ bukkitEntity.getLocation(), to.clone(), ++ bukkitEntity.getVelocity(), org.bukkit.craftbukkit.util.CraftVector.toBukkit(velocity) ++ ); ++ event.callEvent(); ++ ++ if (!event.isCancelled() && event.getTo() != null) { ++ to = event.getTo().clone(); ++ velocity = org.bukkit.craftbukkit.util.CraftVector.toNMS(event.getAfter()); ++ } ++ teleportTarget = new DimensionTransition(((CraftWorld) to.getWorld()).getHandle(), CraftLocation.toVec3D(to), velocity, to.getYaw(), to.getPitch(), teleportTarget.missingRespawnBlock(), teleportTarget.postDimensionTransition(), teleportTarget.cause()); ++ } + if (this.isRemoved()) { + return null; + } -+ -+ if (!event.isCancelled() && event.getTo() != null) { -+ to = event.getTo().clone(); -+ velocity = org.bukkit.craftbukkit.util.CraftVector.toNMS(event.getAfter()); -+ } -+ teleportTarget = new DimensionTransition(((CraftWorld) to.getWorld()).getHandle(), CraftLocation.toVec3D(to), velocity, to.getYaw(), to.getPitch(), teleportTarget.missingRespawnBlock(), teleportTarget.postDimensionTransition(), teleportTarget.cause()); + // Paper end - Call EntityPortalExitEvent // CraftBukkit end ServerLevel worldserver1 = teleportTarget.newLevel(); diff --git a/patches/server/0636-Forward-CraftEntity-in-teleport-command.patch b/patches/server/0636-Forward-CraftEntity-in-teleport-command.patch index 8e2568f110..9557e79f36 100644 --- a/patches/server/0636-Forward-CraftEntity-in-teleport-command.patch +++ b/patches/server/0636-Forward-CraftEntity-in-teleport-command.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Forward CraftEntity in teleport command diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java -index 35c0591f9d981f1cf7da4d1dea108a8bb3e46c7a..9f40cc481ded9279319d92fe5a0a9278a3f5d9c2 100644 +index 0d98dcfeab1455931219e498072f7129016f6678..56ce703a3b33e0530eb86389f8290d109d321589 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java @@ -3353,6 +3353,13 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess @@ -22,7 +22,7 @@ index 35c0591f9d981f1cf7da4d1dea108a8bb3e46c7a..9f40cc481ded9279319d92fe5a0a9278 CompoundTag nbttagcompound = original.saveWithoutId(new CompoundTag()); nbttagcompound.remove("Dimension"); -@@ -3439,8 +3446,8 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess +@@ -3441,8 +3448,8 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess entity2.restoreFrom(this); this.removeAfterChangingDimensions(); // CraftBukkit start - Forward the CraftEntity to the new entity diff --git a/patches/server/0773-Player-Entity-Tracking-Events.patch b/patches/server/0773-Player-Entity-Tracking-Events.patch index ceec0058a6..62b6d04022 100644 --- a/patches/server/0773-Player-Entity-Tracking-Events.patch +++ b/patches/server/0773-Player-Entity-Tracking-Events.patch @@ -21,10 +21,10 @@ index 61fda6927f060cdf8bcfddaaa08bbbe2c514c630..dca6087dc4e1c177c3dfdae01f140cf8 } else if (this.seenBy.remove(player.connection)) { this.serverEntity.removePairing(player); diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java -index 1aa3396a33e24f3849725769fe58b57374ee7611..3c7175b015262ed354d9a9ae237aff6d34cec713 100644 +index 3170f7246f55799fd5783e747920940ab33c3e40..d5df4ddb33600479e6edb93a18db9400ffc6c699 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java -@@ -3868,7 +3868,14 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess +@@ -3870,7 +3870,14 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess public void startSeenByPlayer(ServerPlayer player) {} diff --git a/patches/server/0781-Improve-PortalEvents.patch b/patches/server/0781-Improve-PortalEvents.patch index bb191a7362..641c38d3db 100644 --- a/patches/server/0781-Improve-PortalEvents.patch +++ b/patches/server/0781-Improve-PortalEvents.patch @@ -18,10 +18,10 @@ index 96dff63230e8cda1f5e548d914c119bd64b5ac33..7270b6fa96bae937663c0fea77887e21 Bukkit.getServer().getPluginManager().callEvent(tpEvent); if (tpEvent.isCancelled() || tpEvent.getTo() == null) { diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java -index 3c7175b015262ed354d9a9ae237aff6d34cec713..303f3656be5e9049cd195030c457df9a7c718b66 100644 +index d5df4ddb33600479e6edb93a18db9400ffc6c699..9958be86d769b9fd17b6d24d0c4f1e96b65dfb08 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java -@@ -3527,7 +3527,15 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess +@@ -3529,7 +3529,15 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess org.bukkit.entity.Entity bukkitEntity = entity.getBukkitEntity(); Location enter = bukkitEntity.getLocation(); diff --git a/patches/server/0843-Folia-scheduler-and-owned-region-API.patch b/patches/server/0843-Folia-scheduler-and-owned-region-API.patch index ee5d5c140f..811bde5d9a 100644 --- a/patches/server/0843-Folia-scheduler-and-owned-region-API.patch +++ b/patches/server/0843-Folia-scheduler-and-owned-region-API.patch @@ -1185,7 +1185,7 @@ index bd67245393f512264db774e0b855db0ce925a3f4..e85b91036c2470b2f164a4641d1c07d2 this.players.remove(entityplayer); this.playersByName.remove(entityplayer.getScoreboardName().toLowerCase(java.util.Locale.ROOT)); // Spigot diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java -index 8e252b930247293e0fbcf350111403ee716cfffa..f81a576084ccceb2b02e8d8cd57442efc7ff1e9f 100644 +index 37f37df8b4185c92c13e43eb89d19514e360059e..33ac5c816c98c2dfa99898279ed74d42a92646cf 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java @@ -254,11 +254,23 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess @@ -1213,7 +1213,7 @@ index 8e252b930247293e0fbcf350111403ee716cfffa..f81a576084ccceb2b02e8d8cd57442ef @Override public CommandSender getBukkitSender(CommandSourceStack wrapper) { return this.getBukkitEntity(); -@@ -4484,6 +4496,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess +@@ -4486,6 +4498,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess public final void setRemoved(Entity.RemovalReason entity_removalreason, EntityRemoveEvent.Cause cause) { CraftEventFactory.callEntityRemoveEvent(this, cause); // CraftBukkit end @@ -1221,7 +1221,7 @@ index 8e252b930247293e0fbcf350111403ee716cfffa..f81a576084ccceb2b02e8d8cd57442ef if (this.removalReason == null) { this.removalReason = entity_removalreason; } -@@ -4494,12 +4507,28 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess +@@ -4496,12 +4509,28 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess this.getPassengers().forEach(Entity::stopRiding); this.levelCallback.onRemove(entity_removalreason); diff --git a/patches/server/0981-Moonrise-optimisation-patches.patch b/patches/server/0981-Moonrise-optimisation-patches.patch index e237b27bbd..4305cb9755 100644 --- a/patches/server/0981-Moonrise-optimisation-patches.patch +++ b/patches/server/0981-Moonrise-optimisation-patches.patch @@ -26935,7 +26935,7 @@ index 50040c497a819cd1229042ab3cb057d34a32cacc..15c5164d0ef41a978c16ee317fa73e97 + // Paper end - block counting } diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java -index 62ef618aff33c98f96d0271bb2ab42235c941052..eda8a591033885c5dcb95f5ff651b12529f479ba 100644 +index 76e9d34e5219fbae0095cf735b58833c29343573..6fe90b281c95062c0be14650c00b21b641c42394 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java @@ -167,7 +167,7 @@ import org.bukkit.event.player.PlayerTeleportEvent; @@ -27238,7 +27238,7 @@ index 62ef618aff33c98f96d0271bb2ab42235c941052..eda8a591033885c5dcb95f5ff651b125 } public InteractionResult interact(Player player, InteractionHand hand) { -@@ -4024,14 +4213,17 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess +@@ -4026,14 +4215,17 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess } public Iterable getIndirectPassengers() { @@ -27263,7 +27263,7 @@ index 62ef618aff33c98f96d0271bb2ab42235c941052..eda8a591033885c5dcb95f5ff651b125 } private Iterable getIndirectPassengers_old() { // Paper end - Optimize indirect passenger iteration -@@ -4396,6 +4588,15 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess +@@ -4398,6 +4590,15 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess this.setPosRaw(x, y, z, false); } public final void setPosRaw(double x, double y, double z, boolean forceBoundingBoxUpdate) { @@ -27279,7 +27279,7 @@ index 62ef618aff33c98f96d0271bb2ab42235c941052..eda8a591033885c5dcb95f5ff651b125 if (!checkPosition(this, x, y, z)) { return; } -@@ -4527,6 +4728,12 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess +@@ -4529,6 +4730,12 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess @Override public final void setRemoved(Entity.RemovalReason entity_removalreason, EntityRemoveEvent.Cause cause) { @@ -27292,7 +27292,7 @@ index 62ef618aff33c98f96d0271bb2ab42235c941052..eda8a591033885c5dcb95f5ff651b125 CraftEventFactory.callEntityRemoveEvent(this, cause); // CraftBukkit end final boolean alreadyRemoved = this.removalReason != null; // Paper - Folia schedulers -@@ -4538,7 +4745,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess +@@ -4540,7 +4747,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess this.stopRiding(); } @@ -27301,7 +27301,7 @@ index 62ef618aff33c98f96d0271bb2ab42235c941052..eda8a591033885c5dcb95f5ff651b125 this.levelCallback.onRemove(entity_removalreason); // Paper start - Folia schedulers if (!(this instanceof ServerPlayer) && entity_removalreason != RemovalReason.CHANGED_DIMENSION && !alreadyRemoved) { -@@ -4569,7 +4776,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess +@@ -4571,7 +4778,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess @Override public boolean shouldBeSaved() { diff --git a/patches/server/1027-Detail-more-information-in-watchdog-dumps.patch b/patches/server/1027-Detail-more-information-in-watchdog-dumps.patch index cddaca3e53..d82b120f85 100644 --- a/patches/server/1027-Detail-more-information-in-watchdog-dumps.patch +++ b/patches/server/1027-Detail-more-information-in-watchdog-dumps.patch @@ -122,7 +122,7 @@ index 9e1af229f52a8ac09833901ad53bd154fed34a4f..c5698b05cc3ea4cb1bc6789c30f2aab7 private void tickPassenger(Entity vehicle, Entity passenger) { diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java -index 74231cb1c89079473d1727aa3ae2a539d4250317..9f68c0fda7f5526eb97619f1a35ed3b78d1b3751 100644 +index 2a49bbc2c7b06a065cd33575e6807594529bd1bc..bc45c74987974b4828201e06fc8b1f3fbc0af8b4 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java @@ -1086,8 +1086,43 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess @@ -183,7 +183,7 @@ index 74231cb1c89079473d1727aa3ae2a539d4250317..9f68c0fda7f5526eb97619f1a35ed3b7 } private boolean isStateClimbable(BlockState state) { -@@ -4550,7 +4592,9 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess +@@ -4552,7 +4594,9 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess } public void setDeltaMovement(Vec3 velocity) { @@ -193,7 +193,7 @@ index 74231cb1c89079473d1727aa3ae2a539d4250317..9f68c0fda7f5526eb97619f1a35ed3b7 } public void addDeltaMovement(Vec3 velocity) { -@@ -4656,7 +4700,9 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess +@@ -4658,7 +4702,9 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess } // Paper end - Fix MC-4 if (this.position.x != x || this.position.y != y || this.position.z != z) {