From 2bc818efd447f72e93bc67c06dddfabca6bc8246 Mon Sep 17 00:00:00 2001 From: Jake Potrebic Date: Thu, 21 Sep 2023 20:29:51 -0700 Subject: [PATCH] some more patches --- .../0367-Improved-Watchdog-Support.patch} | 63 +++++++++---------- .../0368-Optimize-Pathfinding.patch} | 2 +- ...9-Reduce-Either-Optional-allocation.patch} | 0 ...-memory-footprint-of-NBTTagCompound.patch} | 22 +++---- ...ent-opening-inventories-when-frozen.patch} | 8 +-- ...entity-collision-code-if-not-needed.patch} | 6 +- ...Implement-Player-Client-Options-API.patch} | 17 +++-- ...ayer-is-attempted-to-be-removed-fro.patch} | 6 +- ...-Broken-behavior-of-PlayerJoinEvent.patch} | 22 +++---- ...awn-point-if-spawn-in-unloaded-worl.patch} | 4 +- ...layerAttackEntityCooldownResetEvent.patch} | 4 +- ...-fire-BlockFade-on-worldgen-threads.patch} | 0 ...tom-creative-and-insomniac-controls.patch} | 4 +- ...-duplication-issues-and-teleport-is.patch} | 32 +++++----- 14 files changed, 94 insertions(+), 96 deletions(-) rename patches/{unapplied/server/0371-Improved-Watchdog-Support.patch => server/0367-Improved-Watchdog-Support.patch} (92%) rename patches/{unapplied/server/0372-Optimize-Pathfinding.patch => server/0368-Optimize-Pathfinding.patch} (94%) rename patches/{unapplied/server/0373-Reduce-Either-Optional-allocation.patch => server/0369-Reduce-Either-Optional-allocation.patch} (100%) rename patches/{unapplied/server/0374-Reduce-memory-footprint-of-NBTTagCompound.patch => server/0370-Reduce-memory-footprint-of-NBTTagCompound.patch} (69%) rename patches/{unapplied/server/0375-Prevent-opening-inventories-when-frozen.patch => server/0371-Prevent-opening-inventories-when-frozen.patch} (92%) rename patches/{unapplied/server/0376-Don-t-run-entity-collision-code-if-not-needed.patch => server/0372-Don-t-run-entity-collision-code-if-not-needed.patch} (92%) rename patches/{unapplied/server/0377-Implement-Player-Client-Options-API.patch => server/0373-Implement-Player-Client-Options-API.patch} (87%) rename patches/{unapplied/server/0378-Don-t-crash-if-player-is-attempted-to-be-removed-fro.patch => server/0374-Don-t-crash-if-player-is-attempted-to-be-removed-fro.patch} (81%) rename patches/{unapplied/server/0379-Fix-Longstanding-Broken-behavior-of-PlayerJoinEvent.patch => server/0375-Fix-Longstanding-Broken-behavior-of-PlayerJoinEvent.patch} (88%) rename patches/{unapplied/server/0380-Move-player-to-spawn-point-if-spawn-in-unloaded-worl.patch => server/0376-Move-player-to-spawn-point-if-spawn-in-unloaded-worl.patch} (89%) rename patches/{unapplied/server/0381-Add-PlayerAttackEntityCooldownResetEvent.patch => server/0377-Add-PlayerAttackEntityCooldownResetEvent.patch} (92%) rename patches/{unapplied/server/0382-Don-t-fire-BlockFade-on-worldgen-threads.patch => server/0378-Don-t-fire-BlockFade-on-worldgen-threads.patch} (100%) rename patches/{unapplied/server/0383-Add-phantom-creative-and-insomniac-controls.patch => server/0379-Add-phantom-creative-and-insomniac-controls.patch} (95%) rename patches/{unapplied/server/0384-Fix-numerous-item-duplication-issues-and-teleport-is.patch => server/0380-Fix-numerous-item-duplication-issues-and-teleport-is.patch} (89%) diff --git a/patches/unapplied/server/0371-Improved-Watchdog-Support.patch b/patches/server/0367-Improved-Watchdog-Support.patch similarity index 92% rename from patches/unapplied/server/0371-Improved-Watchdog-Support.patch rename to patches/server/0367-Improved-Watchdog-Support.patch index 77647afa20..753ef66b52 100644 --- a/patches/unapplied/server/0371-Improved-Watchdog-Support.patch +++ b/patches/server/0367-Improved-Watchdog-Support.patch @@ -59,7 +59,7 @@ index 6aaed8e8bf8c721fc834da5c76ac72a4c3e92458..4b002e8b75d117b726b0de274a76d359 // Many servers tend to restart at a fixed time at xx:00 which causes an uneven distribution of requests on the // bStats backend. To circumvent this problem, we introduce some randomness into the initial and second delay. diff --git a/src/main/java/net/minecraft/CrashReport.java b/src/main/java/net/minecraft/CrashReport.java -index 336795dff742b7c6957fbd3476aff31d25a5e659..30a58229aa6dac5039511d0c0df5f2912ea7de9f 100644 +index d7995cadda8f48bbf642114935311180d3ebde5b..226cba0c1eeedd9e80acd603c46b802c183db1fa 100644 --- a/src/main/java/net/minecraft/CrashReport.java +++ b/src/main/java/net/minecraft/CrashReport.java @@ -230,6 +230,7 @@ public class CrashReport { @@ -71,10 +71,10 @@ index 336795dff742b7c6957fbd3476aff31d25a5e659..30a58229aa6dac5039511d0c0df5f291 cause = cause.getCause(); } diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index 498f06aa1d8b2c20f5bf31d6751f08cf1eb4240f..047562e1df93347f629b529ca0647697e22ecf48 100644 +index 0fa1d9f299194ff660130a1cf33d9a405d56a842..d50878653132218dd494e0e5ed6fc3a32d4f1465 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java -@@ -296,7 +296,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop processQueue = new java.util.concurrent.ConcurrentLinkedQueue(); public int autosavePeriod; public Commands vanillaCommandDispatcher; @@ -83,7 +83,7 @@ index 498f06aa1d8b2c20f5bf31d6751f08cf1eb4240f..047562e1df93347f629b529ca0647697 // CraftBukkit end // Spigot start public static final int TPS = 20; -@@ -307,6 +307,9 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop S spin(Function serverFactory) { AtomicReference atomicreference = new AtomicReference(); - Thread thread = new io.papermc.paper.util.TickThread(() -> { // Paper - rewrite chunk system -@@ -883,6 +886,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop { +@@ -858,6 +861,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop 0 && new File( split[0] ).isFile() ) diff --git a/src/main/java/org/spigotmc/WatchdogThread.java b/src/main/java/org/spigotmc/WatchdogThread.java -index b47d043144c499b1499f6b4be5a16a3f75c9fcb8..a9bd33b58a6a3296b70eaaaea3adbee74724e448 100644 +index 06efdd7aa6d35a670e81c4f303618a7ba301396a..e71041d41eae31cce73d8817c4f95f16c8c600aa 100644 --- a/src/main/java/org/spigotmc/WatchdogThread.java +++ b/src/main/java/org/spigotmc/WatchdogThread.java @@ -11,6 +11,7 @@ import org.bukkit.Bukkit; - public final class WatchdogThread extends io.papermc.paper.util.TickThread // Paper - rewrite chunk system + public class WatchdogThread extends Thread { + public static final boolean DISABLE_WATCHDOG = Boolean.getBoolean("disable.watchdog"); // Paper private static WatchdogThread instance; private long timeoutTime; private boolean restart; -@@ -39,6 +40,7 @@ public final class WatchdogThread extends io.papermc.paper.util.TickThread // Pa +@@ -39,6 +40,7 @@ public class WatchdogThread extends Thread { if ( WatchdogThread.instance == null ) { @@ -490,7 +489,7 @@ index b47d043144c499b1499f6b4be5a16a3f75c9fcb8..a9bd33b58a6a3296b70eaaaea3adbee7 WatchdogThread.instance = new WatchdogThread( timeoutTime * 1000L, restart ); WatchdogThread.instance.start(); } else -@@ -70,12 +72,13 @@ public final class WatchdogThread extends io.papermc.paper.util.TickThread // Pa +@@ -70,12 +72,13 @@ public class WatchdogThread extends Thread // Paper start Logger log = Bukkit.getServer().getLogger(); long currentTime = WatchdogThread.monotonicMillis(); @@ -507,7 +506,7 @@ index b47d043144c499b1499f6b4be5a16a3f75c9fcb8..a9bd33b58a6a3296b70eaaaea3adbee7 lastEarlyWarning = currentTime; if (isLongTimeout) { // Paper end -@@ -137,9 +140,24 @@ public final class WatchdogThread extends io.papermc.paper.util.TickThread // Pa +@@ -136,9 +139,24 @@ public class WatchdogThread extends Thread if ( isLongTimeout ) { diff --git a/patches/unapplied/server/0372-Optimize-Pathfinding.patch b/patches/server/0368-Optimize-Pathfinding.patch similarity index 94% rename from patches/unapplied/server/0372-Optimize-Pathfinding.patch rename to patches/server/0368-Optimize-Pathfinding.patch index 73f180d7b5..8fca2b48b1 100644 --- a/patches/unapplied/server/0372-Optimize-Pathfinding.patch +++ b/patches/server/0368-Optimize-Pathfinding.patch @@ -7,7 +7,7 @@ Prevents pathfinding from spamming failures for things such as arrow attacks. 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 03cc97b13b1b8eb591b563c1eb52355b00ea3bf1..b376670d11088e524ce246f667e580e90cd119a3 100644 +index 68edd488087a6ec1e65797cfbd4118bd0efbab50..b37415d45dda8e658c8995a4519e552dc378bb41 100644 --- a/src/main/java/net/minecraft/world/entity/ai/navigation/PathNavigation.java +++ b/src/main/java/net/minecraft/world/entity/ai/navigation/PathNavigation.java @@ -192,9 +192,29 @@ public abstract class PathNavigation { diff --git a/patches/unapplied/server/0373-Reduce-Either-Optional-allocation.patch b/patches/server/0369-Reduce-Either-Optional-allocation.patch similarity index 100% rename from patches/unapplied/server/0373-Reduce-Either-Optional-allocation.patch rename to patches/server/0369-Reduce-Either-Optional-allocation.patch diff --git a/patches/unapplied/server/0374-Reduce-memory-footprint-of-NBTTagCompound.patch b/patches/server/0370-Reduce-memory-footprint-of-NBTTagCompound.patch similarity index 69% rename from patches/unapplied/server/0374-Reduce-memory-footprint-of-NBTTagCompound.patch rename to patches/server/0370-Reduce-memory-footprint-of-NBTTagCompound.patch index 9fb5402d3a..e6907357f4 100644 --- a/patches/unapplied/server/0374-Reduce-memory-footprint-of-NBTTagCompound.patch +++ b/patches/server/0370-Reduce-memory-footprint-of-NBTTagCompound.patch @@ -8,19 +8,19 @@ is important because we clone chunk data after reading it for safety. So, reduce the impact of the clone on GC. diff --git a/src/main/java/net/minecraft/nbt/CompoundTag.java b/src/main/java/net/minecraft/nbt/CompoundTag.java -index 64765dab6fed87ffdf4af197d8d5f28a04544db0..1d13bc15c56faa69699fb3ad39210233d6b6934d 100644 +index 92095b494a0c4fb89b84f0b1c0376615d28e34ce..ad0251b73d21b36bf19e9aa649817b4da2d0a6b4 100644 --- a/src/main/java/net/minecraft/nbt/CompoundTag.java +++ b/src/main/java/net/minecraft/nbt/CompoundTag.java -@@ -36,7 +36,7 @@ public class CompoundTag implements Tag { - if (i > 512) { - throw new RuntimeException("Tried to read NBT tag with too high complexity, depth > 512"); - } else { -- Map map = Maps.newHashMap(); -+ it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap map = new it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap<>(8, 0.8f); // Paper - reduce memory footprint of NBTTagCompound +@@ -46,7 +46,7 @@ public class CompoundTag implements Tag { - byte b; - while((b = CompoundTag.readNamedTagType(dataInput, nbtAccounter)) != 0) { -@@ -130,7 +130,7 @@ public class CompoundTag implements Tag { + private static CompoundTag loadCompound(DataInput input, NbtAccounter tracker) throws IOException { + tracker.accountBytes(48L); +- Map map = Maps.newHashMap(); ++ it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap map = new it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap<>(8, 0.8f); // Paper - reduce memory footprint of NBTTagCompound + + byte b; + while((b = input.readByte()) != 0) { +@@ -167,7 +167,7 @@ public class CompoundTag implements Tag { } public CompoundTag() { @@ -29,7 +29,7 @@ index 64765dab6fed87ffdf4af197d8d5f28a04544db0..1d13bc15c56faa69699fb3ad39210233 } @Override -@@ -449,8 +449,16 @@ public class CompoundTag implements Tag { +@@ -486,8 +486,16 @@ public class CompoundTag implements Tag { @Override public CompoundTag copy() { diff --git a/patches/unapplied/server/0375-Prevent-opening-inventories-when-frozen.patch b/patches/server/0371-Prevent-opening-inventories-when-frozen.patch similarity index 92% rename from patches/unapplied/server/0375-Prevent-opening-inventories-when-frozen.patch rename to patches/server/0371-Prevent-opening-inventories-when-frozen.patch index ee7df0a768..c5a44bb6a8 100644 --- a/patches/unapplied/server/0375-Prevent-opening-inventories-when-frozen.patch +++ b/patches/server/0371-Prevent-opening-inventories-when-frozen.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Prevent opening inventories when frozen diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java -index c7d4341642df2fc847e139cf03992b13645afa3e..0e7f5d780d8c17a68a6d3cf98febad94f63e3f81 100644 +index 3ebcbda84de7817ff1aab5cdac6566f9eb05f2dd..06d257ac2d307cdae1c3eeba50f133814c13b181 100644 --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java -@@ -693,7 +693,7 @@ public class ServerPlayer extends Player { +@@ -652,7 +652,7 @@ public class ServerPlayer extends Player { containerUpdateDelay = this.level().paperConfig().tickRates.containerUpdate; } // Paper end @@ -17,7 +17,7 @@ index c7d4341642df2fc847e139cf03992b13645afa3e..0e7f5d780d8c17a68a6d3cf98febad94 this.closeContainer(org.bukkit.event.inventory.InventoryCloseEvent.Reason.CANT_USE); // Paper this.containerMenu = this.inventoryMenu; } -@@ -1542,7 +1542,7 @@ public class ServerPlayer extends Player { +@@ -1501,7 +1501,7 @@ public class ServerPlayer extends Player { } else { // CraftBukkit start this.containerMenu = container; @@ -27,7 +27,7 @@ index c7d4341642df2fc847e139cf03992b13645afa3e..0e7f5d780d8c17a68a6d3cf98febad94 this.initMenu(container); return OptionalInt.of(this.containerCounter); diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java -index 552fb0be2f31bd52a5ae43526d55aa29828f786e..ec7ea1ef632bea761ca8b9603059a12fb72dfa47 100644 +index aa131c233ee9d7926ca77e1afedd27baf7639423..872adf91703baa24d67f417e7a45309f92984da9 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java @@ -325,7 +325,7 @@ public class CraftHumanEntity extends CraftLivingEntity implements HumanEntity { diff --git a/patches/unapplied/server/0376-Don-t-run-entity-collision-code-if-not-needed.patch b/patches/server/0372-Don-t-run-entity-collision-code-if-not-needed.patch similarity index 92% rename from patches/unapplied/server/0376-Don-t-run-entity-collision-code-if-not-needed.patch rename to patches/server/0372-Don-t-run-entity-collision-code-if-not-needed.patch index 33afba0af3..e7a6966d5a 100644 --- a/patches/unapplied/server/0376-Don-t-run-entity-collision-code-if-not-needed.patch +++ b/patches/server/0372-Don-t-run-entity-collision-code-if-not-needed.patch @@ -12,10 +12,10 @@ The entity's current team collision rule causes them to NEVER collide. Co-authored-by: Owen1212055 <23108066+Owen1212055@users.noreply.github.com> diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java -index 11e84ea16177f11b834bcf13e9b36985ac4cfd4e..fe5995a79929fb46ae5d9d9056993a6e37b670e7 100644 +index 4008d402b01d7ea25a56d16ebbf00e182b0d60c3..d8c337ae968f04af8870591da6c89dc25b5db311 100644 --- a/src/main/java/net/minecraft/world/entity/LivingEntity.java +++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java -@@ -3370,10 +3370,24 @@ public abstract class LivingEntity extends Entity implements Attackable { +@@ -3399,10 +3399,24 @@ public abstract class LivingEntity extends Entity implements Attackable { if (this.level().isClientSide()) { this.level().getEntities(EntityTypeTest.forClass(net.minecraft.world.entity.player.Player.class), this.getBoundingBox(), EntitySelector.pushableBy(this)).forEach(this::doPush); } else { @@ -38,6 +38,6 @@ index 11e84ea16177f11b834bcf13e9b36985ac4cfd4e..fe5995a79929fb46ae5d9d9056993a6e if (!list.isEmpty()) { - int i = this.level().getGameRules().getInt(GameRules.RULE_MAX_ENTITY_CRAMMING); + // Paper - moved up - int j; if (i > 0 && list.size() > i - 1 && this.random.nextInt(4) == 0) { + int j = 0; diff --git a/patches/unapplied/server/0377-Implement-Player-Client-Options-API.patch b/patches/server/0373-Implement-Player-Client-Options-API.patch similarity index 87% rename from patches/unapplied/server/0377-Implement-Player-Client-Options-API.patch rename to patches/server/0373-Implement-Player-Client-Options-API.patch index ed8390ee7f..9d830d7721 100644 --- a/patches/unapplied/server/0377-Implement-Player-Client-Options-API.patch +++ b/patches/server/0373-Implement-Player-Client-Options-API.patch @@ -87,10 +87,10 @@ index 0000000000000000000000000000000000000000..b6f4400df3d8ec7e06a996de54f8cabb + } +} diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java -index 0e7f5d780d8c17a68a6d3cf98febad94f63e3f81..f4a8491d6b6333030cecee3920da060d6b96a309 100644 +index 06d257ac2d307cdae1c3eeba50f133814c13b181..77859358366eb51282bedf61c8b0094302548e2a 100644 --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java -@@ -1949,9 +1949,24 @@ public class ServerPlayer extends Player { +@@ -1908,7 +1908,23 @@ public class ServerPlayer extends Player { } } @@ -108,18 +108,17 @@ index 0e7f5d780d8c17a68a6d3cf98febad94f63e3f81..f4a8491d6b6333030cecee3920da060d + return map; + } + // Paper end - public String locale = null; // CraftBukkit - add, lowercase // Paper - default to null - public java.util.Locale adventure$locale = java.util.Locale.US; // Paper - public void updateOptions(ServerboundClientInformationPacket packet) { -+ new com.destroystokyo.paper.event.player.PlayerClientOptionsChangeEvent(getBukkitEntity(), getClientOptionMap(packet.language, packet.viewDistance, com.destroystokyo.paper.ClientOption.ChatVisibility.valueOf(packet.chatVisibility().name()), packet.chatColors(), new com.destroystokyo.paper.PaperSkinParts(packet.modelCustomisation()), packet.mainHand() == HumanoidArm.LEFT ? MainHand.LEFT : MainHand.RIGHT, packet.allowsListing(), packet.textFilteringEnabled())).callEvent(); // Paper - settings event ++ + public void updateOptions(ClientInformation clientOptions) { ++ new com.destroystokyo.paper.event.player.PlayerClientOptionsChangeEvent(getBukkitEntity(), getClientOptionMap(clientOptions.language(), clientOptions.viewDistance(), com.destroystokyo.paper.ClientOption.ChatVisibility.valueOf(clientOptions.chatVisibility().name()), clientOptions.chatColors(), new com.destroystokyo.paper.PaperSkinParts(clientOptions.modelCustomisation()), clientOptions.mainHand() == HumanoidArm.LEFT ? MainHand.LEFT : MainHand.RIGHT, clientOptions.allowsListing(), clientOptions.textFilteringEnabled())).callEvent(); // Paper - settings event // CraftBukkit start - if (getMainArm() != packet.mainHand()) { + if (getMainArm() != clientOptions.mainHand()) { PlayerChangedMainHandEvent event = new PlayerChangedMainHandEvent(this.getBukkitEntity(), getMainArm() == HumanoidArm.LEFT ? MainHand.LEFT : MainHand.RIGHT); diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -index 08404472a89192fb0cbae0192793c4c4ae63a9bb..cb9482240de0d5d56be4ec591b4fbb23006767c1 100644 +index 1fecbdbc382a47aa76bd562fb3cc0625b7807bfc..e28872e0f86a0106e4ea4e06d1ea8e41128de5c7 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -@@ -602,6 +602,28 @@ public class CraftPlayer extends CraftHumanEntity implements Player { +@@ -562,6 +562,28 @@ public class CraftPlayer extends CraftHumanEntity implements Player { connection.disconnect(message == null ? net.kyori.adventure.text.Component.empty() : message); } } diff --git a/patches/unapplied/server/0378-Don-t-crash-if-player-is-attempted-to-be-removed-fro.patch b/patches/server/0374-Don-t-crash-if-player-is-attempted-to-be-removed-fro.patch similarity index 81% rename from patches/unapplied/server/0378-Don-t-crash-if-player-is-attempted-to-be-removed-fro.patch rename to patches/server/0374-Don-t-crash-if-player-is-attempted-to-be-removed-fro.patch index 1ab6988612..9b3e447197 100644 --- a/patches/unapplied/server/0378-Don-t-crash-if-player-is-attempted-to-be-removed-fro.patch +++ b/patches/server/0374-Don-t-crash-if-player-is-attempted-to-be-removed-fro.patch @@ -7,10 +7,10 @@ Subject: [PATCH] Don't crash if player is attempted to be removed from I suspect it deals with teleporting as it uses players current x/y/z diff --git a/src/main/java/net/minecraft/server/level/DistanceManager.java b/src/main/java/net/minecraft/server/level/DistanceManager.java -index c716047fefb51a77ce18df243c517d80c78b6853..0a926afa06a5e37cf2650afa1b5099a2a9ffa659 100644 +index f3c9a3dbb6f0e6f825b7477c89ed72ed52845419..2dbea6eef75ee90d62145ed855935bbc9996f15a 100644 --- a/src/main/java/net/minecraft/server/level/DistanceManager.java +++ b/src/main/java/net/minecraft/server/level/DistanceManager.java -@@ -147,8 +147,8 @@ public abstract class DistanceManager { +@@ -285,8 +285,8 @@ public abstract class DistanceManager { ObjectSet objectset = (ObjectSet) this.playersPerChunk.get(i); if (objectset == null) return; // CraftBukkit - SPIGOT-6208 @@ -20,4 +20,4 @@ index c716047fefb51a77ce18df243c517d80c78b6853..0a926afa06a5e37cf2650afa1b5099a2 + if (objectset == null || objectset.isEmpty()) { // Paper this.playersPerChunk.remove(i); this.naturalSpawnChunkCounter.update(i, Integer.MAX_VALUE, false); - //this.playerTicketManager.update(i, Integer.MAX_VALUE, false); // Paper - no longer used + this.playerTicketManager.update(i, Integer.MAX_VALUE, false); diff --git a/patches/unapplied/server/0379-Fix-Longstanding-Broken-behavior-of-PlayerJoinEvent.patch b/patches/server/0375-Fix-Longstanding-Broken-behavior-of-PlayerJoinEvent.patch similarity index 88% rename from patches/unapplied/server/0379-Fix-Longstanding-Broken-behavior-of-PlayerJoinEvent.patch rename to patches/server/0375-Fix-Longstanding-Broken-behavior-of-PlayerJoinEvent.patch index a1a7e8b6ca..58cd9de102 100644 --- a/patches/unapplied/server/0379-Fix-Longstanding-Broken-behavior-of-PlayerJoinEvent.patch +++ b/patches/server/0375-Fix-Longstanding-Broken-behavior-of-PlayerJoinEvent.patch @@ -31,10 +31,10 @@ delays anymore. public net.minecraft.server.level.ChunkMap addEntity(Lnet/minecraft/world/entity/Entity;)V diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java -index a8c4c7298e127e5b60a3b43ad168976d29901bc5..48586780da5d260894fe59efaa97cb1facfe73fe 100644 +index b652019a5feffeeec2871011e2df0d609e1a7647..9cdebd7715fca949cc390684d044235d75b89c24 100644 --- a/src/main/java/net/minecraft/server/level/ChunkMap.java +++ b/src/main/java/net/minecraft/server/level/ChunkMap.java -@@ -1037,6 +1037,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -1556,6 +1556,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider + ": " + entity + (this.entityMap.containsKey(entity.getId()) ? " ALREADY CONTAINED (This would have crashed your server)" : ""), new Throwable()); return; } @@ -43,22 +43,22 @@ index a8c4c7298e127e5b60a3b43ad168976d29901bc5..48586780da5d260894fe59efaa97cb1f if (!(entity instanceof EnderDragonPart)) { EntityType entitytypes = entity.getType(); diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java -index f4a8491d6b6333030cecee3920da060d6b96a309..15a70bad66eb2508f58ff184061c2d19e45297e1 100644 +index 77859358366eb51282bedf61c8b0094302548e2a..fcf875c6145c2428cab7a801442f34adc098b3ce 100644 --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java -@@ -267,6 +267,7 @@ public class ServerPlayer extends Player { +@@ -265,6 +265,7 @@ public class ServerPlayer extends Player { public double maxHealthCache; public boolean joining = true; public boolean sentListPacket = false; + public boolean supressTrackerForLogin = false; // Paper - public Integer clientViewDistance; public String kickLeaveMessage = null; // SPIGOT-3034: Forward leave message to PlayerQuitEvent // CraftBukkit end + public boolean isRealPlayer; // Paper diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java -index 0d100788312a234616c1401656f09835458e79f6..97199ae30edfaaacb9ea9d29846ee131395815e6 100644 +index d1e5db7b0b260002198b1262f914d3c5a30cd2d9..fdd518b5ea21ae617069fd03429712de4b44841b 100644 --- a/src/main/java/net/minecraft/server/players/PlayerList.java +++ b/src/main/java/net/minecraft/server/players/PlayerList.java -@@ -311,6 +311,12 @@ public abstract class PlayerList { +@@ -297,6 +297,12 @@ public abstract class PlayerList { this.playersByUUID.put(player.getUUID(), player); // this.broadcastAll(ClientboundPlayerInfoUpdatePacket.createPlayerInitializing(List.of(entityplayer))); // CraftBukkit - replaced with loop below @@ -71,7 +71,7 @@ index 0d100788312a234616c1401656f09835458e79f6..97199ae30edfaaacb9ea9d29846ee131 // CraftBukkit start CraftPlayer bukkitPlayer = player.getBukkitEntity(); -@@ -349,6 +355,8 @@ public abstract class PlayerList { +@@ -335,6 +341,8 @@ public abstract class PlayerList { player.connection.send(ClientboundPlayerInfoUpdatePacket.createPlayerInitializing(List.of(entityplayer1))); } player.sentListPacket = true; @@ -80,7 +80,7 @@ index 0d100788312a234616c1401656f09835458e79f6..97199ae30edfaaacb9ea9d29846ee131 // CraftBukkit end player.getEntityData().refresh(player); // CraftBukkit - BungeeCord#2321, send complete data to self on spawn -@@ -374,6 +382,11 @@ public abstract class PlayerList { +@@ -357,6 +365,11 @@ public abstract class PlayerList { playerconnection.send(new ClientboundUpdateMobEffectPacket(player.getId(), mobeffect)); } @@ -92,7 +92,7 @@ index 0d100788312a234616c1401656f09835458e79f6..97199ae30edfaaacb9ea9d29846ee131 if (nbttagcompound != null && nbttagcompound.contains("RootVehicle", 10)) { CompoundTag nbttagcompound1 = nbttagcompound.getCompound("RootVehicle"); // CraftBukkit start -@@ -422,6 +435,10 @@ public abstract class PlayerList { +@@ -405,6 +418,10 @@ public abstract class PlayerList { } } @@ -103,7 +103,7 @@ index 0d100788312a234616c1401656f09835458e79f6..97199ae30edfaaacb9ea9d29846ee131 player.initInventoryMenu(); // CraftBukkit - Moved from above, added world // Paper start - Add to collideRule team if needed -@@ -431,6 +448,7 @@ public abstract class PlayerList { +@@ -414,6 +431,7 @@ public abstract class PlayerList { scoreboard.addPlayerToTeam(player.getScoreboardName(), collideRuleTeam); } // Paper end diff --git a/patches/unapplied/server/0380-Move-player-to-spawn-point-if-spawn-in-unloaded-worl.patch b/patches/server/0376-Move-player-to-spawn-point-if-spawn-in-unloaded-worl.patch similarity index 89% rename from patches/unapplied/server/0380-Move-player-to-spawn-point-if-spawn-in-unloaded-worl.patch rename to patches/server/0376-Move-player-to-spawn-point-if-spawn-in-unloaded-worl.patch index a84c2ff4bb..df38135262 100644 --- a/patches/unapplied/server/0380-Move-player-to-spawn-point-if-spawn-in-unloaded-worl.patch +++ b/patches/server/0376-Move-player-to-spawn-point-if-spawn-in-unloaded-worl.patch @@ -7,10 +7,10 @@ The code following this has better support for null worlds to move them back to the world spawn. diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java -index 70d1d664efa323cbb0c07fd5aa746122261b6bfa..d7cf9ca3a1002463b09ed709f3003d0528a3ff0b 100644 +index 961213739ba810c6e39aca76a32d74bcf2a58ad3..d8f8ca63079eed7d97488f954d989e99ec4c054e 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java -@@ -2319,9 +2319,11 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource { +@@ -2275,9 +2275,11 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource { bworld = server.getWorld(worldName); } diff --git a/patches/unapplied/server/0381-Add-PlayerAttackEntityCooldownResetEvent.patch b/patches/server/0377-Add-PlayerAttackEntityCooldownResetEvent.patch similarity index 92% rename from patches/unapplied/server/0381-Add-PlayerAttackEntityCooldownResetEvent.patch rename to patches/server/0377-Add-PlayerAttackEntityCooldownResetEvent.patch index 93cc5b8fc2..8f1dce9ab1 100644 --- a/patches/unapplied/server/0381-Add-PlayerAttackEntityCooldownResetEvent.patch +++ b/patches/server/0377-Add-PlayerAttackEntityCooldownResetEvent.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Add PlayerAttackEntityCooldownResetEvent diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java -index fe5995a79929fb46ae5d9d9056993a6e37b670e7..1cae4bcd7d5d310ead65342af063a4617d24c694 100644 +index d8c337ae968f04af8870591da6c89dc25b5db311..29c5372f48211e86fa8cfbdea9e10025a4f310d1 100644 --- a/src/main/java/net/minecraft/world/entity/LivingEntity.java +++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java -@@ -2162,7 +2162,16 @@ public abstract class LivingEntity extends Entity implements Attackable { +@@ -2196,7 +2196,16 @@ public abstract class LivingEntity extends Entity implements Attackable { EntityDamageEvent event = CraftEventFactory.handleLivingEntityDamageEvent(this, damagesource, originalDamage, hardHatModifier, blockingModifier, armorModifier, resistanceModifier, magicModifier, absorptionModifier, hardHat, blocking, armor, resistance, magic, absorption); if (damagesource.getEntity() instanceof net.minecraft.world.entity.player.Player) { diff --git a/patches/unapplied/server/0382-Don-t-fire-BlockFade-on-worldgen-threads.patch b/patches/server/0378-Don-t-fire-BlockFade-on-worldgen-threads.patch similarity index 100% rename from patches/unapplied/server/0382-Don-t-fire-BlockFade-on-worldgen-threads.patch rename to patches/server/0378-Don-t-fire-BlockFade-on-worldgen-threads.patch diff --git a/patches/unapplied/server/0383-Add-phantom-creative-and-insomniac-controls.patch b/patches/server/0379-Add-phantom-creative-and-insomniac-controls.patch similarity index 95% rename from patches/unapplied/server/0383-Add-phantom-creative-and-insomniac-controls.patch rename to patches/server/0379-Add-phantom-creative-and-insomniac-controls.patch index a305607379..ae5ef43e67 100644 --- a/patches/unapplied/server/0383-Add-phantom-creative-and-insomniac-controls.patch +++ b/patches/server/0379-Add-phantom-creative-and-insomniac-controls.patch @@ -17,10 +17,10 @@ index 668a7c3f36cdbe48e472cb810b27ae4ab39a65d6..d15e62da0307728a7c2be191a27f87da private EntitySelector() {} // Paper start diff --git a/src/main/java/net/minecraft/world/entity/monster/Phantom.java b/src/main/java/net/minecraft/world/entity/monster/Phantom.java -index 9bd6e71ea38bf050832f0f7bbed4a5db6ddcef71..ab639cb2faaafaeb33be91bfe99ffad6d23088db 100644 +index 658393f451e46a93c5665fe3c580aa395ace68d1..a40852acf5d175cc3a06bc17fb021c76f0c11a28 100644 --- a/src/main/java/net/minecraft/world/entity/monster/Phantom.java +++ b/src/main/java/net/minecraft/world/entity/monster/Phantom.java -@@ -563,6 +563,7 @@ public class Phantom extends FlyingMob implements Enemy { +@@ -568,6 +568,7 @@ public class Phantom extends FlyingMob implements Enemy { Player entityhuman = (Player) iterator.next(); if (Phantom.this.canAttack(entityhuman, TargetingConditions.DEFAULT)) { diff --git a/patches/unapplied/server/0384-Fix-numerous-item-duplication-issues-and-teleport-is.patch b/patches/server/0380-Fix-numerous-item-duplication-issues-and-teleport-is.patch similarity index 89% rename from patches/unapplied/server/0384-Fix-numerous-item-duplication-issues-and-teleport-is.patch rename to patches/server/0380-Fix-numerous-item-duplication-issues-and-teleport-is.patch index f3afba5644..24a34f27d2 100644 --- a/patches/unapplied/server/0384-Fix-numerous-item-duplication-issues-and-teleport-is.patch +++ b/patches/server/0380-Fix-numerous-item-duplication-issues-and-teleport-is.patch @@ -16,10 +16,10 @@ So even if something NEW comes up, it would be impossible to drop the same item twice because the source was destroyed. diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java -index d7cf9ca3a1002463b09ed709f3003d0528a3ff0b..ce4b2ec2ad6138b754ced976521d1c73eb4193a8 100644 +index d8f8ca63079eed7d97488f954d989e99ec4c054e..f57d9a298a6e3be63c37ed7e14c99b154d372709 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java -@@ -2449,11 +2449,12 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource { +@@ -2405,11 +2405,12 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource { } else { // CraftBukkit start - Capture drops for death event if (this instanceof net.minecraft.world.entity.LivingEntity && !((net.minecraft.world.entity.LivingEntity) this).forceDrops) { @@ -34,9 +34,9 @@ index d7cf9ca3a1002463b09ed709f3003d0528a3ff0b..ce4b2ec2ad6138b754ced976521d1c73 entityitem.setDefaultPickUpDelay(); // CraftBukkit start -@@ -3227,6 +3228,12 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource { +@@ -3211,6 +3212,12 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource { @Nullable - public Entity teleportTo(ServerLevel worldserver, PositionImpl location) { + public Entity teleportTo(ServerLevel worldserver, Vec3 location) { // CraftBukkit end + // Paper start - fix bad state entities causing dupes + if (!this.isAlive() || !this.valid) { @@ -47,7 +47,7 @@ index d7cf9ca3a1002463b09ed709f3003d0528a3ff0b..ce4b2ec2ad6138b754ced976521d1c73 if (this.level() instanceof ServerLevel && !this.isRemoved()) { this.level().getProfiler().push("changeDimension"); // CraftBukkit start -@@ -3253,6 +3260,11 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource { +@@ -3237,6 +3244,11 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource { // CraftBukkit end this.level().getProfiler().popPush("reloading"); @@ -59,7 +59,7 @@ index d7cf9ca3a1002463b09ed709f3003d0528a3ff0b..ce4b2ec2ad6138b754ced976521d1c73 Entity entity = this.getType().create(worldserver); if (entity != null) { -@@ -3266,10 +3278,6 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource { +@@ -3250,10 +3262,6 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource { // CraftBukkit start - Forward the CraftEntity to the new entity this.getBukkitEntity().setHandle(entity); entity.bukkitEntity = this.getBukkitEntity(); @@ -70,7 +70,7 @@ index d7cf9ca3a1002463b09ed709f3003d0528a3ff0b..ce4b2ec2ad6138b754ced976521d1c73 // CraftBukkit end } -@@ -3390,7 +3398,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource { +@@ -3374,7 +3382,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource { } public boolean canChangeDimensions() { @@ -80,10 +80,10 @@ index d7cf9ca3a1002463b09ed709f3003d0528a3ff0b..ce4b2ec2ad6138b754ced976521d1c73 public float getBlockExplosionResistance(Explosion explosion, BlockGetter world, BlockPos pos, BlockState blockState, FluidState fluidState, float max) { diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java -index 1cae4bcd7d5d310ead65342af063a4617d24c694..3ec6243f831330a8096e209a00e0164dea2ef9d0 100644 +index 29c5372f48211e86fa8cfbdea9e10025a4f310d1..a8f51cb5be994783eca8ff13eb172fd651deb05e 100644 --- a/src/main/java/net/minecraft/world/entity/LivingEntity.java +++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java -@@ -1678,9 +1678,9 @@ public abstract class LivingEntity extends Entity implements Attackable { +@@ -1711,9 +1711,9 @@ public abstract class LivingEntity extends Entity implements Attackable { // Paper start org.bukkit.event.entity.EntityDeathEvent deathEvent = this.dropAllDeathLoot(damageSource); if (deathEvent == null || !deathEvent.isCancelled()) { @@ -96,7 +96,7 @@ index 1cae4bcd7d5d310ead65342af063a4617d24c694..3ec6243f831330a8096e209a00e0164d // Paper start - clear equipment if event is not cancelled if (this instanceof Mob) { for (EquipmentSlot slot : this.clearedEquipmentSlots) { -@@ -1781,8 +1781,13 @@ public abstract class LivingEntity extends Entity implements Attackable { +@@ -1814,8 +1814,13 @@ public abstract class LivingEntity extends Entity implements Attackable { this.dropCustomDeathLoot(source, i, flag); this.clearEquipmentSlots = prev; // Paper } @@ -113,10 +113,10 @@ index 1cae4bcd7d5d310ead65342af063a4617d24c694..3ec6243f831330a8096e209a00e0164d this.drops = new ArrayList<>(); // CraftBukkit end diff --git a/src/main/java/net/minecraft/world/entity/decoration/ArmorStand.java b/src/main/java/net/minecraft/world/entity/decoration/ArmorStand.java -index a35a0952ce8e1fc42e92734786d531c7e10b34d7..498c6664fcfb028111031691348bfa2eb21d605b 100644 +index 7eecbe85949e47b367014c04d7a37c2cbea80168..3d2d638da2d4b9c00f98477320b3300f36cff119 100644 --- a/src/main/java/net/minecraft/world/entity/decoration/ArmorStand.java +++ b/src/main/java/net/minecraft/world/entity/decoration/ArmorStand.java -@@ -624,7 +624,7 @@ public class ArmorStand extends LivingEntity { +@@ -637,7 +637,7 @@ public class ArmorStand extends LivingEntity { for (i = 0; i < this.handItems.size(); ++i) { itemstack = (ItemStack) this.handItems.get(i); if (!itemstack.isEmpty()) { @@ -125,7 +125,7 @@ index a35a0952ce8e1fc42e92734786d531c7e10b34d7..498c6664fcfb028111031691348bfa2e this.handItems.set(i, ItemStack.EMPTY); } } -@@ -632,7 +632,7 @@ public class ArmorStand extends LivingEntity { +@@ -645,7 +645,7 @@ public class ArmorStand extends LivingEntity { for (i = 0; i < this.armorItems.size(); ++i) { itemstack = (ItemStack) this.armorItems.get(i); if (!itemstack.isEmpty()) { @@ -135,10 +135,10 @@ index a35a0952ce8e1fc42e92734786d531c7e10b34d7..498c6664fcfb028111031691348bfa2e } } diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java -index ee7a7b80f96712830ea92daefb4454df70def170..81c77354a856956283fc149980a9a09e99b544f5 100644 +index ceca2bccb4c36713cf15fb1d7cab0cbd3f31aff5..0b45481cdbbfbe4e1756e19e696e1c11d8fccd00 100644 --- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java +++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java -@@ -866,6 +866,11 @@ public class CraftEventFactory { +@@ -868,6 +868,11 @@ public class CraftEventFactory { } public static EntityDeathEvent callEntityDeathEvent(net.minecraft.world.entity.LivingEntity victim, List drops) { @@ -150,7 +150,7 @@ index ee7a7b80f96712830ea92daefb4454df70def170..81c77354a856956283fc149980a9a09e CraftLivingEntity entity = (CraftLivingEntity) victim.getBukkitEntity(); EntityDeathEvent event = new EntityDeathEvent(entity, drops, victim.getExpReward()); populateFields(victim, event); // Paper - make cancellable -@@ -879,11 +884,13 @@ public class CraftEventFactory { +@@ -881,11 +886,13 @@ public class CraftEventFactory { playDeathSound(victim, event); // Paper end victim.expToDrop = event.getDroppedExp();