From 44e22b45a51c6f071e03a32cdbbde042b184eeaa Mon Sep 17 00:00:00 2001 From: Jake Potrebic Date: Wed, 7 Jun 2023 15:41:25 -0700 Subject: [PATCH] more patches --- ...pawn-settings-and-per-player-option.patch} | 2 +- ...nections-shouldn-t-hold-up-shutdown.patch} | 2 +- ...ow-bees-to-load-chunks-for-beehives.patch} | 26 ++++----- ...PlayerChunkMap-adds-crashing-server.patch} | 10 ++-- .../0357-Don-t-tick-dead-players.patch} | 4 +- ...-Player-s-shouldn-t-be-able-to-move.patch} | 4 +- ...timize-Collision-to-not-load-chunks.patch} | 14 ++--- ...ove-existing-players-to-world-spawn.patch} | 14 ++--- ...alSelector-Goal.Flag-Set-operations.patch} | 0 .../0362-Improved-Watchdog-Support.patch} | 58 +++++++++---------- .../0363-Optimize-Pathfinding.patch} | 2 +- ...4-Reduce-Either-Optional-allocation.patch} | 0 ...-memory-footprint-of-NBTTagCompound.patch} | 0 ...ent-opening-inventories-when-frozen.patch} | 16 ++--- ...entity-collision-code-if-not-needed.patch} | 16 ++--- ...Implement-Player-Client-Options-API.patch} | 8 +-- ...ayer-is-attempted-to-be-removed-fro.patch} | 6 +- ...-Broken-behavior-of-PlayerJoinEvent.patch} | 18 +++--- ...awn-point-if-spawn-in-unloaded-worl.patch} | 4 +- ...layerAttackEntityCooldownResetEvent.patch} | 4 +- ...-fire-BlockFade-on-worldgen-threads.patch} | 2 +- ...tom-creative-and-insomniac-controls.patch} | 16 ++--- ...-duplication-issues-and-teleport-is.patch} | 38 ++++++------ 23 files changed, 132 insertions(+), 132 deletions(-) rename patches/{unapplied/server/0366-Pillager-patrol-spawn-settings-and-per-player-option.patch => server/0353-Pillager-patrol-spawn-settings-and-per-player-option.patch} (98%) rename patches/{unapplied/server/0367-Remote-Connections-shouldn-t-hold-up-shutdown.patch => server/0354-Remote-Connections-shouldn-t-hold-up-shutdown.patch} (92%) rename patches/{unapplied/server/0368-Do-not-allow-bees-to-load-chunks-for-beehives.patch => server/0355-Do-not-allow-bees-to-load-chunks-for-beehives.patch} (56%) rename patches/{unapplied/server/0369-Prevent-Double-PlayerChunkMap-adds-crashing-server.patch => server/0356-Prevent-Double-PlayerChunkMap-adds-crashing-server.patch} (87%) rename patches/{unapplied/server/0370-Don-t-tick-dead-players.patch => server/0357-Don-t-tick-dead-players.patch} (85%) rename patches/{unapplied/server/0371-Dead-Player-s-shouldn-t-be-able-to-move.patch => server/0358-Dead-Player-s-shouldn-t-be-able-to-move.patch} (84%) rename patches/{unapplied/server/0372-Optimize-Collision-to-not-load-chunks.patch => server/0359-Optimize-Collision-to-not-load-chunks.patch} (91%) rename patches/{unapplied/server/0373-Don-t-move-existing-players-to-world-spawn.patch => server/0360-Don-t-move-existing-players-to-world-spawn.patch} (83%) rename patches/{unapplied/server/0374-Optimize-GoalSelector-Goal.Flag-Set-operations.patch => server/0361-Optimize-GoalSelector-Goal.Flag-Set-operations.patch} (100%) rename patches/{unapplied/server/0375-Improved-Watchdog-Support.patch => server/0362-Improved-Watchdog-Support.patch} (92%) rename patches/{unapplied/server/0376-Optimize-Pathfinding.patch => server/0363-Optimize-Pathfinding.patch} (94%) rename patches/{unapplied/server/0377-Reduce-Either-Optional-allocation.patch => server/0364-Reduce-Either-Optional-allocation.patch} (100%) rename patches/{unapplied/server/0378-Reduce-memory-footprint-of-NBTTagCompound.patch => server/0365-Reduce-memory-footprint-of-NBTTagCompound.patch} (100%) rename patches/{unapplied/server/0379-Prevent-opening-inventories-when-frozen.patch => server/0366-Prevent-opening-inventories-when-frozen.patch} (79%) rename patches/{unapplied/server/0380-Don-t-run-entity-collision-code-if-not-needed.patch => server/0367-Don-t-run-entity-collision-code-if-not-needed.patch} (66%) rename patches/{unapplied/server/0381-Implement-Player-Client-Options-API.patch => server/0368-Implement-Player-Client-Options-API.patch} (96%) rename patches/{unapplied/server/0382-Don-t-crash-if-player-is-attempted-to-be-removed-fro.patch => server/0369-Don-t-crash-if-player-is-attempted-to-be-removed-fro.patch} (81%) rename patches/{unapplied/server/0383-Fix-Longstanding-Broken-behavior-of-PlayerJoinEvent.patch => server/0370-Fix-Longstanding-Broken-behavior-of-PlayerJoinEvent.patch} (89%) rename patches/{unapplied/server/0384-Move-player-to-spawn-point-if-spawn-in-unloaded-worl.patch => server/0371-Move-player-to-spawn-point-if-spawn-in-unloaded-worl.patch} (89%) rename patches/{unapplied/server/0385-Add-PlayerAttackEntityCooldownResetEvent.patch => server/0372-Add-PlayerAttackEntityCooldownResetEvent.patch} (92%) rename patches/{unapplied/server/0386-Don-t-fire-BlockFade-on-worldgen-threads.patch => server/0373-Don-t-fire-BlockFade-on-worldgen-threads.patch} (94%) rename patches/{unapplied/server/0387-Add-phantom-creative-and-insomniac-controls.patch => server/0374-Add-phantom-creative-and-insomniac-controls.patch} (76%) rename patches/{unapplied/server/0388-Fix-numerous-item-duplication-issues-and-teleport-is.patch => server/0375-Fix-numerous-item-duplication-issues-and-teleport-is.patch} (85%) diff --git a/patches/unapplied/server/0366-Pillager-patrol-spawn-settings-and-per-player-option.patch b/patches/server/0353-Pillager-patrol-spawn-settings-and-per-player-option.patch similarity index 98% rename from patches/unapplied/server/0366-Pillager-patrol-spawn-settings-and-per-player-option.patch rename to patches/server/0353-Pillager-patrol-spawn-settings-and-per-player-option.patch index 8499fba689..351352250f 100644 --- a/patches/unapplied/server/0366-Pillager-patrol-spawn-settings-and-per-player-option.patch +++ b/patches/server/0353-Pillager-patrol-spawn-settings-and-per-player-option.patch @@ -10,7 +10,7 @@ When not per player it will use the Vanilla mechanic of one delay per world and the world age for the start day. diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java -index b014f1bd167bad3e1dc613dce5c929f201ef27cc..421be41fc09d53b50c08e74f9c32a198e90a2c7c 100644 +index 50a6f7f6ff5b24053d8f6eba06b0e1e5541be685..30134138a476716b9dfb82fe0f8b698e1a5ea3a6 100644 --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java @@ -244,6 +244,7 @@ public class ServerPlayer extends Player { diff --git a/patches/unapplied/server/0367-Remote-Connections-shouldn-t-hold-up-shutdown.patch b/patches/server/0354-Remote-Connections-shouldn-t-hold-up-shutdown.patch similarity index 92% rename from patches/unapplied/server/0367-Remote-Connections-shouldn-t-hold-up-shutdown.patch rename to patches/server/0354-Remote-Connections-shouldn-t-hold-up-shutdown.patch index d5876d02e0..35a46a7c93 100644 --- a/patches/unapplied/server/0367-Remote-Connections-shouldn-t-hold-up-shutdown.patch +++ b/patches/server/0354-Remote-Connections-shouldn-t-hold-up-shutdown.patch @@ -6,7 +6,7 @@ Subject: [PATCH] Remote Connections shouldn't hold up shutdown Bugs in the connection logic appears to leave stale connections even, preventing shutdown diff --git a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java -index 338841804a92bea5ca074300eaea9374d1b77020..f22c50f0a2ef05e9f52550db7c40b5b99632650c 100644 +index d05bed7b96c1d833041a31c00161ee377c088ee1..fd9a89b94c628cd2cdfd069bb5d99aeb5d75eb5c 100644 --- a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java +++ b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java @@ -391,11 +391,11 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface diff --git a/patches/unapplied/server/0368-Do-not-allow-bees-to-load-chunks-for-beehives.patch b/patches/server/0355-Do-not-allow-bees-to-load-chunks-for-beehives.patch similarity index 56% rename from patches/unapplied/server/0368-Do-not-allow-bees-to-load-chunks-for-beehives.patch rename to patches/server/0355-Do-not-allow-bees-to-load-chunks-for-beehives.patch index 807d61a122..978542bf9f 100644 --- a/patches/unapplied/server/0368-Do-not-allow-bees-to-load-chunks-for-beehives.patch +++ b/patches/server/0355-Do-not-allow-bees-to-load-chunks-for-beehives.patch @@ -5,38 +5,38 @@ Subject: [PATCH] Do not allow bees to load chunks for beehives diff --git a/src/main/java/net/minecraft/world/entity/animal/Bee.java b/src/main/java/net/minecraft/world/entity/animal/Bee.java -index 5049d72f080bb82ca0e1fc5e2348b3605a0204f1..2a6dda97fcc761eb3e7109e032d3bb10c83908d7 100644 +index 8feb4192eac41a27e683ad391503a1480c7516de..2824792295dab6e52015b479a77c61efb1150041 100644 --- a/src/main/java/net/minecraft/world/entity/animal/Bee.java +++ b/src/main/java/net/minecraft/world/entity/animal/Bee.java -@@ -409,6 +409,7 @@ public class Bee extends Animal implements NeutralMob, FlyingAnimal { +@@ -408,6 +408,7 @@ public class Bee extends Animal implements NeutralMob, FlyingAnimal { if (this.hivePos == null) { return false; } else { -+ if (!this.level.isLoadedAndInBounds(hivePos)) return false; // Paper - BlockEntity tileentity = this.level.getBlockEntity(this.hivePos); ++ if (!this.level().isLoadedAndInBounds(this.hivePos)) return false; // Paper + BlockEntity tileentity = this.level().getBlockEntity(this.hivePos); return tileentity instanceof BeehiveBlockEntity && ((BeehiveBlockEntity) tileentity).isFireNearby(); -@@ -442,6 +443,7 @@ public class Bee extends Animal implements NeutralMob, FlyingAnimal { +@@ -441,6 +442,7 @@ public class Bee extends Animal implements NeutralMob, FlyingAnimal { } private boolean doesHiveHaveSpace(BlockPos pos) { -+ if (!this.level.isLoadedAndInBounds(pos)) return false; // Paper - BlockEntity tileentity = this.level.getBlockEntity(pos); ++ if (!this.level().isLoadedAndInBounds(pos)) return false; // Paper + BlockEntity tileentity = this.level().getBlockEntity(pos); return tileentity instanceof BeehiveBlockEntity ? !((BeehiveBlockEntity) tileentity).isFull() : false; -@@ -919,6 +921,7 @@ public class Bee extends Animal implements NeutralMob, FlyingAnimal { +@@ -918,6 +920,7 @@ public class Bee extends Animal implements NeutralMob, FlyingAnimal { @Override public boolean canBeeUse() { if (Bee.this.hasHive() && Bee.this.wantsToEnterHive() && Bee.this.hivePos.closerToCenterThan(Bee.this.position(), 2.0D)) { -+ if (!Bee.this.level.isLoadedAndInBounds(Bee.this.hivePos)) return false; // Paper - BlockEntity tileentity = Bee.this.level.getBlockEntity(Bee.this.hivePos); ++ if (!Bee.this.level().isLoadedAndInBounds(Bee.this.hivePos)) return false; // Paper + BlockEntity tileentity = Bee.this.level().getBlockEntity(Bee.this.hivePos); if (tileentity instanceof BeehiveBlockEntity) { -@@ -942,6 +945,7 @@ public class Bee extends Animal implements NeutralMob, FlyingAnimal { +@@ -941,6 +944,7 @@ public class Bee extends Animal implements NeutralMob, FlyingAnimal { @Override public void start() { -+ if (!Bee.this.level.isLoadedAndInBounds(Bee.this.hivePos)) return; // Paper - BlockEntity tileentity = Bee.this.level.getBlockEntity(Bee.this.hivePos); ++ if (!Bee.this.level().isLoadedAndInBounds(Bee.this.hivePos)) return; // Paper + BlockEntity tileentity = Bee.this.level().getBlockEntity(Bee.this.hivePos); if (tileentity instanceof BeehiveBlockEntity) { diff --git a/patches/unapplied/server/0369-Prevent-Double-PlayerChunkMap-adds-crashing-server.patch b/patches/server/0356-Prevent-Double-PlayerChunkMap-adds-crashing-server.patch similarity index 87% rename from patches/unapplied/server/0369-Prevent-Double-PlayerChunkMap-adds-crashing-server.patch rename to patches/server/0356-Prevent-Double-PlayerChunkMap-adds-crashing-server.patch index e5966b67e5..b8afe02d22 100644 --- a/patches/unapplied/server/0369-Prevent-Double-PlayerChunkMap-adds-crashing-server.patch +++ b/patches/server/0356-Prevent-Double-PlayerChunkMap-adds-crashing-server.patch @@ -7,10 +7,10 @@ Suspected case would be around the technique used in .stopRiding Stack will identify any causer of this and warn instead of crashing. diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java -index 1c39d12a6e72954a24ad51d8d6346341dc1c5d22..9c5925bc6a0fb277970d46c34dd812cc765a537a 100644 +index 3ab66eb22561971392616c083bae5339e6ddc493..f27e9dd8185892b3948814937380140c45d7fd33 100644 --- a/src/main/java/net/minecraft/server/level/ChunkMap.java +++ b/src/main/java/net/minecraft/server/level/ChunkMap.java -@@ -1033,6 +1033,13 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -1565,6 +1565,13 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider public void addEntity(Entity entity) { org.spigotmc.AsyncCatcher.catchOp("entity track"); // Spigot @@ -25,10 +25,10 @@ index 1c39d12a6e72954a24ad51d8d6346341dc1c5d22..9c5925bc6a0fb277970d46c34dd812cc EntityType entitytypes = entity.getType(); int i = entitytypes.clientTrackingRange() * 16; diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java -index 67e59ac94c584a742bf5e6e2094459234603ef06..4bf38f9006be9e838c54783dafd40cf84553d627 100644 +index 203dc7444a2e6b0cfcaf0532e50ae0b22e51210e..a25d46fc3e2a106ab94c6b2b49558dd7be11c5b9 100644 --- a/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java -@@ -2324,7 +2324,7 @@ public class ServerLevel extends Level implements WorldGenLevel { +@@ -2226,7 +2226,7 @@ public class ServerLevel extends Level implements WorldGenLevel { public void onTrackingStart(Entity entity) { org.spigotmc.AsyncCatcher.catchOp("entity register"); // Spigot @@ -37,7 +37,7 @@ index 67e59ac94c584a742bf5e6e2094459234603ef06..4bf38f9006be9e838c54783dafd40cf8 if (entity instanceof ServerPlayer) { ServerPlayer entityplayer = (ServerPlayer) entity; -@@ -2358,6 +2358,7 @@ public class ServerLevel extends Level implements WorldGenLevel { +@@ -2260,6 +2260,7 @@ public class ServerLevel extends Level implements WorldGenLevel { entity.updateDynamicGameEventListener(DynamicGameEventListener::add); entity.valid = true; // CraftBukkit diff --git a/patches/unapplied/server/0370-Don-t-tick-dead-players.patch b/patches/server/0357-Don-t-tick-dead-players.patch similarity index 85% rename from patches/unapplied/server/0370-Don-t-tick-dead-players.patch rename to patches/server/0357-Don-t-tick-dead-players.patch index 4a700e795a..f4b1437ff8 100644 --- a/patches/unapplied/server/0370-Don-t-tick-dead-players.patch +++ b/patches/server/0357-Don-t-tick-dead-players.patch @@ -7,10 +7,10 @@ Causes sync chunk loads and who knows what all else. This is safe because Spectators are skipped in unloaded chunks too in vanilla. diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java -index 421be41fc09d53b50c08e74f9c32a198e90a2c7c..e6945abd9337af07625793fb893718b00e67168a 100644 +index 30134138a476716b9dfb82fe0f8b698e1a5ea3a6..b5ce9a93089ea64286bd33cf3fd6eab60863c66d 100644 --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java -@@ -683,7 +683,7 @@ public class ServerPlayer extends Player { +@@ -682,7 +682,7 @@ public class ServerPlayer extends Player { public void doTick() { try { diff --git a/patches/unapplied/server/0371-Dead-Player-s-shouldn-t-be-able-to-move.patch b/patches/server/0358-Dead-Player-s-shouldn-t-be-able-to-move.patch similarity index 84% rename from patches/unapplied/server/0371-Dead-Player-s-shouldn-t-be-able-to-move.patch rename to patches/server/0358-Dead-Player-s-shouldn-t-be-able-to-move.patch index 836fcf6b72..650e763d04 100644 --- a/patches/unapplied/server/0371-Dead-Player-s-shouldn-t-be-able-to-move.patch +++ b/patches/server/0358-Dead-Player-s-shouldn-t-be-able-to-move.patch @@ -7,10 +7,10 @@ This fixes a lot of game state issues where packets were delayed for processing due to 1.15's new queue but processed while dead. diff --git a/src/main/java/net/minecraft/world/entity/player/Player.java b/src/main/java/net/minecraft/world/entity/player/Player.java -index a7e0203cc4bf7d98b65230fdbc4d873eeabdf9da..1ada0736ce35c0299e40d4ce8fbe49f170ea0c6f 100644 +index 078986fb32eeecacc954ad6719e981ed8b3a2350..a8731cf957da9aad7ed6f5d372500bc34afd32ca 100644 --- a/src/main/java/net/minecraft/world/entity/player/Player.java +++ b/src/main/java/net/minecraft/world/entity/player/Player.java -@@ -1159,7 +1159,7 @@ public abstract class Player extends LivingEntity { +@@ -1160,7 +1160,7 @@ public abstract class Player extends LivingEntity { @Override protected boolean isImmobile() { diff --git a/patches/unapplied/server/0372-Optimize-Collision-to-not-load-chunks.patch b/patches/server/0359-Optimize-Collision-to-not-load-chunks.patch similarity index 91% rename from patches/unapplied/server/0372-Optimize-Collision-to-not-load-chunks.patch rename to patches/server/0359-Optimize-Collision-to-not-load-chunks.patch index 4adb47c4f3..e16cf3d598 100644 --- a/patches/unapplied/server/0372-Optimize-Collision-to-not-load-chunks.patch +++ b/patches/server/0359-Optimize-Collision-to-not-load-chunks.patch @@ -14,10 +14,10 @@ movement will load only the chunk the player enters anyways and avoids loading massive amounts of surrounding chunks due to large AABB lookups. diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java -index 4efa85f9c18927248dc2397df0bd3cd0a9063347..635d803066fa34a13174935ba0b63a0c86c0b1f4 100644 +index eb020acbead65c189861898f5dc35978fef6aa9e..1bc82045fb5ca6bfce32cfeb3895e4de559153f5 100644 --- a/src/main/java/net/minecraft/server/players/PlayerList.java +++ b/src/main/java/net/minecraft/server/players/PlayerList.java -@@ -820,6 +820,7 @@ public abstract class PlayerList { +@@ -827,6 +827,7 @@ public abstract class PlayerList { entityplayer1.forceSetPositionRotation(location.getX(), location.getY(), location.getZ(), location.getYaw(), location.getPitch()); // CraftBukkit end @@ -26,7 +26,7 @@ index 4efa85f9c18927248dc2397df0bd3cd0a9063347..635d803066fa34a13174935ba0b63a0c entityplayer1.setPos(entityplayer1.getX(), entityplayer1.getY() + 1.0D, entityplayer1.getZ()); } diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java -index 479586efacc17e418dd8d64d884efe67355e1844..33d37c7e1bd7e676d70ba942476def5c49a59176 100644 +index a1eb5b0357d646b42031a5a21cc7740a94430558..ef5adc495a6feefdcf3ba595334436a5cb843a43 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java @@ -237,6 +237,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource { @@ -38,11 +38,11 @@ index 479586efacc17e418dd8d64d884efe67355e1844..33d37c7e1bd7e676d70ba942476def5c public @org.jetbrains.annotations.Nullable net.minecraft.server.level.ChunkMap.TrackedEntity tracker; // Paper diff --git a/src/main/java/net/minecraft/world/level/BlockCollisions.java b/src/main/java/net/minecraft/world/level/BlockCollisions.java -index 8390ce194ccc692139c0e870c16a7fb76ac8ba68..be578f14146b0184d5419d5b961c5d681f9ba7a3 100644 +index f2c423154ed6a00882a46d93b69ed4f6ba73782c..90d8d484dd66d6da33f3dd55bdf1d3a059df2a84 100644 --- a/src/main/java/net/minecraft/world/level/BlockCollisions.java +++ b/src/main/java/net/minecraft/world/level/BlockCollisions.java -@@ -66,22 +66,41 @@ public class BlockCollisions extends AbstractIterator { - protected VoxelShape computeNext() { +@@ -65,22 +65,41 @@ public class BlockCollisions extends AbstractIterator { + protected T computeNext() { while(true) { if (this.cursor.advance()) { - int i = this.cursor.nextX(); @@ -92,7 +92,7 @@ index 8390ce194ccc692139c0e870c16a7fb76ac8ba68..be578f14146b0184d5419d5b961c5d68 } diff --git a/src/main/java/net/minecraft/world/level/CollisionGetter.java b/src/main/java/net/minecraft/world/level/CollisionGetter.java -index 4c373d6c8ddd9f5db88888cd8dbbfc24eb5df793..56d94c94fb0d4dc468bb5d69be655ddd5c6b5360 100644 +index 30d037a8f890e06b27c5d3609bdd10e6b11cfb13..06107d69dff9f0b52a5f188095cbd9a9efa5684c 100644 --- a/src/main/java/net/minecraft/world/level/CollisionGetter.java +++ b/src/main/java/net/minecraft/world/level/CollisionGetter.java @@ -44,11 +44,13 @@ public interface CollisionGetter extends BlockGetter { diff --git a/patches/unapplied/server/0373-Don-t-move-existing-players-to-world-spawn.patch b/patches/server/0360-Don-t-move-existing-players-to-world-spawn.patch similarity index 83% rename from patches/unapplied/server/0373-Don-t-move-existing-players-to-world-spawn.patch rename to patches/server/0360-Don-t-move-existing-players-to-world-spawn.patch index 714d0165f7..79bd8c10ae 100644 --- a/patches/unapplied/server/0373-Don-t-move-existing-players-to-world-spawn.patch +++ b/patches/server/0360-Don-t-move-existing-players-to-world-spawn.patch @@ -13,10 +13,10 @@ By skipping this, we avoid potential for a large spike on server start. public net.minecraft.server.level.ServerPlayer fudgeSpawnLocation(Lnet/minecraft/server/level/ServerLevel;)V diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java -index e6945abd9337af07625793fb893718b00e67168a..7dbf61d79db8a7f08e518c7858142bb0e0f469c4 100644 +index b5ce9a93089ea64286bd33cf3fd6eab60863c66d..b8159a661be0e64a8b1af93c9a7f63d8835b7d03 100644 --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java -@@ -336,7 +336,7 @@ public class ServerPlayer extends Player { +@@ -335,7 +335,7 @@ public class ServerPlayer extends Player { this.stats = server.getPlayerList().getPlayerStats(this); this.advancements = server.getPlayerList().getPlayerAdvancements(this); this.setMaxUpStep(1.0F); @@ -25,24 +25,24 @@ index e6945abd9337af07625793fb893718b00e67168a..7dbf61d79db8a7f08e518c7858142bb0 this.cachedSingleHashSet = new com.destroystokyo.paper.util.misc.PooledLinkedHashSets.PooledObjectLinkedOpenHashSet<>(this); // Paper -@@ -570,7 +570,7 @@ public class ServerPlayer extends Player { +@@ -569,7 +569,7 @@ public class ServerPlayer extends Player { position = Vec3.atCenterOf(world.getSharedSpawnPos()); } - this.level = world; + this.setLevel(world); - this.setPos(position); + this.setPosRaw(position.x(), position.y(), position.z()); // Paper - don't register to chunks yet } this.gameMode.setLevel((ServerLevel) world); } diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java -index 635d803066fa34a13174935ba0b63a0c86c0b1f4..3f5706d4b30b74ba54032ed48d37990ce6ddd715 100644 +index 1bc82045fb5ca6bfce32cfeb3895e4de559153f5..33b0647843d392b3acd54fa0bb7835f1b65bb6ca 100644 --- a/src/main/java/net/minecraft/server/players/PlayerList.java +++ b/src/main/java/net/minecraft/server/players/PlayerList.java -@@ -229,6 +229,7 @@ public abstract class PlayerList { +@@ -236,6 +236,7 @@ public abstract class PlayerList { // Paper start if (nbttagcompound == null) { player.spawnReason = org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.DEFAULT; // set Player SpawnReason to DEFAULT on first login + player.fudgeSpawnLocation(worldserver1); // only move to spawn on first login, otherwise, stay where you are.... } // Paper end - player.setLevel(worldserver1); + player.setServerLevel(worldserver1); diff --git a/patches/unapplied/server/0374-Optimize-GoalSelector-Goal.Flag-Set-operations.patch b/patches/server/0361-Optimize-GoalSelector-Goal.Flag-Set-operations.patch similarity index 100% rename from patches/unapplied/server/0374-Optimize-GoalSelector-Goal.Flag-Set-operations.patch rename to patches/server/0361-Optimize-GoalSelector-Goal.Flag-Set-operations.patch diff --git a/patches/unapplied/server/0375-Improved-Watchdog-Support.patch b/patches/server/0362-Improved-Watchdog-Support.patch similarity index 92% rename from patches/unapplied/server/0375-Improved-Watchdog-Support.patch rename to patches/server/0362-Improved-Watchdog-Support.patch index b58af31718..08416271be 100644 --- a/patches/unapplied/server/0375-Improved-Watchdog-Support.patch +++ b/patches/server/0362-Improved-Watchdog-Support.patch @@ -71,7 +71,7 @@ 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 d00545c31de383470bcb8e4d9c6edad2f39c864c..ebc8446631a4c4abccd2292ec52b69a0b6685199 100644 +index 3d71748684264a854f0e8648a99d6c8f09b0900e..d7428c963fc369e04926a5987653ea5bd325d51d 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java @@ -299,7 +299,7 @@ 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 -@@ -888,6 +891,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop { +@@ -876,6 +879,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..383c52c62f49b17db2fbf58009d6ea132d124bea 100644 +index 06efdd7aa6d35a670e81c4f303618a7ba301396a..29b315188e3deb994b45b2154b2ce4f17c4fde2d 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 +490,7 @@ index b47d043144c499b1499f6b4be5a16a3f75c9fcb8..383c52c62f49b17db2fbf58009d6ea13 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 +507,7 @@ index b47d043144c499b1499f6b4be5a16a3f75c9fcb8..383c52c62f49b17db2fbf58009d6ea13 lastEarlyWarning = currentTime; if (isLongTimeout) { // Paper end -@@ -137,9 +140,25 @@ public final class WatchdogThread extends io.papermc.paper.util.TickThread // Pa +@@ -136,9 +139,25 @@ public class WatchdogThread extends Thread if ( isLongTimeout ) { diff --git a/patches/unapplied/server/0376-Optimize-Pathfinding.patch b/patches/server/0363-Optimize-Pathfinding.patch similarity index 94% rename from patches/unapplied/server/0376-Optimize-Pathfinding.patch rename to patches/server/0363-Optimize-Pathfinding.patch index 3a3b37c99c..73f180d7b5 100644 --- a/patches/unapplied/server/0376-Optimize-Pathfinding.patch +++ b/patches/server/0363-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 46c2885097ab768bb9d62187fe0ad2d61007d353..7ffe5bef3778d5971ea4ceadf3102725fd0d08cd 100644 +index 03cc97b13b1b8eb591b563c1eb52355b00ea3bf1..b376670d11088e524ce246f667e580e90cd119a3 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/0377-Reduce-Either-Optional-allocation.patch b/patches/server/0364-Reduce-Either-Optional-allocation.patch similarity index 100% rename from patches/unapplied/server/0377-Reduce-Either-Optional-allocation.patch rename to patches/server/0364-Reduce-Either-Optional-allocation.patch diff --git a/patches/unapplied/server/0378-Reduce-memory-footprint-of-NBTTagCompound.patch b/patches/server/0365-Reduce-memory-footprint-of-NBTTagCompound.patch similarity index 100% rename from patches/unapplied/server/0378-Reduce-memory-footprint-of-NBTTagCompound.patch rename to patches/server/0365-Reduce-memory-footprint-of-NBTTagCompound.patch diff --git a/patches/unapplied/server/0379-Prevent-opening-inventories-when-frozen.patch b/patches/server/0366-Prevent-opening-inventories-when-frozen.patch similarity index 79% rename from patches/unapplied/server/0379-Prevent-opening-inventories-when-frozen.patch rename to patches/server/0366-Prevent-opening-inventories-when-frozen.patch index 0fbc94c923..323bcae256 100644 --- a/patches/unapplied/server/0379-Prevent-opening-inventories-when-frozen.patch +++ b/patches/server/0366-Prevent-opening-inventories-when-frozen.patch @@ -5,29 +5,29 @@ 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 7dbf61d79db8a7f08e518c7858142bb0e0f469c4..fedd9727e9d73fdbced6431b313a080705b1d9a5 100644 +index b8159a661be0e64a8b1af93c9a7f63d8835b7d03..394a18d1f82eb3c313279ea5bad1d603ad1e3d02 100644 --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java -@@ -652,7 +652,7 @@ public class ServerPlayer extends Player { - containerUpdateDelay = level.paperConfig().tickRates.containerUpdate; +@@ -651,7 +651,7 @@ public class ServerPlayer extends Player { + containerUpdateDelay = this.level().paperConfig().tickRates.containerUpdate; } // Paper end -- if (!this.level.isClientSide && !this.containerMenu.stillValid(this)) { -+ if (!this.level.isClientSide && this.containerMenu != this.inventoryMenu && (isImmobile() || !this.containerMenu.stillValid(this))) { // Paper - auto close while frozen +- if (!this.level().isClientSide && !this.containerMenu.stillValid(this)) { ++ if (!this.level().isClientSide && this.containerMenu != this.inventoryMenu && (this.isImmobile() || !this.containerMenu.stillValid(this))) { // Paper - auto close while frozen this.closeContainer(org.bukkit.event.inventory.InventoryCloseEvent.Reason.CANT_USE); // Paper this.containerMenu = this.inventoryMenu; } -@@ -1501,7 +1501,7 @@ public class ServerPlayer extends Player { +@@ -1500,7 +1500,7 @@ public class ServerPlayer extends Player { } else { // CraftBukkit start this.containerMenu = container; - this.connection.send(new ClientboundOpenScreenPacket(container.containerId, container.getType(), container.getTitle())); -+ if (!isImmobile()) this.connection.send(new ClientboundOpenScreenPacket(container.containerId, container.getType(), container.getTitle())); // Paper ++ if (!this.isImmobile()) this.connection.send(new ClientboundOpenScreenPacket(container.containerId, container.getType(), container.getTitle())); // Paper // CraftBukkit end 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 77314674a1f66a514f8f5a0fef5ca188b5af0b6a..14984e791bd9309672b1fb404b8552849854d393 100644 +index 20aa0ad8e056ebb8d352c69da2a2ed044d338b41..ed6d7743ab6513ee4f4c09eae1c7124197df4ed1 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java @@ -327,7 +327,7 @@ public class CraftHumanEntity extends CraftLivingEntity implements HumanEntity { diff --git a/patches/unapplied/server/0380-Don-t-run-entity-collision-code-if-not-needed.patch b/patches/server/0367-Don-t-run-entity-collision-code-if-not-needed.patch similarity index 66% rename from patches/unapplied/server/0380-Don-t-run-entity-collision-code-if-not-needed.patch rename to patches/server/0367-Don-t-run-entity-collision-code-if-not-needed.patch index a24881a562..f9d254d2eb 100644 --- a/patches/unapplied/server/0380-Don-t-run-entity-collision-code-if-not-needed.patch +++ b/patches/server/0367-Don-t-run-entity-collision-code-if-not-needed.patch @@ -12,12 +12,12 @@ 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 e6e4856db7d983460fdf898583915ff2e4a43d14..25e1dc97e3260e7f58b15a1759b8f9531c6a6f20 100644 +index 574f8db51202c6686e7703f3193d63a1a4fefb65..6fbd1209edf59dab9cc8b0f568f2d31846264457 100644 --- a/src/main/java/net/minecraft/world/entity/LivingEntity.java +++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java -@@ -3328,10 +3328,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); +@@ -3377,10 +3377,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 { + // Paper start - don't run getEntities if we're not going to use its result + if (!this.isPushable()) { @@ -28,15 +28,15 @@ index e6e4856db7d983460fdf898583915ff2e4a43d14..25e1dc97e3260e7f58b15a1759b8f953 + return; + } + -+ int i = this.level.getGameRules().getInt(GameRules.RULE_MAX_ENTITY_CRAMMING); -+ if (i <= 0 && level.paperConfig().collisions.maxEntityCollisions <= 0) { ++ int i = this.level().getGameRules().getInt(GameRules.RULE_MAX_ENTITY_CRAMMING); ++ if (i <= 0 && this.level().paperConfig().collisions.maxEntityCollisions <= 0) { + return; + } + // Paper end - don't run getEntities if we're not going to use its result - List list = this.level.getEntities((Entity) this, this.getBoundingBox(), EntitySelector.pushableBy(this)); + List list = this.level().getEntities((Entity) this, this.getBoundingBox(), EntitySelector.pushableBy(this)); if (!list.isEmpty()) { -- int i = this.level.getGameRules().getInt(GameRules.RULE_MAX_ENTITY_CRAMMING); +- int i = this.level().getGameRules().getInt(GameRules.RULE_MAX_ENTITY_CRAMMING); + // Paper - moved up int j; diff --git a/patches/unapplied/server/0381-Implement-Player-Client-Options-API.patch b/patches/server/0368-Implement-Player-Client-Options-API.patch similarity index 96% rename from patches/unapplied/server/0381-Implement-Player-Client-Options-API.patch rename to patches/server/0368-Implement-Player-Client-Options-API.patch index dfe55c81e4..da1fc9e2d1 100644 --- a/patches/unapplied/server/0381-Implement-Player-Client-Options-API.patch +++ b/patches/server/0368-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 fedd9727e9d73fdbced6431b313a080705b1d9a5..75350988934c6eb1cd39587fa1f53335bf05db17 100644 +index 394a18d1f82eb3c313279ea5bad1d603ad1e3d02..df41fdb2072f80129617f96a4f886724c6a0d744 100644 --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java -@@ -1904,9 +1904,24 @@ public class ServerPlayer extends Player { +@@ -1907,9 +1907,24 @@ public class ServerPlayer extends Player { } } @@ -116,10 +116,10 @@ index fedd9727e9d73fdbced6431b313a080705b1d9a5..75350988934c6eb1cd39587fa1f53335 if (getMainArm() != packet.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 fefe3dc1597d7449e0138be2f60918b06864108a..ef7078780b4829e61048233b60150b26f6a9b792 100644 +index 1e2c102ca0d2012344451610e83372840d8d4a74..37e3095e4444097b9b6020d1d0aee27b870c3588 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -@@ -627,6 +627,28 @@ public class CraftPlayer extends CraftHumanEntity implements Player { +@@ -552,6 +552,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/0382-Don-t-crash-if-player-is-attempted-to-be-removed-fro.patch b/patches/server/0369-Don-t-crash-if-player-is-attempted-to-be-removed-fro.patch similarity index 81% rename from patches/unapplied/server/0382-Don-t-crash-if-player-is-attempted-to-be-removed-fro.patch rename to patches/server/0369-Don-t-crash-if-player-is-attempted-to-be-removed-fro.patch index 1b01295738..9b3e447197 100644 --- a/patches/unapplied/server/0382-Don-t-crash-if-player-is-attempted-to-be-removed-fro.patch +++ b/patches/server/0369-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 ffa1e457decf8502c3283352bf5be94d419ff165..d3c3db919e9b0507e8543313d9028394e5163673 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 -@@ -153,8 +153,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 ffa1e457decf8502c3283352bf5be94d419ff165..d3c3db919e9b0507e8543313d9028394 + 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/0383-Fix-Longstanding-Broken-behavior-of-PlayerJoinEvent.patch b/patches/server/0370-Fix-Longstanding-Broken-behavior-of-PlayerJoinEvent.patch similarity index 89% rename from patches/unapplied/server/0383-Fix-Longstanding-Broken-behavior-of-PlayerJoinEvent.patch rename to patches/server/0370-Fix-Longstanding-Broken-behavior-of-PlayerJoinEvent.patch index 4d7a62672a..089f7fdc6d 100644 --- a/patches/unapplied/server/0383-Fix-Longstanding-Broken-behavior-of-PlayerJoinEvent.patch +++ b/patches/server/0370-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 9c5925bc6a0fb277970d46c34dd812cc765a537a..f2bdb647f137a1334789dc56e517844b74d70bd9 100644 +index f27e9dd8185892b3948814937380140c45d7fd33..3616f106b8bd5824700bfb67678599e6e1eca712 100644 --- a/src/main/java/net/minecraft/server/level/ChunkMap.java +++ b/src/main/java/net/minecraft/server/level/ChunkMap.java -@@ -1039,6 +1039,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -1571,6 +1571,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,7 +43,7 @@ index 9c5925bc6a0fb277970d46c34dd812cc765a537a..f2bdb647f137a1334789dc56e517844b 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 75350988934c6eb1cd39587fa1f53335bf05db17..35091999392e7c5e6763aee490020c675e19134b 100644 +index df41fdb2072f80129617f96a4f886724c6a0d744..4495edee3b29c441d14460be1bb3f5e0ef4b9851 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 { @@ -55,10 +55,10 @@ index 75350988934c6eb1cd39587fa1f53335bf05db17..35091999392e7c5e6763aee490020c67 public String kickLeaveMessage = null; // SPIGOT-3034: Forward leave message to PlayerQuitEvent // CraftBukkit end diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java -index fd0b72abbbb237c640510aee65eafb9aa9fa0376..0e2a84148e721a8f799f0746e379c16a5f7f0dd3 100644 +index 7102315de9acb3220f0f49bacb83386a8bcb0ce7..498516c98f396e601e67b9e47a62e89f709f98a5 100644 --- a/src/main/java/net/minecraft/server/players/PlayerList.java +++ b/src/main/java/net/minecraft/server/players/PlayerList.java -@@ -304,6 +304,12 @@ public abstract class PlayerList { +@@ -311,6 +311,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 fd0b72abbbb237c640510aee65eafb9aa9fa0376..0e2a84148e721a8f799f0746e379c16a // CraftBukkit start CraftPlayer bukkitPlayer = player.getBukkitEntity(); -@@ -342,6 +348,8 @@ public abstract class PlayerList { +@@ -349,6 +355,8 @@ public abstract class PlayerList { player.connection.send(ClientboundPlayerInfoUpdatePacket.createPlayerInitializing(List.of(entityplayer1))); } player.sentListPacket = true; @@ -80,7 +80,7 @@ index fd0b72abbbb237c640510aee65eafb9aa9fa0376..0e2a84148e721a8f799f0746e379c16a // CraftBukkit end player.getEntityData().refresh(player); // CraftBukkit - BungeeCord#2321, send complete data to self on spawn -@@ -367,6 +375,11 @@ public abstract class PlayerList { +@@ -374,6 +382,11 @@ public abstract class PlayerList { playerconnection.send(new ClientboundUpdateMobEffectPacket(player.getId(), mobeffect)); } @@ -92,7 +92,7 @@ index fd0b72abbbb237c640510aee65eafb9aa9fa0376..0e2a84148e721a8f799f0746e379c16a if (nbttagcompound != null && nbttagcompound.contains("RootVehicle", 10)) { CompoundTag nbttagcompound1 = nbttagcompound.getCompound("RootVehicle"); // CraftBukkit start -@@ -415,6 +428,10 @@ public abstract class PlayerList { +@@ -422,6 +435,10 @@ public abstract class PlayerList { } } @@ -103,7 +103,7 @@ index fd0b72abbbb237c640510aee65eafb9aa9fa0376..0e2a84148e721a8f799f0746e379c16a player.initInventoryMenu(); // CraftBukkit - Moved from above, added world // Paper start - Add to collideRule team if needed -@@ -424,6 +441,7 @@ public abstract class PlayerList { +@@ -431,6 +448,7 @@ public abstract class PlayerList { scoreboard.addPlayerToTeam(player.getScoreboardName(), collideRuleTeam); } // Paper end diff --git a/patches/unapplied/server/0384-Move-player-to-spawn-point-if-spawn-in-unloaded-worl.patch b/patches/server/0371-Move-player-to-spawn-point-if-spawn-in-unloaded-worl.patch similarity index 89% rename from patches/unapplied/server/0384-Move-player-to-spawn-point-if-spawn-in-unloaded-worl.patch rename to patches/server/0371-Move-player-to-spawn-point-if-spawn-in-unloaded-worl.patch index d1daf68a0e..56485a37cd 100644 --- a/patches/unapplied/server/0384-Move-player-to-spawn-point-if-spawn-in-unloaded-worl.patch +++ b/patches/server/0371-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 33d37c7e1bd7e676d70ba942476def5c49a59176..ecff22945c0a4cbc5cd26c04bb8e6416ba07fffd 100644 +index ef5adc495a6feefdcf3ba595334436a5cb843a43..09e107b7d74e0043d5335be23885b86e24f8af29 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java -@@ -2200,9 +2200,11 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource { +@@ -2267,9 +2267,11 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource { bworld = server.getWorld(worldName); } diff --git a/patches/unapplied/server/0385-Add-PlayerAttackEntityCooldownResetEvent.patch b/patches/server/0372-Add-PlayerAttackEntityCooldownResetEvent.patch similarity index 92% rename from patches/unapplied/server/0385-Add-PlayerAttackEntityCooldownResetEvent.patch rename to patches/server/0372-Add-PlayerAttackEntityCooldownResetEvent.patch index 519666c8f9..3caa031519 100644 --- a/patches/unapplied/server/0385-Add-PlayerAttackEntityCooldownResetEvent.patch +++ b/patches/server/0372-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 25e1dc97e3260e7f58b15a1759b8f9531c6a6f20..6541caa4a574271fa940d1dceef434655ffd8aa9 100644 +index 6fbd1209edf59dab9cc8b0f568f2d31846264457..934c5246f43566a7277b77d0e74b38fc94c6836f 100644 --- a/src/main/java/net/minecraft/world/entity/LivingEntity.java +++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java -@@ -2126,7 +2126,16 @@ public abstract class LivingEntity extends Entity implements Attackable { +@@ -2169,7 +2169,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/0386-Don-t-fire-BlockFade-on-worldgen-threads.patch b/patches/server/0373-Don-t-fire-BlockFade-on-worldgen-threads.patch similarity index 94% rename from patches/unapplied/server/0386-Don-t-fire-BlockFade-on-worldgen-threads.patch rename to patches/server/0373-Don-t-fire-BlockFade-on-worldgen-threads.patch index 6c84d8b64c..5e8eee07ab 100644 --- a/patches/unapplied/server/0386-Don-t-fire-BlockFade-on-worldgen-threads.patch +++ b/patches/server/0373-Don-t-fire-BlockFade-on-worldgen-threads.patch @@ -6,7 +6,7 @@ Subject: [PATCH] Don't fire BlockFade on worldgen threads Caused a deadlock diff --git a/src/main/java/net/minecraft/world/level/block/FireBlock.java b/src/main/java/net/minecraft/world/level/block/FireBlock.java -index 33ece83c6d41c65042356c44eee2c76934c07d0b..9576f581bb61e6c71de427c52dcc3e56dc3ed81e 100644 +index 945d8b0f58f6a5b2281f136d3afbba3b34e0e6b5..8c6edd032c927f7d1e04e944b4ce5598d71cdd81 100644 --- a/src/main/java/net/minecraft/world/level/block/FireBlock.java +++ b/src/main/java/net/minecraft/world/level/block/FireBlock.java @@ -101,6 +101,7 @@ public class FireBlock extends BaseFireBlock { diff --git a/patches/unapplied/server/0387-Add-phantom-creative-and-insomniac-controls.patch b/patches/server/0374-Add-phantom-creative-and-insomniac-controls.patch similarity index 76% rename from patches/unapplied/server/0387-Add-phantom-creative-and-insomniac-controls.patch rename to patches/server/0374-Add-phantom-creative-and-insomniac-controls.patch index 9a20c11a4f..8cec30ee5d 100644 --- a/patches/unapplied/server/0387-Add-phantom-creative-and-insomniac-controls.patch +++ b/patches/server/0374-Add-phantom-creative-and-insomniac-controls.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Add phantom creative and insomniac controls diff --git a/src/main/java/net/minecraft/world/entity/EntitySelector.java b/src/main/java/net/minecraft/world/entity/EntitySelector.java -index 6fd874a83a248e6a7d427d18d11fc608544662c5..302676ef78ed5b3b7fc1b04851447ca72eed10c0 100644 +index 668a7c3f36cdbe48e472cb810b27ae4ab39a65d6..9edea92834306b39abda36ba9be4e8796f113cc4 100644 --- a/src/main/java/net/minecraft/world/entity/EntitySelector.java +++ b/src/main/java/net/minecraft/world/entity/EntitySelector.java @@ -27,6 +27,7 @@ public final class EntitySelector { @@ -17,7 +17,7 @@ index 6fd874a83a248e6a7d427d18d11fc608544662c5..302676ef78ed5b3b7fc1b04851447ca7 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 a3663ea031f3a243f670bf1c98272a49daed71b0..0ada1ba6774e3d0514afb946fd0f104004cc020d 100644 +index 9bd6e71ea38bf050832f0f7bbed4a5db6ddcef71..e5a53fd86fd34c88e2a5232085f649e6dd3173c2 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 { @@ -29,15 +29,15 @@ index a3663ea031f3a243f670bf1c98272a49daed71b0..0ada1ba6774e3d0514afb946fd0f1040 return true; } diff --git a/src/main/java/net/minecraft/world/level/levelgen/PhantomSpawner.java b/src/main/java/net/minecraft/world/level/levelgen/PhantomSpawner.java -index df7f23bb039a61ed26e117df934aad9ec5df3f58..66ac41d8fce4176feecf9a7e89e15244f47d261d 100644 +index a18e6296d1f50c53291d41192a1009605a1b3583..8c767aba1e800c41412e92afe9cb09cfab1c6ffc 100644 --- a/src/main/java/net/minecraft/world/level/levelgen/PhantomSpawner.java +++ b/src/main/java/net/minecraft/world/level/levelgen/PhantomSpawner.java -@@ -51,7 +51,7 @@ public class PhantomSpawner implements CustomSpawner { +@@ -49,7 +49,7 @@ public class PhantomSpawner implements CustomSpawner { while (iterator.hasNext()) { - Player entityhuman = (Player) iterator.next(); + ServerPlayer entityplayer = (ServerPlayer) iterator.next(); -- if (!entityhuman.isSpectator()) { -+ if (!entityhuman.isSpectator() && (!world.paperConfig().entities.behavior.phantomsDoNotSpawnOnCreativePlayers || !entityhuman.isCreative())) { // Paper - BlockPos blockposition = entityhuman.blockPosition(); +- if (!entityplayer.isSpectator()) { ++ if (!entityplayer.isSpectator() && (!world.paperConfig().entities.behavior.phantomsDoNotSpawnOnCreativePlayers || !entityplayer.isCreative())) { // Paper + BlockPos blockposition = entityplayer.blockPosition(); if (!world.dimensionType().hasSkyLight() || blockposition.getY() >= world.getSeaLevel() && world.canSeeSky(blockposition)) { diff --git a/patches/unapplied/server/0388-Fix-numerous-item-duplication-issues-and-teleport-is.patch b/patches/server/0375-Fix-numerous-item-duplication-issues-and-teleport-is.patch similarity index 85% rename from patches/unapplied/server/0388-Fix-numerous-item-duplication-issues-and-teleport-is.patch rename to patches/server/0375-Fix-numerous-item-duplication-issues-and-teleport-is.patch index 61dce981a6..7906e0ec4a 100644 --- a/patches/unapplied/server/0388-Fix-numerous-item-duplication-issues-and-teleport-is.patch +++ b/patches/server/0375-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 ecff22945c0a4cbc5cd26c04bb8e6416ba07fffd..04a388bd3a89a27f0b75134ef781b5e22da633de 100644 +index 09e107b7d74e0043d5335be23885b86e24f8af29..e17237a1fe56bf04516b0ee0489c781a225b6a81 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java -@@ -2330,11 +2330,12 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource { +@@ -2397,11 +2397,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) { @@ -28,29 +28,29 @@ index ecff22945c0a4cbc5cd26c04bb8e6416ba07fffd..04a388bd3a89a27f0b75134ef781b5e2 return null; } // CraftBukkit end -- ItemEntity entityitem = new ItemEntity(this.level, this.getX(), this.getY() + (double) yOffset, this.getZ(), stack); -+ ItemEntity entityitem = new ItemEntity(this.level, this.getX(), this.getY() + (double) yOffset, this.getZ(), stack.copy()); // Paper - clone so we can destroy original +- ItemEntity entityitem = new ItemEntity(this.level(), this.getX(), this.getY() + (double) yOffset, this.getZ(), stack); ++ ItemEntity entityitem = new ItemEntity(this.level(), this.getX(), this.getY() + (double) yOffset, this.getZ(), stack.copy()); // Paper - copy so we can destroy original + stack.setCount(0); // Paper - destroy this item - if this ever leaks due to game bugs, ensure it doesn't dupe entityitem.setDefaultPickUpDelay(); // CraftBukkit start -@@ -3115,6 +3116,12 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource { +@@ -3186,6 +3187,12 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource { @Nullable public Entity teleportTo(ServerLevel worldserver, PositionImpl location) { // CraftBukkit end + // Paper start - fix bad state entities causing dupes -+ if (!isAlive() || !valid) { ++ if (!this.isAlive() || !this.valid) { + LOGGER.warn("Illegal Entity Teleport " + this + " to " + worldserver + ":" + location, new Throwable()); + return null; + } + // Paper end - if (this.level instanceof ServerLevel && !this.isRemoved()) { - this.level.getProfiler().push("changeDimension"); + if (this.level() instanceof ServerLevel && !this.isRemoved()) { + this.level().getProfiler().push("changeDimension"); // CraftBukkit start -@@ -3141,6 +3148,11 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource { +@@ -3212,6 +3219,11 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource { // CraftBukkit end - this.level.getProfiler().popPush("reloading"); + this.level().getProfiler().popPush("reloading"); + // Paper start - Change lead drop timing to prevent dupe + if (this instanceof Mob) { + ((Mob) this).dropLeash(true, true); // Paper drop lead @@ -59,7 +59,7 @@ index ecff22945c0a4cbc5cd26c04bb8e6416ba07fffd..04a388bd3a89a27f0b75134ef781b5e2 Entity entity = this.getType().create(worldserver); if (entity != null) { -@@ -3154,10 +3166,6 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource { +@@ -3225,10 +3237,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 ecff22945c0a4cbc5cd26c04bb8e6416ba07fffd..04a388bd3a89a27f0b75134ef781b5e2 // CraftBukkit end } -@@ -3278,7 +3286,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource { +@@ -3349,7 +3357,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource { } public boolean canChangeDimensions() { @@ -80,10 +80,10 @@ index ecff22945c0a4cbc5cd26c04bb8e6416ba07fffd..04a388bd3a89a27f0b75134ef781b5e2 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 f7ae0c52313f4d8c64849605148f8293e0e96141..65f5381c3362b16fa709728458f87b9283b73291 100644 +index 934c5246f43566a7277b77d0e74b38fc94c6836f..d9ee22bbd654a2f39c443262b4a11f997ed1559e 100644 --- a/src/main/java/net/minecraft/world/entity/LivingEntity.java +++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java -@@ -1636,9 +1636,9 @@ public abstract class LivingEntity extends Entity implements Attackable { +@@ -1688,9 +1688,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 f7ae0c52313f4d8c64849605148f8293e0e96141..65f5381c3362b16fa709728458f87b92 // Paper start - clear equipment if event is not cancelled if (this instanceof Mob) { for (EquipmentSlot slot : this.clearedEquipmentSlots) { -@@ -1736,8 +1736,13 @@ public abstract class LivingEntity extends Entity implements Attackable { +@@ -1788,8 +1788,13 @@ public abstract class LivingEntity extends Entity implements Attackable { this.dropCustomDeathLoot(source, i, flag); this.clearEquipmentSlots = prev; // Paper } @@ -113,10 +113,10 @@ index f7ae0c52313f4d8c64849605148f8293e0e96141..65f5381c3362b16fa709728458f87b92 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 dbb4bfb3d1f1ce2e435ca531be36ea448c0e3212..3be5ea477cb3dd3ce75f3feced8daf7cce7075cd 100644 +index 4413b609f1250cf9477fcb3fecd7b67afee0b896..101e3a1f0f52b67b55c99c2619cc43298d92a3f2 100644 --- a/src/main/java/net/minecraft/world/entity/decoration/ArmorStand.java +++ b/src/main/java/net/minecraft/world/entity/decoration/ArmorStand.java -@@ -627,7 +627,7 @@ public class ArmorStand extends LivingEntity { +@@ -621,7 +621,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 dbb4bfb3d1f1ce2e435ca531be36ea448c0e3212..3be5ea477cb3dd3ce75f3feced8daf7c this.handItems.set(i, ItemStack.EMPTY); } } -@@ -635,7 +635,7 @@ public class ArmorStand extends LivingEntity { +@@ -629,7 +629,7 @@ public class ArmorStand extends LivingEntity { for (i = 0; i < this.armorItems.size(); ++i) { itemstack = (ItemStack) this.armorItems.get(i); if (!itemstack.isEmpty()) { @@ -135,7 +135,7 @@ index dbb4bfb3d1f1ce2e435ca531be36ea448c0e3212..3be5ea477cb3dd3ce75f3feced8daf7c } } diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java -index cdf93e8751fa2520881290b2a7385f99ec4d0dc2..195f5ef5fcabcf021e429b2a51aa274e929c7322 100644 +index 90cd8b87205a7b96eab8a9de5114d6c8ff339c8e..4a1699b56f2111881653404b38f18c9e2e7473b4 100644 --- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java +++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java @@ -827,6 +827,11 @@ public class CraftEventFactory {