diff --git a/patches/server/Block-Enderpearl-Travel-Exploit.patch b/patches/server/Block-Enderpearl-Travel-Exploit.patch index 748168ba3b..da3b40a25b 100644 --- a/patches/server/Block-Enderpearl-Travel-Exploit.patch +++ b/patches/server/Block-Enderpearl-Travel-Exploit.patch @@ -26,6 +26,23 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + log("Disable Unloaded Chunk Enderpearl Exploit: " + (disableEnderpearlExploit ? "enabled" : "disabled")); + } } +diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/server/level/ServerLevel.java ++++ b/src/main/java/net/minecraft/server/level/ServerLevel.java +@@ -0,0 +0,0 @@ public class ServerLevel extends Level implements WorldGenLevel { + + public void onTickingEnd(Entity entity) { + ServerLevel.this.entityTickList.remove(entity); ++ // Paper start - Reset pearls when they stop being ticked ++ if (paperConfig.disableEnderpearlExploit && entity instanceof net.minecraft.world.entity.projectile.ThrownEnderpearl pearl) { ++ pearl.cachedOwner = null; ++ pearl.ownerUUID = null; ++ } ++ // Paper end + } + + public void onTrackingStart(Entity entity) { diff --git a/src/main/java/net/minecraft/world/entity/projectile/Projectile.java b/src/main/java/net/minecraft/world/entity/projectile/Projectile.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/world/entity/projectile/Projectile.java @@ -38,24 +55,3 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 } this.leftOwner = nbt.getBoolean("LeftOwner"); -diff --git a/src/main/java/net/minecraft/world/entity/projectile/ThrownEnderpearl.java b/src/main/java/net/minecraft/world/entity/projectile/ThrownEnderpearl.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/world/entity/projectile/ThrownEnderpearl.java -+++ b/src/main/java/net/minecraft/world/entity/projectile/ThrownEnderpearl.java -@@ -0,0 +0,0 @@ public class ThrownEnderpearl extends ThrowableItemProjectile { - super.tick(); - } - -+ // Paper start -+ if (this.level.paperConfig.disableEnderpearlExploit) { -+ final net.minecraft.server.level.ChunkHolder chunkHolder = ((net.minecraft.server.level.ServerChunkCache) this.level.getChunkSource()).chunkMap.getVisibleChunkIfPresent(net.minecraft.world.level.ChunkPos.asLong(this.blockPosition())); -+ if (chunkHolder == null || !net.minecraft.server.level.ChunkHolder.getFullChunkStatus(chunkHolder.getTicketLevel()).isOrAfter(net.minecraft.server.level.ChunkHolder.FullChunkStatus.ENTITY_TICKING)) { -+ this.cachedOwner = null; -+ this.ownerUUID = null; -+ } -+ } -+ // Paper end -+ - } - - @Nullable diff --git a/patches/server/Optimise-WorldServer-notify.patch b/patches/server/Optimise-WorldServer-notify.patch index a60150170d..0bdcb50099 100644 --- a/patches/server/Optimise-WorldServer-notify.patch +++ b/patches/server/Optimise-WorldServer-notify.patch @@ -179,9 +179,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 public void onTickingEnd(Entity entity) { ServerLevel.this.entityTickList.remove(entity); + ServerLevel.this.entityManager.removeNavigatorsFromData(entity); // Paper - optimise notify - } - - public void onTrackingStart(Entity entity) { + // Paper start - Reset pearls when they stop being ticked + if (paperConfig.disableEnderpearlExploit && entity instanceof net.minecraft.world.entity.projectile.ThrownEnderpearl pearl) { + pearl.cachedOwner = null; diff --git a/src/main/java/net/minecraft/world/entity/ai/navigation/PathNavigation.java b/src/main/java/net/minecraft/world/entity/ai/navigation/PathNavigation.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/world/entity/ai/navigation/PathNavigation.java