diff options
author | Owen1212055 <[email protected]> | 2024-10-23 10:04:01 -0400 |
---|---|---|
committer | Owen1212055 <[email protected]> | 2024-10-23 10:04:01 -0400 |
commit | af125d26a94147ff40555819d5a9687d24b65d50 (patch) | |
tree | 12c00f31e82906203d1d1885b6023f7142f02ed4 | |
parent | aa37f7250d168e94318e975d3c6d1002e7b82c29 (diff) | |
download | Paper-af125d26a94147ff40555819d5a9687d24b65d50.tar.gz Paper-af125d26a94147ff40555819d5a9687d24b65d50.zip |
Patch
-rw-r--r-- | patches/server/0328-Prevent-Double-PlayerChunkMap-adds-crashing-server.patch (renamed from patches/unapplied/server/0331-Prevent-Double-PlayerChunkMap-adds-crashing-server.patch) | 10 | ||||
-rw-r--r-- | patches/server/0329-Don-t-tick-dead-players.patch (renamed from patches/unapplied/server/0332-Don-t-tick-dead-players.patch) | 4 | ||||
-rw-r--r-- | patches/server/0330-Dead-Player-s-shouldn-t-be-able-to-move.patch (renamed from patches/unapplied/server/0333-Dead-Player-s-shouldn-t-be-able-to-move.patch) | 4 | ||||
-rw-r--r-- | patches/server/0331-Don-t-move-existing-players-to-world-spawn.patch (renamed from patches/unapplied/server/0334-Don-t-move-existing-players-to-world-spawn.patch) | 10 | ||||
-rw-r--r-- | patches/server/0332-Optimize-Pathfinding.patch (renamed from patches/unapplied/server/0335-Optimize-Pathfinding.patch) | 4 | ||||
-rw-r--r-- | patches/server/0333-Reduce-Either-Optional-allocation.patch (renamed from patches/unapplied/server/0336-Reduce-Either-Optional-allocation.patch) | 0 | ||||
-rw-r--r-- | patches/server/0334-Reduce-memory-footprint-of-CompoundTag.patch (renamed from patches/unapplied/server/0337-Reduce-memory-footprint-of-CompoundTag.patch) | 0 | ||||
-rw-r--r-- | patches/server/0335-Prevent-opening-inventories-when-frozen.patch (renamed from patches/unapplied/server/0338-Prevent-opening-inventories-when-frozen.patch) | 12 | ||||
-rw-r--r-- | patches/server/0336-Don-t-run-entity-collision-code-if-not-needed.patch (renamed from patches/unapplied/server/0339-Don-t-run-entity-collision-code-if-not-needed.patch) | 10 | ||||
-rw-r--r-- | patches/server/0337-Implement-Player-Client-Options-API.patch (renamed from patches/unapplied/server/0340-Implement-Player-Client-Options-API.patch) | 12 | ||||
-rw-r--r-- | patches/server/0338-Don-t-crash-if-player-is-attempted-to-be-removed-fro.patch (renamed from patches/unapplied/server/0341-Don-t-crash-if-player-is-attempted-to-be-removed-fro.patch) | 4 | ||||
-rw-r--r-- | patches/server/0339-Fire-PlayerJoinEvent-when-Player-is-actually-ready.patch (renamed from patches/unapplied/server/0342-Fire-PlayerJoinEvent-when-Player-is-actually-ready.patch) | 38 | ||||
-rw-r--r-- | patches/server/0340-Move-player-to-spawn-point-if-spawn-in-unloaded-worl.patch (renamed from patches/unapplied/server/0343-Move-player-to-spawn-point-if-spawn-in-unloaded-worl.patch) | 12 | ||||
-rw-r--r-- | patches/server/0341-Add-PlayerAttackEntityCooldownResetEvent.patch (renamed from patches/unapplied/server/0344-Add-PlayerAttackEntityCooldownResetEvent.patch) | 4 | ||||
-rw-r--r-- | patches/server/0342-Don-t-fire-BlockFade-on-worldgen-threads.patch (renamed from patches/unapplied/server/0345-Don-t-fire-BlockFade-on-worldgen-threads.patch) | 6 | ||||
-rw-r--r-- | patches/server/0343-Add-phantom-creative-and-insomniac-controls.patch (renamed from patches/unapplied/server/0346-Add-phantom-creative-and-insomniac-controls.patch) | 14 | ||||
-rw-r--r-- | patches/server/0344-Fix-item-duplication-and-teleport-issues.patch (renamed from patches/unapplied/server/0347-Fix-item-duplication-and-teleport-issues.patch) | 66 | ||||
-rw-r--r-- | patches/server/0345-Villager-Restocks-API.patch (renamed from patches/unapplied/server/0348-Villager-Restocks-API.patch) | 4 | ||||
-rw-r--r-- | patches/server/0346-Validate-PickItem-Packet-and-kick-for-invalid.patch (renamed from patches/unapplied/server/0349-Validate-PickItem-Packet-and-kick-for-invalid.patch) | 10 | ||||
-rw-r--r-- | patches/server/0347-Set-cap-on-JDK-per-thread-native-byte-buffer-cache.patch (renamed from patches/unapplied/server/0350-Set-cap-on-JDK-per-thread-native-byte-buffer-cache.patch) | 2 | ||||
-rw-r--r-- | patches/server/0348-misc-debugging-dumps.patch (renamed from patches/unapplied/server/0351-misc-debugging-dumps.patch) | 16 | ||||
-rw-r--r-- | patches/server/0349-Prevent-teleporting-dead-entities.patch (renamed from patches/unapplied/server/0352-Prevent-teleporting-dead-entities.patch) | 12 |
22 files changed, 120 insertions, 134 deletions
diff --git a/patches/unapplied/server/0331-Prevent-Double-PlayerChunkMap-adds-crashing-server.patch b/patches/server/0328-Prevent-Double-PlayerChunkMap-adds-crashing-server.patch index e7c3500d18..538add8493 100644 --- a/patches/unapplied/server/0331-Prevent-Double-PlayerChunkMap-adds-crashing-server.patch +++ b/patches/server/0328-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 ee54706b36bd227edacea2a1b6099009bd652039..8206ec366b429858d9582e437781191e5aa0fa02 100644 +index b849d24144dc9f7d24484398cec3b2b90befb507..f3b99cd96672363e0d60e56b744f0bea8fa00c3f 100644 --- a/src/main/java/net/minecraft/server/level/ChunkMap.java +++ b/src/main/java/net/minecraft/server/level/ChunkMap.java -@@ -1241,6 +1241,13 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -1300,6 +1300,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 ee54706b36bd227edacea2a1b6099009bd652039..8206ec366b429858d9582e437781191e 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 b465f05d78e79ffbf70114b18204d85d32761c67..5b89d834a7c01530807e61ea25af2b01f004ce86 100644 +index e2984ccee4e01b260109d038969f9ff3ea21b87f..090d2fde891346ee634a8964b562715f4dd206d0 100644 --- a/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java -@@ -2151,7 +2151,7 @@ public class ServerLevel extends Level implements WorldGenLevel { +@@ -2232,7 +2232,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe public void onTrackingStart(Entity entity) { org.spigotmc.AsyncCatcher.catchOp("entity register"); // Spigot @@ -37,7 +37,7 @@ index b465f05d78e79ffbf70114b18204d85d32761c67..5b89d834a7c01530807e61ea25af2b01 if (entity instanceof ServerPlayer entityplayer) { ServerLevel.this.players.add(entityplayer); ServerLevel.this.updateSleepingPlayerList(); -@@ -2181,6 +2181,7 @@ public class ServerLevel extends Level implements WorldGenLevel { +@@ -2262,6 +2262,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe entity.updateDynamicGameEventListener(DynamicGameEventListener::add); entity.inWorld = true; // CraftBukkit - Mark entity as in world entity.valid = true; // CraftBukkit diff --git a/patches/unapplied/server/0332-Don-t-tick-dead-players.patch b/patches/server/0329-Don-t-tick-dead-players.patch index 0633c8502c..511d5ca037 100644 --- a/patches/unapplied/server/0332-Don-t-tick-dead-players.patch +++ b/patches/server/0329-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 d4bda65d10bee880a341196364db63523f36e380..47982f87ce93658c73ee3d7a5f7dd680e2f9aa36 100644 +index ea8279637a2af4d18c9decbf3342b058edeffd73..965ca28a8877f5e541741c45bace7075d15a77d7 100644 --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java -@@ -765,7 +765,7 @@ public class ServerPlayer extends net.minecraft.world.entity.player.Player { +@@ -993,7 +993,7 @@ public class ServerPlayer extends net.minecraft.world.entity.player.Player { public void doTick() { try { diff --git a/patches/unapplied/server/0333-Dead-Player-s-shouldn-t-be-able-to-move.patch b/patches/server/0330-Dead-Player-s-shouldn-t-be-able-to-move.patch index d10a5a50c4..068a5a06f9 100644 --- a/patches/unapplied/server/0333-Dead-Player-s-shouldn-t-be-able-to-move.patch +++ b/patches/server/0330-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 fa906334a1c569748d3f2dc073ec03a85bd09d3b..cb89b020d93ac838843ec2cbad562326a1e4257b 100644 +index 4d8929a1f5390af10fbde1dcc13c0136b0a3a745..917ac21794f1aabc6e95ab2fff2ea7547b9778a8 100644 --- a/src/main/java/net/minecraft/world/entity/player/Player.java +++ b/src/main/java/net/minecraft/world/entity/player/Player.java -@@ -1173,7 +1173,7 @@ public abstract class Player extends LivingEntity { +@@ -1143,7 +1143,7 @@ public abstract class Player extends LivingEntity { @Override protected boolean isImmobile() { diff --git a/patches/unapplied/server/0334-Don-t-move-existing-players-to-world-spawn.patch b/patches/server/0331-Don-t-move-existing-players-to-world-spawn.patch index 4c59557ecb..6750b4fb1a 100644 --- a/patches/unapplied/server/0334-Don-t-move-existing-players-to-world-spawn.patch +++ b/patches/server/0331-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 47982f87ce93658c73ee3d7a5f7dd680e2f9aa36..f8d4bd18f98ed914e116d0cc4a80140e4e8d759f 100644 +index 965ca28a8877f5e541741c45bace7075d15a77d7..adbc8e74f0b454403bc682de11bd0342e9bb6c2c 100644 --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java -@@ -358,7 +358,7 @@ public class ServerPlayer extends net.minecraft.world.entity.player.Player { +@@ -419,7 +419,7 @@ public class ServerPlayer extends net.minecraft.world.entity.player.Player { this.server = server; this.stats = server.getPlayerList().getPlayerStats(this); this.advancements = server.getPlayerList().getPlayerAdvancements(this); @@ -25,7 +25,7 @@ index 47982f87ce93658c73ee3d7a5f7dd680e2f9aa36..f8d4bd18f98ed914e116d0cc4a80140e this.updateOptions(clientOptions); this.object = null; -@@ -628,7 +628,7 @@ public class ServerPlayer extends net.minecraft.world.entity.player.Player { +@@ -856,7 +856,7 @@ public class ServerPlayer extends net.minecraft.world.entity.player.Player { position = Vec3.atCenterOf(world.getSharedSpawnPos()); } this.setLevel(world); @@ -35,10 +35,10 @@ index 47982f87ce93658c73ee3d7a5f7dd680e2f9aa36..f8d4bd18f98ed914e116d0cc4a80140e 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 8cd80ea83ddcfd5052c8d8c19d3edb42538d1e15..2cbdcdf0349e7efa797802d0d339d158153690af 100644 +index 29110c0b950c3073ab699d8ad1523ece2e8d3408..074f3518b060c4aa079b1d311b7fcb10d4a95981 100644 --- a/src/main/java/net/minecraft/server/players/PlayerList.java +++ b/src/main/java/net/minecraft/server/players/PlayerList.java -@@ -226,6 +226,7 @@ public abstract class PlayerList { +@@ -227,6 +227,7 @@ public abstract class PlayerList { // Paper start - Entity#getEntitySpawnReason if (optional.isEmpty()) { player.spawnReason = org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.DEFAULT; // set Player SpawnReason to DEFAULT on first login diff --git a/patches/unapplied/server/0335-Optimize-Pathfinding.patch b/patches/server/0332-Optimize-Pathfinding.patch index 281988ce37..76c7c6e423 100644 --- a/patches/unapplied/server/0335-Optimize-Pathfinding.patch +++ b/patches/server/0332-Optimize-Pathfinding.patch @@ -7,10 +7,10 @@ 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 188904c9f0f81db1d63eec953d6746f2dc23dc81..2e9991e6b3c05584002744a2ee2579b1dba218b2 100644 +index 436812c3bfe53358b4d76bb72d777d6661bb6d60..48c0de870a5bbf647309e69361dfb10ab56c65ab 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,13 +192,33 @@ public abstract class PathNavigation { +@@ -209,13 +209,33 @@ public abstract class PathNavigation { return this.moveTo(this.createPath(x, y, z, 1), speed); } diff --git a/patches/unapplied/server/0336-Reduce-Either-Optional-allocation.patch b/patches/server/0333-Reduce-Either-Optional-allocation.patch index d42e0ac184..d42e0ac184 100644 --- a/patches/unapplied/server/0336-Reduce-Either-Optional-allocation.patch +++ b/patches/server/0333-Reduce-Either-Optional-allocation.patch diff --git a/patches/unapplied/server/0337-Reduce-memory-footprint-of-CompoundTag.patch b/patches/server/0334-Reduce-memory-footprint-of-CompoundTag.patch index c29c346e90..c29c346e90 100644 --- a/patches/unapplied/server/0337-Reduce-memory-footprint-of-CompoundTag.patch +++ b/patches/server/0334-Reduce-memory-footprint-of-CompoundTag.patch diff --git a/patches/unapplied/server/0338-Prevent-opening-inventories-when-frozen.patch b/patches/server/0335-Prevent-opening-inventories-when-frozen.patch index 3f6f9857e6..de2065861e 100644 --- a/patches/unapplied/server/0338-Prevent-opening-inventories-when-frozen.patch +++ b/patches/server/0335-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 f8d4bd18f98ed914e116d0cc4a80140e4e8d759f..7daa310dd5d3eb1befb9983ce85e0354771af71d 100644 +index adbc8e74f0b454403bc682de11bd0342e9bb6c2c..363175d3325c012f31ba84060bb0bfac694f6ab8 100644 --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java -@@ -710,7 +710,7 @@ public class ServerPlayer extends net.minecraft.world.entity.player.Player { +@@ -938,7 +938,7 @@ public class ServerPlayer extends net.minecraft.world.entity.player.Player { containerUpdateDelay = this.level().paperConfig().tickRates.containerUpdate; } // Paper end - Configurable container update tick rate @@ -17,7 +17,7 @@ index f8d4bd18f98ed914e116d0cc4a80140e4e8d759f..7daa310dd5d3eb1befb9983ce85e0354 this.closeContainer(org.bukkit.event.inventory.InventoryCloseEvent.Reason.CANT_USE); // Paper - Inventory close reason this.containerMenu = this.inventoryMenu; } -@@ -1634,7 +1634,7 @@ public class ServerPlayer extends net.minecraft.world.entity.player.Player { +@@ -1903,7 +1903,7 @@ public class ServerPlayer extends net.minecraft.world.entity.player.Player { } else { // CraftBukkit start this.containerMenu = container; @@ -27,10 +27,10 @@ index f8d4bd18f98ed914e116d0cc4a80140e4e8d759f..7daa310dd5d3eb1befb9983ce85e0354 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 ee7cf7f1d491ffdf26c3f156d299e2f517a05608..ba63c58d40cb3b8655fdb8177c423c67ac7cc3ef 100644 +index 5ff159be1a6dfb4b1a5b9aa1e435d294f205215e..6ec6b80d224e2402054afb85b78c793942a58bbf 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java -@@ -334,7 +334,7 @@ public class CraftHumanEntity extends CraftLivingEntity implements HumanEntity { +@@ -335,7 +335,7 @@ public class CraftHumanEntity extends CraftLivingEntity implements HumanEntity { if (adventure$title == null) adventure$title = net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer.legacySection().deserialize(container.getBukkitView().getTitle()); // Paper //player.connection.send(new ClientboundOpenScreenPacket(container.containerId, windowType, CraftChatMessage.fromString(title)[0])); // Paper - comment @@ -39,7 +39,7 @@ index ee7cf7f1d491ffdf26c3f156d299e2f517a05608..ba63c58d40cb3b8655fdb8177c423c67 player.containerMenu = container; player.initMenu(container); } -@@ -409,7 +409,7 @@ public class CraftHumanEntity extends CraftLivingEntity implements HumanEntity { +@@ -410,7 +410,7 @@ public class CraftHumanEntity extends CraftLivingEntity implements HumanEntity { net.kyori.adventure.text.Component adventure$title = inventory.title(); // Paper if (adventure$title == null) adventure$title = net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer.legacySection().deserialize(inventory.getTitle()); // Paper //player.connection.send(new ClientboundOpenScreenPacket(container.containerId, windowType, CraftChatMessage.fromString(title)[0])); // Paper - comment diff --git a/patches/unapplied/server/0339-Don-t-run-entity-collision-code-if-not-needed.patch b/patches/server/0336-Don-t-run-entity-collision-code-if-not-needed.patch index 4e134e507c..43b1d500a9 100644 --- a/patches/unapplied/server/0339-Don-t-run-entity-collision-code-if-not-needed.patch +++ b/patches/server/0336-Don-t-run-entity-collision-code-if-not-needed.patch @@ -12,11 +12,11 @@ The entity's current team collision rule causes them to NEVER collide. Co-authored-by: Owen1212055 <[email protected]> diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java -index 4c32b26e29ca3db0a2f62052e14bcc3e4c1cdea5..cf18f17f181bc94a2b5f4ac6926c2388ec3178c8 100644 +index 304a401fb1f378ff2cbfd888acf56a8516f79310..6ff464fef1f79cff9212135a30adcc6cb8792ed6 100644 --- a/src/main/java/net/minecraft/world/entity/LivingEntity.java +++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java -@@ -3544,10 +3544,24 @@ public abstract class LivingEntity extends Entity implements Attackable { - if (this.level().isClientSide()) { +@@ -3683,10 +3683,24 @@ public abstract class LivingEntity extends Entity implements Attackable { + if (!(world instanceof ServerLevel worldserver)) { 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 @@ -33,10 +33,10 @@ index 4c32b26e29ca3db0a2f62052e14bcc3e4c1cdea5..cf18f17f181bc94a2b5f4ac6926c2388 + return; + } + // Paper end - don't run getEntities if we're not going to use its result - List<Entity> 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 = worldserver.getGameRules().getInt(GameRules.RULE_MAX_ENTITY_CRAMMING); + // Paper - don't run getEntities if we're not going to use its result; moved up if (i > 0 && list.size() > i - 1 && this.random.nextInt(4) == 0) { diff --git a/patches/unapplied/server/0340-Implement-Player-Client-Options-API.patch b/patches/server/0337-Implement-Player-Client-Options-API.patch index d190884bb0..943a64b447 100644 --- a/patches/unapplied/server/0340-Implement-Player-Client-Options-API.patch +++ b/patches/server/0337-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 7daa310dd5d3eb1befb9983ce85e0354771af71d..8938f90c53de8aef71aa70522a66a69edb467e73 100644 +index 363175d3325c012f31ba84060bb0bfac694f6ab8..9911e231ad021286f2da90057b06874f7b4e3b4d 100644 --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java -@@ -359,7 +359,7 @@ public class ServerPlayer extends net.minecraft.world.entity.player.Player { +@@ -420,7 +420,7 @@ public class ServerPlayer extends net.minecraft.world.entity.player.Player { this.stats = server.getPlayerList().getPlayerStats(this); this.advancements = server.getPlayerList().getPlayerAdvancements(this); // this.moveTo(this.adjustSpawnLocation(world, world.getSharedSpawnPos()).getBottomCenter(), 0.0F, 0.0F); // Paper - Don't move existing players to world spawn @@ -99,7 +99,7 @@ index 7daa310dd5d3eb1befb9983ce85e0354771af71d..8938f90c53de8aef71aa70522a66a69e this.object = null; // CraftBukkit start -@@ -2146,7 +2146,23 @@ public class ServerPlayer extends net.minecraft.world.entity.player.Player { +@@ -2404,7 +2404,23 @@ public class ServerPlayer extends net.minecraft.world.entity.player.Player { } } @@ -123,7 +123,7 @@ index 7daa310dd5d3eb1befb9983ce85e0354771af71d..8938f90c53de8aef71aa70522a66a69e // CraftBukkit start if (this.getMainArm() != clientOptions.mainHand()) { PlayerChangedMainHandEvent event = new PlayerChangedMainHandEvent(this.getBukkitEntity(), this.getMainArm() == HumanoidArm.LEFT ? MainHand.LEFT : MainHand.RIGHT); -@@ -2157,6 +2173,11 @@ public class ServerPlayer extends net.minecraft.world.entity.player.Player { +@@ -2415,6 +2431,11 @@ public class ServerPlayer extends net.minecraft.world.entity.player.Player { this.server.server.getPluginManager().callEvent(event); } // CraftBukkit end @@ -136,10 +136,10 @@ index 7daa310dd5d3eb1befb9983ce85e0354771af71d..8938f90c53de8aef71aa70522a66a69e this.adventure$locale = java.util.Objects.requireNonNullElse(net.kyori.adventure.translation.Translator.parseLocale(this.language), java.util.Locale.US); // Paper this.requestedViewDistance = clientOptions.viewDistance(); diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -index 1959e2af13daa06293c10ea2a4f68e319fac26ad..068ff2c228308ec87fcc6d1352bd63b91bd34a93 100644 +index df99bc022b25e61dc8827c67fb4eb2909bba097f..f836a65db1028b51ebd425251ca37e0c439d4ad6 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -@@ -653,6 +653,28 @@ public class CraftPlayer extends CraftHumanEntity implements Player { +@@ -666,6 +666,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/0341-Don-t-crash-if-player-is-attempted-to-be-removed-fro.patch b/patches/server/0338-Don-t-crash-if-player-is-attempted-to-be-removed-fro.patch index 9d20799a09..0db5556d5a 100644 --- a/patches/unapplied/server/0341-Don-t-crash-if-player-is-attempted-to-be-removed-fro.patch +++ b/patches/server/0338-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 dfa0456f352ce25bc4edd1b0f04ca5a14434d7fa..1e7b440cc2c1bf53210069b38286f67a7b97041b 100644 +index 6c2339d6a93172e25040c4868a3a47473a1f5336..f7c2c03749d6be25bf33afd61e1da120770b3432 100644 --- a/src/main/java/net/minecraft/server/level/DistanceManager.java +++ b/src/main/java/net/minecraft/server/level/DistanceManager.java -@@ -275,8 +275,8 @@ public abstract class DistanceManager { +@@ -281,8 +281,8 @@ public abstract class DistanceManager { ObjectSet<ServerPlayer> objectset = (ObjectSet) this.playersPerChunk.get(i); if (objectset == null) return; // CraftBukkit - SPIGOT-6208 diff --git a/patches/unapplied/server/0342-Fire-PlayerJoinEvent-when-Player-is-actually-ready.patch b/patches/server/0339-Fire-PlayerJoinEvent-when-Player-is-actually-ready.patch index fda85df8ca..7d3cdd3d1c 100644 --- a/patches/unapplied/server/0342-Fire-PlayerJoinEvent-when-Player-is-actually-ready.patch +++ b/patches/server/0339-Fire-PlayerJoinEvent-when-Player-is-actually-ready.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 8206ec366b429858d9582e437781191e5aa0fa02..d91279f3bd009e1542e73354aadd6a16c80965e2 100644 +index f3b99cd96672363e0d60e56b744f0bea8fa00c3f..8121f7f5fb4dadb1c929b3d81121e3649981bfac 100644 --- a/src/main/java/net/minecraft/server/level/ChunkMap.java +++ b/src/main/java/net/minecraft/server/level/ChunkMap.java -@@ -1248,6 +1248,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -1307,6 +1307,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider return; } // Paper end - ignore and warn about illegal addEntity calls instead of crashing server @@ -43,10 +43,10 @@ index 8206ec366b429858d9582e437781191e5aa0fa02..d91279f3bd009e1542e73354aadd6a16 EntityType<?> entitytypes = entity.getType(); int i = entitytypes.clientTrackingRange() * 16; diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java -index 8938f90c53de8aef71aa70522a66a69edb467e73..e6e7dc17d1196a8211a565355f34b5dcfd478852 100644 +index 9911e231ad021286f2da90057b06874f7b4e3b4d..807068fc6065f71961d34cb4f18b6eb39ae49637 100644 --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java -@@ -289,6 +289,7 @@ public class ServerPlayer extends net.minecraft.world.entity.player.Player { +@@ -317,6 +317,7 @@ public class ServerPlayer extends net.minecraft.world.entity.player.Player { public double maxHealthCache; public boolean joining = true; public boolean sentListPacket = false; @@ -55,10 +55,10 @@ index 8938f90c53de8aef71aa70522a66a69edb467e73..e6e7dc17d1196a8211a565355f34b5dc // 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 2cbdcdf0349e7efa797802d0d339d158153690af..5390ce62ec8afd24d2e028ea04d2ef3029a125f9 100644 +index 074f3518b060c4aa079b1d311b7fcb10d4a95981..ec5673ff22706006a2bcfb5f5a9e8840ee27ac45 100644 --- a/src/main/java/net/minecraft/server/players/PlayerList.java +++ b/src/main/java/net/minecraft/server/players/PlayerList.java -@@ -297,6 +297,12 @@ public abstract class PlayerList { +@@ -300,6 +300,13 @@ public abstract class PlayerList { this.playersByUUID.put(player.getUUID(), player); // this.broadcastAll(ClientboundPlayerInfoUpdatePacket.createPlayerInitializing(List.of(entityplayer))); // CraftBukkit - replaced with loop below @@ -66,12 +66,13 @@ index 2cbdcdf0349e7efa797802d0d339d158153690af..5390ce62ec8afd24d2e028ea04d2ef30 + player.supressTrackerForLogin = true; + worldserver1.addNewPlayer(player); + this.server.getCustomBossEvents().onPlayerConnect(player); // see commented out section below worldserver.addPlayerJoin(entityplayer); -+ this.mountSavedVehicle(player, worldserver1, optional); ++ player.loadAndSpawnEnderpearls(optional); ++ player.loadAndSpawnParentVehicle(optional); + // Paper end - Fire PlayerJoinEvent when Player is actually ready // CraftBukkit start CraftPlayer bukkitPlayer = player.getBukkitEntity(); -@@ -335,6 +341,8 @@ public abstract class PlayerList { +@@ -338,6 +345,8 @@ public abstract class PlayerList { player.connection.send(ClientboundPlayerInfoUpdatePacket.createPlayerInitializing(List.of(entityplayer1))); } player.sentListPacket = true; @@ -80,26 +81,13 @@ index 2cbdcdf0349e7efa797802d0d339d158153690af..5390ce62ec8afd24d2e028ea04d2ef30 // CraftBukkit end player.refreshEntityData(player); // CraftBukkit - BungeeCord#2321, send complete data to self on spawn -@@ -350,6 +358,11 @@ public abstract class PlayerList { +@@ -353,8 +362,7 @@ public abstract class PlayerList { worldserver1 = player.serverLevel(); // CraftBukkit - Update in case join event changed it // CraftBukkit end this.sendActivePlayerEffects(player); -+ // Paper start - Fire PlayerJoinEvent when Player is actually ready; move vehicle into method so it can be called above - short circuit around that code -+ this.onPlayerJoinFinish(player, worldserver1, s1); -+ } -+ private void mountSavedVehicle(ServerPlayer player, ServerLevel worldserver1, Optional<CompoundTag> optional) { -+ // Paper end - Fire PlayerJoinEvent when Player is actually ready - if (optional.isPresent() && ((CompoundTag) optional.get()).contains("RootVehicle", 10)) { - CompoundTag nbttagcompound = ((CompoundTag) optional.get()).getCompound("RootVehicle"); - ServerLevel finalWorldServer = worldserver1; // CraftBukkit - decompile error -@@ -396,6 +409,10 @@ public abstract class PlayerList { - } - } - -+ // Paper start - Fire PlayerJoinEvent when Player is actually ready -+ } -+ public void onPlayerJoinFinish(ServerPlayer player, ServerLevel worldserver1, String s1) { -+ // Paper end - Fire PlayerJoinEvent when Player is actually ready +- player.loadAndSpawnEnderpearls(optional); +- player.loadAndSpawnParentVehicle(optional); ++ // Paper - move loading pearls / parent vehicle up player.initInventoryMenu(); // CraftBukkit - Moved from above, added world // Paper start - Configurable player collision; Add to collideRule team if needed diff --git a/patches/unapplied/server/0343-Move-player-to-spawn-point-if-spawn-in-unloaded-worl.patch b/patches/server/0340-Move-player-to-spawn-point-if-spawn-in-unloaded-worl.patch index b739652ade..270260266e 100644 --- a/patches/unapplied/server/0343-Move-player-to-spawn-point-if-spawn-in-unloaded-worl.patch +++ b/patches/server/0340-Move-player-to-spawn-point-if-spawn-in-unloaded-worl.patch @@ -10,10 +10,10 @@ Co-authored-by: Wyatt Childers <[email protected]> Co-authored-by: Jake Potrebic <[email protected]> diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java -index 5390ce62ec8afd24d2e028ea04d2ef3029a125f9..6f587c4bb4704d93552ba61335d87b1852fc169c 100644 +index ec5673ff22706006a2bcfb5f5a9e8840ee27ac45..c8c27311ade7d4a70d5398b3a4cb50eedd02a2f9 100644 --- a/src/main/java/net/minecraft/server/players/PlayerList.java +++ b/src/main/java/net/minecraft/server/players/PlayerList.java -@@ -197,6 +197,7 @@ public abstract class PlayerList { +@@ -198,6 +198,7 @@ public abstract class PlayerList { } Optional<CompoundTag> optional = this.load(player); // CraftBukkit - decompile error @@ -21,7 +21,7 @@ index 5390ce62ec8afd24d2e028ea04d2ef3029a125f9..6f587c4bb4704d93552ba61335d87b18 // CraftBukkit start - Better rename detection if (optional.isPresent()) { CompoundTag nbttagcompound = optional.get(); -@@ -206,19 +207,47 @@ public abstract class PlayerList { +@@ -207,19 +208,47 @@ public abstract class PlayerList { } } // CraftBukkit end @@ -72,7 +72,7 @@ index 5390ce62ec8afd24d2e028ea04d2ef3029a125f9..6f587c4bb4704d93552ba61335d87b18 } else { worldserver1 = worldserver; } -@@ -226,6 +255,10 @@ public abstract class PlayerList { +@@ -227,6 +256,10 @@ public abstract class PlayerList { // Paper start - Entity#getEntitySpawnReason if (optional.isEmpty()) { player.spawnReason = org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.DEFAULT; // set Player SpawnReason to DEFAULT on first login @@ -84,10 +84,10 @@ index 5390ce62ec8afd24d2e028ea04d2ef3029a125f9..6f587c4bb4704d93552ba61335d87b18 } // Paper end - Entity#getEntitySpawnReason diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java -index 94242c19740ae6ab2c86e3949bab6cee631b938f..d80fd4e2f41583f83c9527ccf4ce80afe851276a 100644 +index fa80b6220aba144521dc0a2a35914c10046c1963..5b8e264098f1b713de15f714bae59d3efda365cf 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java -@@ -2385,27 +2385,8 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess +@@ -2502,27 +2502,8 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess } // CraftBukkit end diff --git a/patches/unapplied/server/0344-Add-PlayerAttackEntityCooldownResetEvent.patch b/patches/server/0341-Add-PlayerAttackEntityCooldownResetEvent.patch index 3348155d85..72ccb53f47 100644 --- a/patches/unapplied/server/0344-Add-PlayerAttackEntityCooldownResetEvent.patch +++ b/patches/server/0341-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 cf18f17f181bc94a2b5f4ac6926c2388ec3178c8..42c4adabe451cd32aa362075395a9fcc384ea788 100644 +index 6ff464fef1f79cff9212135a30adcc6cb8792ed6..68e5f6f7013d6a014b9014d945cf3f7dc7a37cb2 100644 --- a/src/main/java/net/minecraft/world/entity/LivingEntity.java +++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java -@@ -2277,7 +2277,17 @@ public abstract class LivingEntity extends Entity implements Attackable { +@@ -2354,7 +2354,17 @@ public abstract class LivingEntity extends Entity implements Attackable { } if (damagesource.getEntity() instanceof net.minecraft.world.entity.player.Player) { diff --git a/patches/unapplied/server/0345-Don-t-fire-BlockFade-on-worldgen-threads.patch b/patches/server/0342-Don-t-fire-BlockFade-on-worldgen-threads.patch index a909ceca12..cafa4896df 100644 --- a/patches/unapplied/server/0345-Don-t-fire-BlockFade-on-worldgen-threads.patch +++ b/patches/server/0342-Don-t-fire-BlockFade-on-worldgen-threads.patch @@ -5,17 +5,17 @@ Subject: [PATCH] Don't fire BlockFade on worldgen threads 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 c1111bd8065b53cb140e4289cb72985f03e6f549..9db6df5f28be559a324ead2fcfbe189eac076e2e 100644 +index f44457c0d75efe323cc8242ef5173a3d5067fad0..065d6164b5c9d65d20e7790c607d77e9ad70dfef 100644 --- a/src/main/java/net/minecraft/world/level/block/FireBlock.java +++ b/src/main/java/net/minecraft/world/level/block/FireBlock.java @@ -108,6 +108,7 @@ public class FireBlock extends BaseFireBlock { @Override - protected BlockState updateShape(BlockState state, Direction direction, BlockState neighborState, LevelAccessor world, BlockPos pos, BlockPos neighborPos) { + protected BlockState updateShape(BlockState state, LevelReader world, ScheduledTickAccess tickView, BlockPos pos, Direction direction, BlockPos neighborPos, BlockState neighborState, RandomSource random) { // CraftBukkit start + if (!(world instanceof ServerLevel)) return this.canSurvive(state, world, pos) ? (BlockState) this.getStateWithAge(world, pos, (Integer) state.getValue(FireBlock.AGE)) : Blocks.AIR.defaultBlockState(); // Paper - don't fire events in world generation if (!this.canSurvive(state, world, pos)) { // Suppress during worldgen - if (!(world instanceof Level)) { + if (!(world instanceof Level world1)) { @@ -123,7 +124,7 @@ public class FireBlock extends BaseFireBlock { return blockState.getHandle(); } diff --git a/patches/unapplied/server/0346-Add-phantom-creative-and-insomniac-controls.patch b/patches/server/0343-Add-phantom-creative-and-insomniac-controls.patch index 0eea572994..eed8a10b78 100644 --- a/patches/unapplied/server/0346-Add-phantom-creative-and-insomniac-controls.patch +++ b/patches/server/0343-Add-phantom-creative-and-insomniac-controls.patch @@ -5,31 +5,31 @@ 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 f7014bf5faae03a04c31cbdaeb27188c47156c2d..eb425fac573881f3aad09ae75a32184fb0e325a6 100644 +index 3a4c1d4afddd7d8d1f43554a7a08855686cadf56..b8d57e25851dd7da905100dfd4022e4b99fd7f02 100644 --- a/src/main/java/net/minecraft/world/entity/EntitySelector.java +++ b/src/main/java/net/minecraft/world/entity/EntitySelector.java -@@ -28,6 +28,7 @@ public final class EntitySelector { - return !entity.isSpectator(); +@@ -27,6 +27,7 @@ public final class EntitySelector { }; public static final Predicate<Entity> CAN_BE_COLLIDED_WITH = EntitySelector.NO_SPECTATORS.and(Entity::canBeCollidedWith); + public static final Predicate<Entity> CAN_BE_PICKED = EntitySelector.NO_SPECTATORS.and(Entity::isPickable); + public static Predicate<Player> IS_INSOMNIAC = (player) -> net.minecraft.util.Mth.clamp(((net.minecraft.server.level.ServerPlayer) player).getStats().getValue(net.minecraft.stats.Stats.CUSTOM.get(net.minecraft.stats.Stats.TIME_SINCE_REST)), 1, Integer.MAX_VALUE) >= 72000; // Paper - Add phantom creative and insomniac controls private EntitySelector() {} // Paper start - Affects Spawning API 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 3c3f70d05fb51b530b792adf84c324840bd03c14..4b3bec32921feb1dcf71abf5e8d34fcbbc59baf5 100644 +index 748f07c7036fe5955d76e28c4e7d23f8c0235d5f..d0820b3a561db7e1e5667594b2b6ea13214dfa58 100644 --- a/src/main/java/net/minecraft/world/entity/monster/Phantom.java +++ b/src/main/java/net/minecraft/world/entity/monster/Phantom.java -@@ -549,6 +549,7 @@ public class Phantom extends FlyingMob implements Enemy { +@@ -550,6 +550,7 @@ public class Phantom extends FlyingMob implements Enemy { Player entityhuman = (Player) iterator.next(); - if (Phantom.this.canAttack(entityhuman, TargetingConditions.DEFAULT)) { + if (Phantom.this.canAttack(worldserver, entityhuman, TargetingConditions.DEFAULT)) { + if (!level().paperConfig().entities.behavior.phantomsOnlyAttackInsomniacs || EntitySelector.IS_INSOMNIAC.test(entityhuman)) // Paper - Add phantom creative and insomniac controls Phantom.this.setTarget(entityhuman, org.bukkit.event.entity.EntityTargetEvent.TargetReason.CLOSEST_PLAYER, true); // CraftBukkit - reason 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 bb7f2d3ff7fc6f5cadb4ab24efb5a3a2f5bdc33f..f74d41e57570a40cd5ce4da3076f3210b6594a63 100644 +index 499b124f905ffa8e375efa354a3f2240997ddea5..7d407a7597f3ae576ac7e94bc2eb96d9dcd78dd3 100644 --- a/src/main/java/net/minecraft/world/level/levelgen/PhantomSpawner.java +++ b/src/main/java/net/minecraft/world/level/levelgen/PhantomSpawner.java @@ -48,7 +48,7 @@ public class PhantomSpawner implements CustomSpawner { diff --git a/patches/unapplied/server/0347-Fix-item-duplication-and-teleport-issues.patch b/patches/server/0344-Fix-item-duplication-and-teleport-issues.patch index 86f3c094a3..1e7965da69 100644 --- a/patches/unapplied/server/0347-Fix-item-duplication-and-teleport-issues.patch +++ b/patches/server/0344-Fix-item-duplication-and-teleport-issues.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 d80fd4e2f41583f83c9527ccf4ce80afe851276a..10015beb7a2de890fe27bffde8f55c1dd78ce344 100644 +index 5b8e264098f1b713de15f714bae59d3efda365cf..4faba83eb73e0d313e9131794962b727f7628a50 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java -@@ -2515,11 +2515,12 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess +@@ -2630,11 +2630,12 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess } else { // CraftBukkit start - Capture drops for death event if (this instanceof net.minecraft.world.entity.LivingEntity && !((net.minecraft.world.entity.LivingEntity) this).forceDrops) { @@ -28,14 +28,13 @@ index d80fd4e2f41583f83c9527ccf4ce80afe851276a..10015beb7a2de890fe27bffde8f55c1d 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 - copy so we can destroy original + ItemEntity entityitem = new ItemEntity(world, this.getX(), this.getY() + (double) yOffset, this.getZ(), stack); + stack.setCount(0); // Paper - destroy this item - if this ever leaks due to game bugs, ensure it doesn't dupe entityitem.setDefaultPickUpDelay(); // CraftBukkit start -@@ -3335,6 +3336,12 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess - public Entity changeDimension(DimensionTransition teleportTarget) { +@@ -3462,6 +3463,12 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess + public Entity teleport(TeleportTransition teleportTarget) { Level world = this.level(); + // Paper start - Fix item duplication and teleport issues @@ -47,32 +46,31 @@ index d80fd4e2f41583f83c9527ccf4ce80afe851276a..10015beb7a2de890fe27bffde8f55c1d if (world instanceof ServerLevel worldserver) { if (!this.isRemoved()) { // CraftBukkit start -@@ -3377,6 +3384,11 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess - - if (entity2 != null) { - if (this != entity2) { -+ // Paper start - Fix item duplication and teleport issues -+ if (this instanceof Leashable leashable) { -+ leashable.dropLeash(true, true); // Paper drop lead -+ } -+ // Paper end - Fix item duplication and teleport issues - entity2.restoreFrom(this); - this.removeAfterChangingDimensions(); - // CraftBukkit start - Forward the CraftEntity to the new entity -@@ -3452,7 +3464,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess +@@ -3550,6 +3557,11 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess + gameprofilerfiller.pop(); + return null; + } else { ++ // Paper start - Fix item duplication and teleport issues ++ if (this instanceof Leashable leashable) { ++ leashable.dropLeash(true, true); // Paper drop lead ++ } ++ // Paper end - Fix item duplication and teleport issues + entity.restoreFrom(this); + this.removeAfterChangingDimensions(); + // CraftBukkit start - Forward the CraftEntity to the new entity +@@ -3662,6 +3674,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess } - public boolean canChangeDimensions(Level from, Level to) { -- return true; -+ return this.isAlive() && this.valid; // Paper - Fix item duplication and teleport issues - } + public boolean canTeleport(Level from, Level to) { ++ if (!this.isAlive() || !this.valid) return false; // Paper - Fix item duplication and teleport issues + if (from.dimension() == Level.END && to.dimension() == Level.OVERWORLD) { + Iterator iterator = this.getPassengers().iterator(); - 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 42c4adabe451cd32aa362075395a9fcc384ea788..8920099eb488c37b036b7bd97fbd4f7db505c77c 100644 +index 68e5f6f7013d6a014b9014d945cf3f7dc7a37cb2..65909e0a8f8b68f9a4dacefda9069c8263a96ada 100644 --- a/src/main/java/net/minecraft/world/entity/LivingEntity.java +++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java -@@ -1728,9 +1728,9 @@ public abstract class LivingEntity extends Entity implements Attackable { +@@ -1767,9 +1767,9 @@ public abstract class LivingEntity extends Entity implements Attackable { // Paper start org.bukkit.event.entity.EntityDeathEvent deathEvent = this.dropAllDeathLoot(worldserver, damageSource); if (deathEvent == null || !deathEvent.isCancelled()) { @@ -85,7 +83,7 @@ index 42c4adabe451cd32aa362075395a9fcc384ea788..8920099eb488c37b036b7bd97fbd4f7d // Paper start - clear equipment if event is not cancelled if (this instanceof Mob) { for (EquipmentSlot slot : this.clearedEquipmentSlots) { -@@ -1822,8 +1822,13 @@ public abstract class LivingEntity extends Entity implements Attackable { +@@ -1863,8 +1863,13 @@ public abstract class LivingEntity extends Entity implements Attackable { this.dropCustomDeathLoot(world, damageSource, flag); this.clearEquipmentSlots = prev; // Paper } @@ -102,10 +100,10 @@ index 42c4adabe451cd32aa362075395a9fcc384ea788..8920099eb488c37b036b7bd97fbd4f7d 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 92bb0c63330ad3a4cb13b2dc655020714e9b1ffd..cc1189c2d7dc57ba8f29aad4ba5d2a07362bcd5b 100644 +index e20565cf256aacd012a1722c5ebbf9016bc82e42..59fbfe8de2dc5ec020dd61a5e446b0b6f67d76e4 100644 --- a/src/main/java/net/minecraft/world/entity/decoration/ArmorStand.java +++ b/src/main/java/net/minecraft/world/entity/decoration/ArmorStand.java -@@ -635,7 +635,7 @@ public class ArmorStand extends LivingEntity { +@@ -633,7 +633,7 @@ public class ArmorStand extends LivingEntity { for (i = 0; i < this.handItems.size(); ++i) { itemstack = (ItemStack) this.handItems.get(i); if (!itemstack.isEmpty()) { @@ -114,7 +112,7 @@ index 92bb0c63330ad3a4cb13b2dc655020714e9b1ffd..cc1189c2d7dc57ba8f29aad4ba5d2a07 this.handItems.set(i, ItemStack.EMPTY); } } -@@ -643,7 +643,7 @@ public class ArmorStand extends LivingEntity { +@@ -641,7 +641,7 @@ public class ArmorStand extends LivingEntity { for (i = 0; i < this.armorItems.size(); ++i) { itemstack = (ItemStack) this.armorItems.get(i); if (!itemstack.isEmpty()) { @@ -124,10 +122,10 @@ index 92bb0c63330ad3a4cb13b2dc655020714e9b1ffd..cc1189c2d7dc57ba8f29aad4ba5d2a07 } } diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java -index 235ac5c12dab593da3a40e348a010ff626ce74a3..26f8a8cb18205bfb9fe9dc557097946987ddcb18 100644 +index 41f23ce732b6e90828b1bbda7f4b3470cd462c4a..0b9c96105bea9a0d1af17b7ecf4479d3596faa80 100644 --- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java +++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java -@@ -905,6 +905,11 @@ public class CraftEventFactory { +@@ -903,6 +903,11 @@ public class CraftEventFactory { } public static EntityDeathEvent callEntityDeathEvent(net.minecraft.world.entity.LivingEntity victim, DamageSource damageSource, List<org.bukkit.inventory.ItemStack> drops) { @@ -138,8 +136,8 @@ index 235ac5c12dab593da3a40e348a010ff626ce74a3..26f8a8cb18205bfb9fe9dc5570979469 + // Paper end CraftLivingEntity entity = (CraftLivingEntity) victim.getBukkitEntity(); CraftDamageSource bukkitDamageSource = new CraftDamageSource(damageSource); - EntityDeathEvent event = new EntityDeathEvent(entity, bukkitDamageSource, drops, victim.getExpReward(damageSource.getEntity())); -@@ -919,11 +924,13 @@ public class CraftEventFactory { + CraftWorld world = (CraftWorld) entity.getWorld(); +@@ -917,11 +922,13 @@ public class CraftEventFactory { playDeathSound(victim, event); // Paper end victim.expToDrop = event.getDroppedExp(); diff --git a/patches/unapplied/server/0348-Villager-Restocks-API.patch b/patches/server/0345-Villager-Restocks-API.patch index 1f7c26de9d..4ad766705c 100644 --- a/patches/unapplied/server/0348-Villager-Restocks-API.patch +++ b/patches/server/0345-Villager-Restocks-API.patch @@ -7,10 +7,10 @@ Subject: [PATCH] Villager Restocks API public net.minecraft.world.entity.npc.Villager numberOfRestocksToday diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftVillager.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftVillager.java -index 1b97755b42aaa6cc27b79f0b6369955e9a17c4d4..957c9ec21c7a9888b3038402b0111c68f816f968 100644 +index 1a7b666f9795e72022a60d14bfd405ae3165e292..ded319d10a5907b96abfd5620036b66a9aa3b3f7 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftVillager.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftVillager.java -@@ -89,6 +89,18 @@ public class CraftVillager extends CraftAbstractVillager implements Villager { +@@ -90,6 +90,18 @@ public class CraftVillager extends CraftAbstractVillager implements Villager { this.getHandle().setVillagerXp(experience); } diff --git a/patches/unapplied/server/0349-Validate-PickItem-Packet-and-kick-for-invalid.patch b/patches/server/0346-Validate-PickItem-Packet-and-kick-for-invalid.patch index 774f59a115..9f4314b9de 100644 --- a/patches/unapplied/server/0349-Validate-PickItem-Packet-and-kick-for-invalid.patch +++ b/patches/server/0346-Validate-PickItem-Packet-and-kick-for-invalid.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Validate PickItem Packet and kick for invalid diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index 0ed2d0f5ec9d107e8049aa9e803479ffd341639f..119b9b2c45e3321b4197f3e6a34037e3fa99622d 100644 +index 0b7e47418aa7a9891ee4a070430de6b2599f66e3..01dbc23369661e141ee81a2357f7b0b5602b56d5 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -@@ -895,7 +895,14 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl +@@ -899,7 +899,14 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl @Override public void handlePickItem(ServerboundPickItemPacket packet) { PacketUtils.ensureRunningOnSameThread(packet, this, this.player.serverLevel()); @@ -21,6 +21,6 @@ index 0ed2d0f5ec9d107e8049aa9e803479ffd341639f..119b9b2c45e3321b4197f3e6a34037e3 + } + this.player.getInventory().pickSlot(packet.getSlot()); // Paper - Diff above if changed + // Paper end - validate pick item position - this.player.connection.send(new ClientboundContainerSetSlotPacket(-2, 0, this.player.getInventory().selected, this.player.getInventory().getItem(this.player.getInventory().selected))); - this.player.connection.send(new ClientboundContainerSetSlotPacket(-2, 0, packet.getSlot(), this.player.getInventory().getItem(packet.getSlot()))); - this.player.connection.send(new ClientboundSetCarriedItemPacket(this.player.getInventory().selected)); + int i = this.player.getInventory().selected; + + this.player.connection.send(this.player.getInventory().createInventoryUpdatePacket(i)); diff --git a/patches/unapplied/server/0350-Set-cap-on-JDK-per-thread-native-byte-buffer-cache.patch b/patches/server/0347-Set-cap-on-JDK-per-thread-native-byte-buffer-cache.patch index 46f51a9f45..e325a1d810 100644 --- a/patches/unapplied/server/0350-Set-cap-on-JDK-per-thread-native-byte-buffer-cache.patch +++ b/patches/server/0347-Set-cap-on-JDK-per-thread-native-byte-buffer-cache.patch @@ -17,7 +17,7 @@ keeping long lived large direct buffers in cache. Set system properly at server startup if not set already to help protect from this. diff --git a/src/main/java/org/bukkit/craftbukkit/Main.java b/src/main/java/org/bukkit/craftbukkit/Main.java -index ed167d0d399924d54d9ff99c10ab8ee093efc149..168cbb239ac5d632908f2b0aca82cbcfdc35651f 100644 +index c618934b5cf66d9625c7be2ac114f1a1ca629d33..124aeebbbae7dc8cea1260bf3134a339c2e152ed 100644 --- a/src/main/java/org/bukkit/craftbukkit/Main.java +++ b/src/main/java/org/bukkit/craftbukkit/Main.java @@ -27,6 +27,7 @@ public class Main { diff --git a/patches/unapplied/server/0351-misc-debugging-dumps.patch b/patches/server/0348-misc-debugging-dumps.patch index b339217a99..6d514c8e38 100644 --- a/patches/unapplied/server/0351-misc-debugging-dumps.patch +++ b/patches/server/0348-misc-debugging-dumps.patch @@ -36,10 +36,10 @@ index 0000000000000000000000000000000000000000..479bb92d159f33c54c2d9c39d8a63aa9 + } +} diff --git a/src/main/java/net/minecraft/commands/Commands.java b/src/main/java/net/minecraft/commands/Commands.java -index e25fc35716aff1d1805884b18f67b0eb33d8c05c..8ca9ac8eff9d605baa878ca24e165ac5642bf160 100644 +index c847fbdb6f52386570eb4c070fcc01d39cc52151..a7eb2a37a81a414dcb19319c075faefe0382aeba 100644 --- a/src/main/java/net/minecraft/commands/Commands.java +++ b/src/main/java/net/minecraft/commands/Commands.java -@@ -340,7 +340,7 @@ public class Commands { +@@ -345,7 +345,7 @@ public class Commands { } catch (Exception exception) { MutableComponent ichatmutablecomponent = Component.literal(exception.getMessage() == null ? exception.getClass().getName() : exception.getMessage()); @@ -49,10 +49,10 @@ index e25fc35716aff1d1805884b18f67b0eb33d8c05c..8ca9ac8eff9d605baa878ca24e165ac5 StackTraceElement[] astacktraceelement = exception.getStackTrace(); diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index 53bb62c1dcb487be915759d22e06aea80be54f36..8b17df3d18fe9acc1a7b10c6809886da0143f8c5 100644 +index 708552756a33339ce9eefe48c9999a2ec08f7e1c..a08cebda577223184af8b42a90eb3559e419438e 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java -@@ -915,6 +915,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa +@@ -931,6 +931,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa // CraftBukkit start private boolean hasStopped = false; @@ -60,7 +60,7 @@ index 53bb62c1dcb487be915759d22e06aea80be54f36..8b17df3d18fe9acc1a7b10c6809886da private final Object stopLock = new Object(); public final boolean hasStopped() { synchronized (this.stopLock) { -@@ -929,6 +930,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa +@@ -945,6 +946,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa if (this.hasStopped) return; this.hasStopped = true; } @@ -68,7 +68,7 @@ index 53bb62c1dcb487be915759d22e06aea80be54f36..8b17df3d18fe9acc1a7b10c6809886da // CraftBukkit end if (this.metricsRecorder.isRecording()) { this.cancelRecordingMetrics(); -@@ -1033,6 +1035,8 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa +@@ -1049,6 +1051,8 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa } public void safeShutdown(boolean waitForShutdown, boolean isRestarting) { this.isRestarting = isRestarting; @@ -105,10 +105,10 @@ index 5457358bc76889153036818fdfd70a043ec4e40f..880e5c52746e9e3a9a1f42ec6461be54 this.connection.disconnect(ServerConfigurationPacketListenerImpl.DISCONNECT_REASON_INVALID_DATA); } diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -index 7226c506c902fc94f27cc5d444e25882138759c2..75ea1d68c4be6f73ad05cd53b4e4c0182832395c 100644 +index f5b0aa5ee92b24fd53d83eb45df1a5dece10733f..0d36eb7ae9d07d51449a4a15a6474c3f4befec94 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -@@ -1049,6 +1049,7 @@ public final class CraftServer implements Server { +@@ -1052,6 +1052,7 @@ public final class CraftServer implements Server { plugin.getDescription().getFullName(), "This plugin is not properly shutting down its async tasks when it is being reloaded. This may cause conflicts with the newly loaded version of the plugin" )); diff --git a/patches/unapplied/server/0352-Prevent-teleporting-dead-entities.patch b/patches/server/0349-Prevent-teleporting-dead-entities.patch index 361f87db56..dffc392392 100644 --- a/patches/unapplied/server/0352-Prevent-teleporting-dead-entities.patch +++ b/patches/server/0349-Prevent-teleporting-dead-entities.patch @@ -5,13 +5,13 @@ Subject: [PATCH] Prevent teleporting dead entities diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index 119b9b2c45e3321b4197f3e6a34037e3fa99622d..c6bcde25b476ef2362f469bd7cba82ce97cb300c 100644 +index 01dbc23369661e141ee81a2357f7b0b5602b56d5..7b8aaf763020cf7be7114f329f22af75f7a80ef0 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -@@ -1552,6 +1552,13 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl +@@ -1564,6 +1564,13 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl } - public void internalTeleport(double d0, double d1, double d2, float f, float f1, Set<RelativeMovement> set) { // Paper + public void internalTeleport(PositionMoveRotation positionmoverotation, Set<Relative> set) { + // Paper start - Prevent teleporting dead entities + if (player.isRemoved()) { + LOGGER.info("Attempt to teleport removed player {} restricted", player.getScoreboardName()); @@ -19,6 +19,6 @@ index 119b9b2c45e3321b4197f3e6a34037e3fa99622d..c6bcde25b476ef2362f469bd7cba82ce + return; + } + // Paper end - Prevent teleporting dead entities - // CraftBukkit start - if (Float.isNaN(f)) { - f = 0; + if (Float.isNaN(positionmoverotation.yRot())) { + positionmoverotation = new PositionMoveRotation(positionmoverotation.position(), positionmoverotation.deltaMovement(), 0, positionmoverotation.xRot()); + } |