diff options
Diffstat (limited to 'patches/server')
27 files changed, 117 insertions, 130 deletions
diff --git a/patches/server/0018-Rewrite-chunk-system.patch b/patches/server/0018-Rewrite-chunk-system.patch index 2cf88b6a96..12fb0fd161 100644 --- a/patches/server/0018-Rewrite-chunk-system.patch +++ b/patches/server/0018-Rewrite-chunk-system.patch @@ -19532,7 +19532,7 @@ index 5cd680d2ed47aadb5e65a775d70bc662a92e3d7a..1ad6b62ee53e2ee4a710211dfc750780 } diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java -index e2990302d932a5dc089a25e831e11ac6468f6381..9969b66e39fb6ce8a9ba24ccbd7ef5d3e363197f 100644 +index 3851c1026b91b77a02dbb5df1a1eedb212ac2a06..0653b5abc89d0c5a54566e3e518cfd29db076b86 100644 --- a/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java @@ -196,7 +196,7 @@ public class ServerLevel extends Level implements WorldGenLevel { @@ -19988,7 +19988,7 @@ index e2990302d932a5dc089a25e831e11ac6468f6381..9969b66e39fb6ce8a9ba24ccbd7ef5d3 return false; } else { this.addFreshEntityWithPassengers(entity, reason); // CraftBukkit -@@ -1736,7 +1970,7 @@ public class ServerLevel extends Level implements WorldGenLevel { +@@ -1746,7 +1980,7 @@ public class ServerLevel extends Level implements WorldGenLevel { } } @@ -19997,7 +19997,7 @@ index e2990302d932a5dc089a25e831e11ac6468f6381..9969b66e39fb6ce8a9ba24ccbd7ef5d3 bufferedwriter.write(String.format(Locale.ROOT, "block_entity_tickers: %d\n", this.blockEntityTickers.size())); bufferedwriter.write(String.format(Locale.ROOT, "block_ticks: %d\n", this.getBlockTicks().count())); bufferedwriter.write(String.format(Locale.ROOT, "fluid_ticks: %d\n", this.getFluidTicks().count())); -@@ -1785,7 +2019,7 @@ public class ServerLevel extends Level implements WorldGenLevel { +@@ -1795,7 +2029,7 @@ public class ServerLevel extends Level implements WorldGenLevel { BufferedWriter bufferedwriter2 = Files.newBufferedWriter(path1); try { @@ -20006,7 +20006,7 @@ index e2990302d932a5dc089a25e831e11ac6468f6381..9969b66e39fb6ce8a9ba24ccbd7ef5d3 } catch (Throwable throwable4) { if (bufferedwriter2 != null) { try { -@@ -1806,7 +2040,7 @@ public class ServerLevel extends Level implements WorldGenLevel { +@@ -1816,7 +2050,7 @@ public class ServerLevel extends Level implements WorldGenLevel { BufferedWriter bufferedwriter3 = Files.newBufferedWriter(path2); try { @@ -20015,7 +20015,7 @@ index e2990302d932a5dc089a25e831e11ac6468f6381..9969b66e39fb6ce8a9ba24ccbd7ef5d3 } catch (Throwable throwable6) { if (bufferedwriter3 != null) { try { -@@ -1948,7 +2182,7 @@ public class ServerLevel extends Level implements WorldGenLevel { +@@ -1958,7 +2192,7 @@ public class ServerLevel extends Level implements WorldGenLevel { @VisibleForTesting public String getWatchdogStats() { @@ -20024,7 +20024,7 @@ index e2990302d932a5dc089a25e831e11ac6468f6381..9969b66e39fb6ce8a9ba24ccbd7ef5d3 return BuiltInRegistries.ENTITY_TYPE.getKey(entity.getType()).toString(); }), this.blockEntityTickers.size(), ServerLevel.getTypeCount(this.blockEntityTickers, TickingBlockEntity::getType), this.getBlockTicks().count(), this.getFluidTicks().count(), this.gatherChunkSourceStats()); } -@@ -2008,15 +2242,15 @@ public class ServerLevel extends Level implements WorldGenLevel { +@@ -2018,15 +2252,15 @@ public class ServerLevel extends Level implements WorldGenLevel { @Override public LevelEntityGetter<Entity> getEntities() { org.spigotmc.AsyncCatcher.catchOp("Chunk getEntities call"); // Spigot @@ -20045,7 +20045,7 @@ index e2990302d932a5dc089a25e831e11ac6468f6381..9969b66e39fb6ce8a9ba24ccbd7ef5d3 } public void startTickingChunk(LevelChunk chunk) { -@@ -2032,34 +2266,49 @@ public class ServerLevel extends Level implements WorldGenLevel { +@@ -2042,34 +2276,49 @@ public class ServerLevel extends Level implements WorldGenLevel { @Override public void close() throws IOException { super.close(); @@ -20102,7 +20102,7 @@ index e2990302d932a5dc089a25e831e11ac6468f6381..9969b66e39fb6ce8a9ba24ccbd7ef5d3 } @Override -@@ -2080,7 +2329,7 @@ public class ServerLevel extends Level implements WorldGenLevel { +@@ -2090,7 +2339,7 @@ public class ServerLevel extends Level implements WorldGenLevel { CrashReportCategory crashreportsystemdetails = super.fillReportDetails(report); crashreportsystemdetails.setDetail("Loaded entity count", () -> { diff --git a/patches/server/0033-Entity-Origin-API.patch b/patches/server/0033-Entity-Origin-API.patch index ab8af63f25..fa02bcb7cc 100644 --- a/patches/server/0033-Entity-Origin-API.patch +++ b/patches/server/0033-Entity-Origin-API.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Entity Origin API diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java -index 9969b66e39fb6ce8a9ba24ccbd7ef5d3e363197f..363f94a2fb54b7a55f392cc65a6e4d68f313fb07 100644 +index 0653b5abc89d0c5a54566e3e518cfd29db076b86..bc2111031f277dc27b8ae673259a10999df1ec43 100644 --- a/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java -@@ -2389,6 +2389,15 @@ public class ServerLevel extends Level implements WorldGenLevel { +@@ -2399,6 +2399,15 @@ public class ServerLevel extends Level implements WorldGenLevel { entity.updateDynamicGameEventListener(DynamicGameEventListener::add); entity.inWorld = true; // CraftBukkit - Mark entity as in world entity.valid = true; // CraftBukkit diff --git a/patches/server/0078-Entity-AddTo-RemoveFrom-World-Events.patch b/patches/server/0078-Entity-AddTo-RemoveFrom-World-Events.patch index 93df9d4794..ff9af7572e 100644 --- a/patches/server/0078-Entity-AddTo-RemoveFrom-World-Events.patch +++ b/patches/server/0078-Entity-AddTo-RemoveFrom-World-Events.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Entity AddTo/RemoveFrom World Events diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java -index f9e9348a897d8f8bd5eb5bd951c6e2416e73562d..16abfc81d054cdc983500d3e498533ea8e8cc0be 100644 +index 9ac9f250d2f9b29ce520da93a9398113b2ff3e50..0523b0e70c10f7f02551be90cd02b6d8dabde673 100644 --- a/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java -@@ -2401,6 +2401,7 @@ public class ServerLevel extends Level implements WorldGenLevel { +@@ -2411,6 +2411,7 @@ public class ServerLevel extends Level implements WorldGenLevel { entity.setOrigin(entity.getOriginVector().toLocation(getWorld())); } // Paper end @@ -16,7 +16,7 @@ index f9e9348a897d8f8bd5eb5bd951c6e2416e73562d..16abfc81d054cdc983500d3e498533ea } public void onTrackingEnd(Entity entity) { -@@ -2476,6 +2477,7 @@ public class ServerLevel extends Level implements WorldGenLevel { +@@ -2486,6 +2487,7 @@ public class ServerLevel extends Level implements WorldGenLevel { } } // CraftBukkit end diff --git a/patches/server/0094-Improve-Maps-in-item-frames-performance-and-bug-fixe.patch b/patches/server/0094-Improve-Maps-in-item-frames-performance-and-bug-fixe.patch index 9dfde61df8..50da6bac6e 100644 --- a/patches/server/0094-Improve-Maps-in-item-frames-performance-and-bug-fixe.patch +++ b/patches/server/0094-Improve-Maps-in-item-frames-performance-and-bug-fixe.patch @@ -13,10 +13,10 @@ custom renderers are in use, defaulting to the much simpler Vanilla system. Additionally, numerous issues to player position tracking on maps has been fixed. diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java -index 6baf4caafbb4f7a09fe3a806bbff17c9f6105fbd..97554ab72743cf2b8e87c7f3c35579f669c2308a 100644 +index 4d89f0c8ba1454aedb759c367009ec25931b66d5..cc3a34afddac429b1ce75e54fdb284d7683a4310 100644 --- a/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java -@@ -2422,6 +2422,7 @@ public class ServerLevel extends Level implements WorldGenLevel { +@@ -2432,6 +2432,7 @@ public class ServerLevel extends Level implements WorldGenLevel { { if ( iter.next().player == entity ) { diff --git a/patches/server/0123-PlayerTeleportEndGatewayEvent.patch b/patches/server/0123-PlayerTeleportEndGatewayEvent.patch index ff8a910755..27a0ab6805 100644 --- a/patches/server/0123-PlayerTeleportEndGatewayEvent.patch +++ b/patches/server/0123-PlayerTeleportEndGatewayEvent.patch @@ -7,11 +7,11 @@ Allows you to access the Gateway being used in a teleport event Fix the offset used for player teleportation diff --git a/src/main/java/net/minecraft/world/level/block/entity/TheEndGatewayBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/TheEndGatewayBlockEntity.java -index 97c57619ebcf31f17f8430ffb68043771d1377f9..020314dded2c6305bd5e9013b108bc74be25ccc1 100644 +index 8e63135d42d1a06cc7741e33eb3e057321ea53bc..8ae723c6500bb92f937a27730c2a5ec912247c0a 100644 --- a/src/main/java/net/minecraft/world/level/block/entity/TheEndGatewayBlockEntity.java +++ b/src/main/java/net/minecraft/world/level/block/entity/TheEndGatewayBlockEntity.java @@ -207,11 +207,11 @@ public class TheEndGatewayBlockEntity extends TheEndPortalBlockEntity { - // CraftBukkit start - Fire PlayerTeleportEvent + // CraftBukkit start - Fire PlayerTeleportEvent/EntityTeleportEvent if (entity1 instanceof ServerPlayer) { org.bukkit.craftbukkit.entity.CraftPlayer player = (CraftPlayer) entity1.getBukkitEntity(); - org.bukkit.Location location = CraftLocation.toBukkit(blockposition1, world.getWorld()).add(0.5D, 0.5D, 0.5D); @@ -24,12 +24,12 @@ index 97c57619ebcf31f17f8430ffb68043771d1377f9..020314dded2c6305bd5e9013b108bc74 Bukkit.getPluginManager().callEvent(teleEvent); if (teleEvent.isCancelled()) { return; -@@ -226,7 +226,7 @@ public class TheEndGatewayBlockEntity extends TheEndPortalBlockEntity { - // CraftBukkit end +@@ -224,7 +224,7 @@ public class TheEndGatewayBlockEntity extends TheEndPortalBlockEntity { - entity1.setPortalCooldown(); -- entity1.teleportToWithTicket((double) blockposition1.getX() + 0.5D, (double) blockposition1.getY(), (double) blockposition1.getZ() + 0.5D); -+ entity1.teleportToWithTicket((double) blockposition1.getX() + 0.5D, (double) blockposition1.getY(), (double) blockposition1.getZ() + 0.5D); // Paper - diff on change - } + } - TheEndGatewayBlockEntity.triggerCooldown(world, pos, state, blockEntity); +- org.bukkit.event.entity.EntityTeleportEvent teleEvent = org.bukkit.craftbukkit.event.CraftEventFactory.callEntityTeleportEvent(entity1, blockposition1.getX() + 0.5, blockposition1.getY() + 0.5, blockposition1.getZ() + 0.5); ++ org.bukkit.event.entity.EntityTeleportEvent teleEvent = org.bukkit.craftbukkit.event.CraftEventFactory.callEntityTeleportEvent(entity1, blockposition1.getX() + 0.5, blockposition1.getY() + 0.5, blockposition1.getZ() + 0.5); // Paper - diff on change + if (teleEvent.isCancelled()) { + return; + } diff --git a/patches/server/0164-API-to-get-a-BlockState-without-a-snapshot.patch b/patches/server/0164-API-to-get-a-BlockState-without-a-snapshot.patch index 0d88c9181a..3bc16e11c4 100644 --- a/patches/server/0164-API-to-get-a-BlockState-without-a-snapshot.patch +++ b/patches/server/0164-API-to-get-a-BlockState-without-a-snapshot.patch @@ -149,10 +149,10 @@ index 183d6146dec231629b4892fcb2fe96d88cc74b4c..2fe8f7dfefd6e1f9b06f1d4821894091 public static BlockState getBlockState(Material material, @Nullable CompoundTag blockEntityTag) { diff --git a/src/main/java/org/bukkit/craftbukkit/persistence/CraftPersistentDataContainer.java b/src/main/java/org/bukkit/craftbukkit/persistence/CraftPersistentDataContainer.java -index 6377a053e5d407fdae061e796657711828c5586e..ae5091433fd605c46b9c57f07114923918fad506 100644 +index cf9f0a8a8d2582e17e9b54269966bbfd4d9ae2a0..268563389077f92921411e866ec26e312e33ee23 100644 --- a/src/main/java/org/bukkit/craftbukkit/persistence/CraftPersistentDataContainer.java +++ b/src/main/java/org/bukkit/craftbukkit/persistence/CraftPersistentDataContainer.java -@@ -156,4 +156,10 @@ public class CraftPersistentDataContainer implements PersistentDataContainer { +@@ -173,4 +173,10 @@ public class CraftPersistentDataContainer implements PersistentDataContainer { public String serialize() { return CraftNBTTagConfigSerializer.serialize(this.toTagCompound()); } diff --git a/patches/server/0190-Block-Enderpearl-Travel-Exploit.patch b/patches/server/0190-Block-Enderpearl-Travel-Exploit.patch index e3e488693e..1fd6bf21f3 100644 --- a/patches/server/0190-Block-Enderpearl-Travel-Exploit.patch +++ b/patches/server/0190-Block-Enderpearl-Travel-Exploit.patch @@ -16,10 +16,10 @@ public net.minecraft.world.entity.projectile.Projectile cachedOwner public net.minecraft.world.entity.projectile.Projectile ownerUUID diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java -index 97554ab72743cf2b8e87c7f3c35579f669c2308a..6d75010bf837a791f5fe04aacb973246410bbd66 100644 +index cc3a34afddac429b1ce75e54fdb284d7683a4310..418f9ed95179a234a4f7df3ba5813e9642b5f44c 100644 --- a/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java -@@ -2354,6 +2354,12 @@ public class ServerLevel extends Level implements WorldGenLevel { +@@ -2364,6 +2364,12 @@ public class ServerLevel extends Level implements WorldGenLevel { public void onTickingEnd(Entity entity) { ServerLevel.this.entityTickList.remove(entity); diff --git a/patches/server/0200-Implement-EntityTeleportEndGatewayEvent.patch b/patches/server/0200-Implement-EntityTeleportEndGatewayEvent.patch index 10ec95312f..99c2c303c4 100644 --- a/patches/server/0200-Implement-EntityTeleportEndGatewayEvent.patch +++ b/patches/server/0200-Implement-EntityTeleportEndGatewayEvent.patch @@ -5,28 +5,23 @@ Subject: [PATCH] Implement EntityTeleportEndGatewayEvent diff --git a/src/main/java/net/minecraft/world/level/block/entity/TheEndGatewayBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/TheEndGatewayBlockEntity.java -index 020314dded2c6305bd5e9013b108bc74be25ccc1..85914124014b4e6f0a561cf560918af68682b6f5 100644 +index 8ae723c6500bb92f937a27730c2a5ec912247c0a..676c2a4c9423e37319b097b99a307dd0186061a0 100644 --- a/src/main/java/net/minecraft/world/level/block/entity/TheEndGatewayBlockEntity.java +++ b/src/main/java/net/minecraft/world/level/block/entity/TheEndGatewayBlockEntity.java -@@ -224,9 +224,20 @@ public class TheEndGatewayBlockEntity extends TheEndPortalBlockEntity { +@@ -224,8 +224,14 @@ public class TheEndGatewayBlockEntity extends TheEndPortalBlockEntity { } - // CraftBukkit end + +- org.bukkit.event.entity.EntityTeleportEvent teleEvent = org.bukkit.craftbukkit.event.CraftEventFactory.callEntityTeleportEvent(entity1, blockposition1.getX() + 0.5, blockposition1.getY() + 0.5, blockposition1.getZ() + 0.5); // Paper - diff on change +- if (teleEvent.isCancelled()) { + // Paper start - EntityTeleportEndGatewayEvent + org.bukkit.Location location = new org.bukkit.Location(world.getWorld(), blockposition1.getX() + 0.5D, blockposition1.getY(), blockposition1.getZ() + 0.5D); + location.setPitch(entity1.getXRot()); + location.setYaw(entity1.getBukkitYaw()); -+ + org.bukkit.entity.Entity bukkitEntity = entity1.getBukkitEntity(); -+ com.destroystokyo.paper.event.entity.EntityTeleportEndGatewayEvent event = new com.destroystokyo.paper.event.entity.EntityTeleportEndGatewayEvent(bukkitEntity, bukkitEntity.getLocation(), location, new org.bukkit.craftbukkit.block.CraftEndGateway(world.getWorld(), blockEntity)); -+ if (!event.callEvent()) { -+ return; -+ } -+ // Paper end - - entity1.setPortalCooldown(); -- entity1.teleportToWithTicket((double) blockposition1.getX() + 0.5D, (double) blockposition1.getY(), (double) blockposition1.getZ() + 0.5D); // Paper - diff on change -+ entity1.teleportToWithTicket(event.getTo().getX(), event.getTo().getY(), event.getTo().getZ()); // Paper - } ++ org.bukkit.event.entity.EntityTeleportEvent teleEvent = new com.destroystokyo.paper.event.entity.EntityTeleportEndGatewayEvent(bukkitEntity, bukkitEntity.getLocation(), location, new org.bukkit.craftbukkit.block.CraftEndGateway(world.getWorld(), blockEntity)); ++ if (!teleEvent.callEvent()) { ++ // Paper end - EntityTeleportEndGatewayEvent + return; + } - TheEndGatewayBlockEntity.triggerCooldown(world, pos, state, blockEntity); diff --git a/patches/server/0214-InventoryCloseEvent-Reason-API.patch b/patches/server/0214-InventoryCloseEvent-Reason-API.patch index 00812c2ab7..710d13f9d8 100644 --- a/patches/server/0214-InventoryCloseEvent-Reason-API.patch +++ b/patches/server/0214-InventoryCloseEvent-Reason-API.patch @@ -7,7 +7,7 @@ Allows you to determine why an inventory was closed, enabling plugin developers to "confirm" things based on if it was player triggered close or not. diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java -index 0705a1bb63f056a228308d348bc5db87b0bee5a1..cc499b31cf186412e575373a5fb7cad54946b0a7 100644 +index 4190c31fae199e6b6481d2b840f15fe68615d720..2e1cabfc3131f43feadf8ce61d0027c18d7c78e6 100644 --- a/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java @@ -1470,7 +1470,7 @@ public class ServerLevel extends Level implements WorldGenLevel { @@ -19,7 +19,7 @@ index 0705a1bb63f056a228308d348bc5db87b0bee5a1..cc499b31cf186412e575373a5fb7cad5 } } } -@@ -2445,7 +2445,7 @@ public class ServerLevel extends Level implements WorldGenLevel { +@@ -2455,7 +2455,7 @@ public class ServerLevel extends Level implements WorldGenLevel { // Spigot Start if (entity.getBukkitEntity() instanceof org.bukkit.inventory.InventoryHolder && (!(entity instanceof ServerPlayer) || entity.getRemovalReason() != Entity.RemovalReason.KILLED)) { // SPIGOT-6876: closeInventory clears death message for (org.bukkit.entity.HumanEntity h : Lists.newArrayList(((org.bukkit.inventory.InventoryHolder) entity.getBukkitEntity()).getInventory().getViewers())) { diff --git a/patches/server/0310-Configurable-Keep-Spawn-Loaded-range-per-world.patch b/patches/server/0310-Configurable-Keep-Spawn-Loaded-range-per-world.patch index 231a82ccac..9cda68fc76 100644 --- a/patches/server/0310-Configurable-Keep-Spawn-Loaded-range-per-world.patch +++ b/patches/server/0310-Configurable-Keep-Spawn-Loaded-range-per-world.patch @@ -63,10 +63,10 @@ index af90bb579429336cc4e99386fd620c898c23d274..96fd66ed2742a79064852af6e936830d // this.updateMobSpawningFlags(); worldserver.setSpawnSettings(this.isSpawningMonsters(), this.isSpawningAnimals()); diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java -index 3b7eea628d0b839900145b326a85733e9fec8aa0..f6d5b6e6ae6699de177ef5fca385bb27ccae70b1 100644 +index 45a6277c93f6d6370442664a8777b08977df0a6b..de4a35992002b962f680d3c43daf51f87f91fef0 100644 --- a/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java -@@ -1883,12 +1883,84 @@ public class ServerLevel extends Level implements WorldGenLevel { +@@ -1893,12 +1893,84 @@ public class ServerLevel extends Level implements WorldGenLevel { return ((MapIndex) this.getServer().overworld().getDataStorage().computeIfAbsent(MapIndex.factory(), "idcounts")).getFreeAuxValueForMap(); } diff --git a/patches/server/0361-Prevent-Double-PlayerChunkMap-adds-crashing-server.patch b/patches/server/0361-Prevent-Double-PlayerChunkMap-adds-crashing-server.patch index 88a6fb43d4..e76e1900fb 100644 --- a/patches/server/0361-Prevent-Double-PlayerChunkMap-adds-crashing-server.patch +++ b/patches/server/0361-Prevent-Double-PlayerChunkMap-adds-crashing-server.patch @@ -25,10 +25,10 @@ index bd15131b7506e965bcf64be20330731256a1e1f0..0e3c89b9d75160d0e8947d042a1568da 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 321f90a0ad7cdd3b0e8b136682947a467f2388b9..86015c6b289ce6fb6b9d1b0ca3f637e53192eea3 100644 +index 8b34c951a56832cb67f51235d3e94643dd1820c4..3bfab189f3c81b086712b85ab1d4dd3209a3f6b8 100644 --- a/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java -@@ -2500,7 +2500,7 @@ public class ServerLevel extends Level implements WorldGenLevel { +@@ -2510,7 +2510,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 321f90a0ad7cdd3b0e8b136682947a467f2388b9..86015c6b289ce6fb6b9d1b0ca3f637e5 if (entity instanceof ServerPlayer) { ServerPlayer entityplayer = (ServerPlayer) entity; -@@ -2535,6 +2535,7 @@ public class ServerLevel extends Level implements WorldGenLevel { +@@ -2545,6 +2545,7 @@ public class ServerLevel extends Level implements WorldGenLevel { entity.updateDynamicGameEventListener(DynamicGameEventListener::add); entity.inWorld = true; // CraftBukkit - Mark entity as in world entity.valid = true; // CraftBukkit diff --git a/patches/server/0401-Maps-shouldn-t-load-chunks.patch b/patches/server/0401-Maps-shouldn-t-load-chunks.patch index ad607fc26a..4c561b2a04 100644 --- a/patches/server/0401-Maps-shouldn-t-load-chunks.patch +++ b/patches/server/0401-Maps-shouldn-t-load-chunks.patch @@ -15,10 +15,10 @@ Previously maps would load all chunks in a certain radius depending on five ticks that movement occur in anyways. diff --git a/src/main/java/net/minecraft/world/item/MapItem.java b/src/main/java/net/minecraft/world/item/MapItem.java -index 6b6132943123c209b4cb49c5aadd913f2a16837c..0e2aef26fb89a435da4907a530507a86c6caa746 100644 +index 5fadfa65b7db07648d88e53893e091024d120bed..e46ceae916f6396d96226db6d8e90bd29088f765 100644 --- a/src/main/java/net/minecraft/world/item/MapItem.java +++ b/src/main/java/net/minecraft/world/item/MapItem.java -@@ -134,9 +134,9 @@ public class MapItem extends ComplexItem { +@@ -126,9 +126,9 @@ public class MapItem extends ComplexItem { int j2 = (j / i + k1 - 64) * i; int k2 = (k / i + l1 - 64) * i; Multiset<MapColor> multiset = LinkedHashMultiset.create(); diff --git a/patches/server/0402-Use-seed-based-lookup-for-Treasure-Maps-Fixes-lag-fr.patch b/patches/server/0402-Use-seed-based-lookup-for-Treasure-Maps-Fixes-lag-fr.patch index f5095ceeb1..2fe0708669 100644 --- a/patches/server/0402-Use-seed-based-lookup-for-Treasure-Maps-Fixes-lag-fr.patch +++ b/patches/server/0402-Use-seed-based-lookup-for-Treasure-Maps-Fixes-lag-fr.patch @@ -6,10 +6,10 @@ Subject: [PATCH] Use seed based lookup for Treasure Maps - Fixes lag from diff --git a/src/main/java/net/minecraft/world/item/MapItem.java b/src/main/java/net/minecraft/world/item/MapItem.java -index 0e2aef26fb89a435da4907a530507a86c6caa746..b27a464cecb0efc2656d85e3c546f262e79de9a4 100644 +index e46ceae916f6396d96226db6d8e90bd29088f765..d4b4da03dcd98336a15eaa045d6b0ce361b15b76 100644 --- a/src/main/java/net/minecraft/world/item/MapItem.java +++ b/src/main/java/net/minecraft/world/item/MapItem.java -@@ -250,14 +250,13 @@ public class MapItem extends ComplexItem { +@@ -242,14 +242,13 @@ public class MapItem extends ComplexItem { boolean[] aboolean = new boolean[16384]; int l = j / i - 64; int i1 = k / i - 64; diff --git a/patches/server/0444-Fix-SpawnChangeEvent-not-firing-for-all-use-cases.patch b/patches/server/0444-Fix-SpawnChangeEvent-not-firing-for-all-use-cases.patch index ee513cdee1..43a7633250 100644 --- a/patches/server/0444-Fix-SpawnChangeEvent-not-firing-for-all-use-cases.patch +++ b/patches/server/0444-Fix-SpawnChangeEvent-not-firing-for-all-use-cases.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Fix SpawnChangeEvent not firing for all use-cases diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java -index 93a60c6dcbe29637e96aa57a76a5ceb544495fb5..8ee66b28ee350564f0595541b904d593a6e3c8d5 100644 +index 17802108f41c98b77c89922451ee56b5ba2dcde2..0bd086f67f5d1f06f66499ae961c71e780a8290a 100644 --- a/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java -@@ -2020,9 +2020,11 @@ public class ServerLevel extends Level implements WorldGenLevel { +@@ -2030,9 +2030,11 @@ public class ServerLevel extends Level implements WorldGenLevel { public void setDefaultSpawnPos(BlockPos pos, float angle) { // Paper - configurable spawn radius BlockPos prevSpawn = this.getSharedSpawnPos(); diff --git a/patches/server/0524-Remove-stale-POIs.patch b/patches/server/0524-Remove-stale-POIs.patch index 7caaa1657b..bea67cb132 100644 --- a/patches/server/0524-Remove-stale-POIs.patch +++ b/patches/server/0524-Remove-stale-POIs.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Remove stale POIs diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java -index 6b5f325f847c096a4092ef3591627b21246601a0..0b321185ed39bfa056298a1ddfb157b73c4ffa03 100644 +index 0fa23738e2a095f55960ebbcfe3198d4feff4b01..7b97230bfffd6cac128330cdfe451a62f0427a11 100644 --- a/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java -@@ -2089,6 +2089,11 @@ public class ServerLevel extends Level implements WorldGenLevel { +@@ -2099,6 +2099,11 @@ public class ServerLevel extends Level implements WorldGenLevel { }); optional1.ifPresent((holder) -> { this.getServer().execute(() -> { diff --git a/patches/server/0621-Missing-Entity-API.patch b/patches/server/0621-Missing-Entity-API.patch index 6eadc37117..8961700c0e 100644 --- a/patches/server/0621-Missing-Entity-API.patch +++ b/patches/server/0621-Missing-Entity-API.patch @@ -541,11 +541,11 @@ index cfff1be6a4a4936a2dadb2590abc3d33c123d048..3dac93b0ab5d5acf5b33dc4b0efed603 + // Paper end } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftCat.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftCat.java -index 94be7d7d88b38d73592a6a76ee9b9b755ba6c588..6c9531c018be29b5794d047b50007fde1b50b494 100644 +index b49d1e5c7389e1c2ccfe3a196b5325e5f5b190e7..0ccc20157fb9fdb9c99b942dcb4675db5f928b23 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftCat.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftCat.java -@@ -64,4 +64,26 @@ public class CraftCat extends CraftTameableAnimal implements Cat { - .byId(bukkit.ordinal()); +@@ -66,4 +66,26 @@ public class CraftCat extends CraftTameableAnimal implements Cat { + return registry.get(CraftNamespacedKey.toMinecraft(bukkit.getKey())); } } + diff --git a/patches/server/0634-Fix-incosistency-issue-with-empty-map-items-in-CB.patch b/patches/server/0634-Fix-incosistency-issue-with-empty-map-items-in-CB.patch index d31acf4385..d2553b1897 100644 --- a/patches/server/0634-Fix-incosistency-issue-with-empty-map-items-in-CB.patch +++ b/patches/server/0634-Fix-incosistency-issue-with-empty-map-items-in-CB.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Fix incosistency issue with empty map items in CB diff --git a/src/main/java/net/minecraft/world/item/MapItem.java b/src/main/java/net/minecraft/world/item/MapItem.java -index b27a464cecb0efc2656d85e3c546f262e79de9a4..cd841f027edbe7e000d633034a2aa6a214c20b5b 100644 +index d4b4da03dcd98336a15eaa045d6b0ce361b15b76..797415866a7f182d804f6b8e57ceb07a6ac2a20a 100644 --- a/src/main/java/net/minecraft/world/item/MapItem.java +++ b/src/main/java/net/minecraft/world/item/MapItem.java -@@ -73,7 +73,7 @@ public class MapItem extends ComplexItem { +@@ -69,7 +69,7 @@ public class MapItem extends ComplexItem { public static Integer getMapId(ItemStack stack) { CompoundTag nbttagcompound = stack.getTag(); diff --git a/patches/server/0692-Fix-merchant-inventory-not-closing-on-entity-removal.patch b/patches/server/0692-Fix-merchant-inventory-not-closing-on-entity-removal.patch index 11b3f65cb3..0542a5f892 100644 --- a/patches/server/0692-Fix-merchant-inventory-not-closing-on-entity-removal.patch +++ b/patches/server/0692-Fix-merchant-inventory-not-closing-on-entity-removal.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Fix merchant inventory not closing on entity removal diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java -index a3ef919ff07655e835a1b423b3d4f71939a47db8..fa4a6f519a4611fe896210a97aeb334e1fae039d 100644 +index 424d6fee9f5663371082fce4e23b6dc9282a591f..9d17813757f968624231b53aa1f895f5d25ab5d8 100644 --- a/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java -@@ -2682,6 +2682,11 @@ public class ServerLevel extends Level implements WorldGenLevel { +@@ -2692,6 +2692,11 @@ public class ServerLevel extends Level implements WorldGenLevel { // Spigot end // Spigot Start if (entity.getBukkitEntity() instanceof org.bukkit.inventory.InventoryHolder && (!(entity instanceof ServerPlayer) || entity.getRemovalReason() != Entity.RemovalReason.KILLED)) { // SPIGOT-6876: closeInventory clears death message diff --git a/patches/server/0742-Add-missing-IAE-check-for-PersistentDataContainer-ha.patch b/patches/server/0742-Add-missing-IAE-check-for-PersistentDataContainer-ha.patch new file mode 100644 index 0000000000..08a8876b57 --- /dev/null +++ b/patches/server/0742-Add-missing-IAE-check-for-PersistentDataContainer-ha.patch @@ -0,0 +1,18 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: u9g <[email protected]> +Date: Mon, 3 Jan 2022 23:32:42 -0500 +Subject: [PATCH] Add missing IAE check for PersistentDataContainer#has + + +diff --git a/src/main/java/org/bukkit/craftbukkit/persistence/CraftPersistentDataContainer.java b/src/main/java/org/bukkit/craftbukkit/persistence/CraftPersistentDataContainer.java +index 268563389077f92921411e866ec26e312e33ee23..43545bac94fbf118a982b654fbe0d6afc6e25897 100644 +--- a/src/main/java/org/bukkit/craftbukkit/persistence/CraftPersistentDataContainer.java ++++ b/src/main/java/org/bukkit/craftbukkit/persistence/CraftPersistentDataContainer.java +@@ -56,6 +56,7 @@ public class CraftPersistentDataContainer implements PersistentDataContainer { + + @Override + public boolean has(NamespacedKey key) { ++ Preconditions.checkArgument(key != null, "The provided key for the custom value was null"); // Paper + return this.customDataTags.get(key.toString()) != null; + } + diff --git a/patches/server/0742-Add-new-overload-to-PersistentDataContainer-has.patch b/patches/server/0742-Add-new-overload-to-PersistentDataContainer-has.patch deleted file mode 100644 index ad9460d017..0000000000 --- a/patches/server/0742-Add-new-overload-to-PersistentDataContainer-has.patch +++ /dev/null @@ -1,24 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: u9g <[email protected]> -Date: Mon, 3 Jan 2022 23:32:42 -0500 -Subject: [PATCH] Add new overload to PersistentDataContainer#has - -Adds the new overload: PersistentDataContainer#has(NamespacedKey key) - -diff --git a/src/main/java/org/bukkit/craftbukkit/persistence/CraftPersistentDataContainer.java b/src/main/java/org/bukkit/craftbukkit/persistence/CraftPersistentDataContainer.java -index ae5091433fd605c46b9c57f07114923918fad506..390d5843233d26b76f90651f49a2a1d68c0aa67f 100644 ---- a/src/main/java/org/bukkit/craftbukkit/persistence/CraftPersistentDataContainer.java -+++ b/src/main/java/org/bukkit/craftbukkit/persistence/CraftPersistentDataContainer.java -@@ -161,5 +161,12 @@ public class CraftPersistentDataContainer implements PersistentDataContainer { - public void clear() { - this.customDataTags.clear(); - } -+ -+ @Override -+ public boolean has(NamespacedKey key) { -+ Preconditions.checkArgument(key != null, "The provided key for the custom value was null"); -+ -+ return this.customDataTags.containsKey(key.toString()); -+ } - // Paper end - } diff --git a/patches/server/0801-Don-t-tick-markers.patch b/patches/server/0801-Don-t-tick-markers.patch index 18a68e85c9..fa030b09e2 100644 --- a/patches/server/0801-Don-t-tick-markers.patch +++ b/patches/server/0801-Don-t-tick-markers.patch @@ -23,10 +23,10 @@ index ff99336e0b8131ae161cfa5c4fc83c6905e3dbc8..5f43aedc6596e2b1ac7af97115157147 } }); diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java -index fa4a6f519a4611fe896210a97aeb334e1fae039d..91fdab7fc3afacfa58e91d5714f6bf7c3359278a 100644 +index 9d17813757f968624231b53aa1f895f5d25ab5d8..a96aa3568453aa2da8b5cd5b269fc0b3fec13938 100644 --- a/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java -@@ -2591,6 +2591,7 @@ public class ServerLevel extends Level implements WorldGenLevel { +@@ -2601,6 +2601,7 @@ public class ServerLevel extends Level implements WorldGenLevel { } public void onTickingStart(Entity entity) { diff --git a/patches/server/0811-Add-Alternate-Current-redstone-implementation.patch b/patches/server/0811-Add-Alternate-Current-redstone-implementation.patch index 5d52a6fab1..41f7096da9 100644 --- a/patches/server/0811-Add-Alternate-Current-redstone-implementation.patch +++ b/patches/server/0811-Add-Alternate-Current-redstone-implementation.patch @@ -2008,7 +2008,7 @@ index 0000000000000000000000000000000000000000..33cd90c30c22200a4e1ae64f40a0bf78 + } +} diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java -index 91fdab7fc3afacfa58e91d5714f6bf7c3359278a..a30bc2fd80439f65d3dcfcdcfa3d3b71b737afaf 100644 +index a96aa3568453aa2da8b5cd5b269fc0b3fec13938..4cf7e66dfee34a29894f53d17e7e13c46fb4b85e 100644 --- a/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java @@ -224,6 +224,7 @@ public class ServerLevel extends Level implements WorldGenLevel { @@ -2019,7 +2019,7 @@ index 91fdab7fc3afacfa58e91d5714f6bf7c3359278a..a30bc2fd80439f65d3dcfcdcfa3d3b71 public static Throwable getAddToWorldStackTrace(Entity entity) { final Throwable thr = new Throwable(entity + " Added to world at " + new java.util.Date()); io.papermc.paper.util.StacktraceDeobfuscator.INSTANCE.deobfuscateThrowable(thr); -@@ -2580,6 +2581,13 @@ public class ServerLevel extends Level implements WorldGenLevel { +@@ -2590,6 +2591,13 @@ public class ServerLevel extends Level implements WorldGenLevel { return crashreportsystemdetails; } diff --git a/patches/server/0842-Added-byte-array-serialization-deserialization-for-P.patch b/patches/server/0842-Added-byte-array-serialization-deserialization-for-P.patch index 3e6734569e..03ee249744 100644 --- a/patches/server/0842-Added-byte-array-serialization-deserialization-for-P.patch +++ b/patches/server/0842-Added-byte-array-serialization-deserialization-for-P.patch @@ -6,33 +6,34 @@ Subject: [PATCH] Added byte array serialization/deserialization for diff --git a/src/main/java/org/bukkit/craftbukkit/persistence/CraftPersistentDataContainer.java b/src/main/java/org/bukkit/craftbukkit/persistence/CraftPersistentDataContainer.java -index 390d5843233d26b76f90651f49a2a1d68c0aa67f..3351962e85438ed05215ce0d159799ed4707afde 100644 +index 43545bac94fbf118a982b654fbe0d6afc6e25897..416d2ca909d30e267fb97082a0aaac90444510de 100644 --- a/src/main/java/org/bukkit/craftbukkit/persistence/CraftPersistentDataContainer.java +++ b/src/main/java/org/bukkit/craftbukkit/persistence/CraftPersistentDataContainer.java -@@ -168,5 +168,26 @@ public class CraftPersistentDataContainer implements PersistentDataContainer { - - return this.customDataTags.containsKey(key.toString()); +@@ -180,4 +180,27 @@ public class CraftPersistentDataContainer implements PersistentDataContainer { + this.customDataTags.clear(); } + // Paper end + ++ // Paper start - byte array serialization + @Override + public byte[] serializeToBytes() throws java.io.IOException { -+ net.minecraft.nbt.CompoundTag root = this.toTagCompound(); -+ java.io.ByteArrayOutputStream byteArrayOutput = new java.io.ByteArrayOutputStream(); -+ try (java.io.DataOutputStream dataOutput = new java.io.DataOutputStream(byteArrayOutput)) { ++ final net.minecraft.nbt.CompoundTag root = this.toTagCompound(); ++ final java.io.ByteArrayOutputStream byteArrayOutput = new java.io.ByteArrayOutputStream(); ++ try (final java.io.DataOutputStream dataOutput = new java.io.DataOutputStream(byteArrayOutput)) { + net.minecraft.nbt.NbtIo.write(root, dataOutput); + return byteArrayOutput.toByteArray(); + } + } + + @Override -+ public void readFromBytes(byte[] bytes, boolean clear) throws java.io.IOException { ++ public void readFromBytes(final byte[] bytes, final boolean clear) throws java.io.IOException { + if (clear) { + this.clear(); + } -+ try (java.io.DataInputStream dataInput = new java.io.DataInputStream(new java.io.ByteArrayInputStream(bytes))) { -+ net.minecraft.nbt.CompoundTag compound = net.minecraft.nbt.NbtIo.read(dataInput); ++ try (final java.io.DataInputStream dataInput = new java.io.DataInputStream(new java.io.ByteArrayInputStream(bytes))) { ++ final net.minecraft.nbt.CompoundTag compound = net.minecraft.nbt.NbtIo.read(dataInput); + this.putAll(compound); + } + } - // Paper end ++ // Paper end - byte array serialization } diff --git a/patches/server/0851-Remove-unnecessary-onTrackingStart-during-navigation.patch b/patches/server/0851-Remove-unnecessary-onTrackingStart-during-navigation.patch index b86bc6ba91..9a13680600 100644 --- a/patches/server/0851-Remove-unnecessary-onTrackingStart-during-navigation.patch +++ b/patches/server/0851-Remove-unnecessary-onTrackingStart-during-navigation.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Remove unnecessary onTrackingStart during navigation warning diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java -index ac9f42e8d88ca8cdb2882bd8d7676a793024599c..ab8c8643c48f6ac49f4b73eed6462cd62482b269 100644 +index 66eecf5155f8f526480511d2b3af1b6f87280474..22dd14b715f91c7771411a5375cf470fc2c940d5 100644 --- a/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java -@@ -2627,7 +2627,7 @@ public class ServerLevel extends Level implements WorldGenLevel { +@@ -2637,7 +2637,7 @@ public class ServerLevel extends Level implements WorldGenLevel { if (entity instanceof Mob) { Mob entityinsentient = (Mob) entity; @@ -17,7 +17,7 @@ index ac9f42e8d88ca8cdb2882bd8d7676a793024599c..ab8c8643c48f6ac49f4b73eed6462cd6 String s = "onTrackingStart called during navigation iteration"; Util.logAndPauseIfInIde("onTrackingStart called during navigation iteration", new IllegalStateException("onTrackingStart called during navigation iteration")); -@@ -2713,7 +2713,7 @@ public class ServerLevel extends Level implements WorldGenLevel { +@@ -2723,7 +2723,7 @@ public class ServerLevel extends Level implements WorldGenLevel { if (entity instanceof Mob) { Mob entityinsentient = (Mob) entity; diff --git a/patches/server/0876-check-global-player-list-where-appropriate.patch b/patches/server/0876-check-global-player-list-where-appropriate.patch index d8d6a85a6f..16808c9719 100644 --- a/patches/server/0876-check-global-player-list-where-appropriate.patch +++ b/patches/server/0876-check-global-player-list-where-appropriate.patch @@ -7,10 +7,10 @@ Makes certain entities check all players when searching for a player instead of just checking players in their world. diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java -index ab8c8643c48f6ac49f4b73eed6462cd62482b269..b3ffc58db60cbe0591086c3768ae6009ca7017c7 100644 +index 22dd14b715f91c7771411a5375cf470fc2c940d5..c04ba20ba3f07e96fba1697f17e36c47aae5fabf 100644 --- a/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java -@@ -2750,4 +2750,12 @@ public class ServerLevel extends Level implements WorldGenLevel { +@@ -2760,4 +2760,12 @@ public class ServerLevel extends Level implements WorldGenLevel { entity.updateDynamicGameEventListener(DynamicGameEventListener::move); } } diff --git a/patches/server/0995-Deep-clone-unhandled-nbt-tags.patch b/patches/server/0995-Deep-clone-unhandled-nbt-tags.patch index 06631c1567..73640d521c 100644 --- a/patches/server/0995-Deep-clone-unhandled-nbt-tags.patch +++ b/patches/server/0995-Deep-clone-unhandled-nbt-tags.patch @@ -44,18 +44,19 @@ index 039197efb05432b8139fbabe92338572c1bf078e..8762a7a22723150a1a42b3459f3744b8 clone.unbreakable = this.unbreakable; clone.damage = this.damage; diff --git a/src/main/java/org/bukkit/craftbukkit/persistence/CraftPersistentDataContainer.java b/src/main/java/org/bukkit/craftbukkit/persistence/CraftPersistentDataContainer.java -index 3351962e85438ed05215ce0d159799ed4707afde..8d5789cc6001fdf68c2d3f7ee3dd8fcafb9c831f 100644 +index 416d2ca909d30e267fb97082a0aaac90444510de..9d61756689d1f5a71bcdb3ae4859cb0a60e7d850 100644 --- a/src/main/java/org/bukkit/craftbukkit/persistence/CraftPersistentDataContainer.java +++ b/src/main/java/org/bukkit/craftbukkit/persistence/CraftPersistentDataContainer.java -@@ -189,5 +189,11 @@ public class CraftPersistentDataContainer implements PersistentDataContainer { - this.putAll(compound); +@@ -203,4 +203,12 @@ public class CraftPersistentDataContainer implements PersistentDataContainer { } } + // Paper end - byte array serialization + ++ // Paper start - deep clone tags + public Map<String, Tag> getTagsCloned() { + final Map<String, Tag> tags = new HashMap<>(); + this.customDataTags.forEach((key, tag) -> tags.put(key, tag.copy())); + return tags; + } - // Paper end ++ // Paper end - deep clone tags } diff --git a/patches/server/1025-Fix-missing-map-initialize-event-call.patch b/patches/server/1025-Fix-missing-map-initialize-event-call.patch index 6b6864c316..cb7ba8687a 100644 --- a/patches/server/1025-Fix-missing-map-initialize-event-call.patch +++ b/patches/server/1025-Fix-missing-map-initialize-event-call.patch @@ -3,16 +3,21 @@ From: Warrior <[email protected]> Date: Sun, 24 Sep 2023 18:35:28 +0200 Subject: [PATCH] Fix missing map initialize event call +== AT == +public net.minecraft.world.level.storage.DimensionDataStorage readSavedData(Ljava/util/function/Function;Lnet/minecraft/util/datafix/DataFixTypes;Ljava/lang/String;)Lnet/minecraft/world/level/saveddata/SavedData; diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java -index 82e5a780c993991c00264f7874ccc7f333f3f590..f4d53d9bfe5b060158f69b5d9e4533a5b9869eed 100644 +index 8f85aafb181cadd2983b0f3735782729858226c6..b78a9628a88f2a495ef6de74446a02a14d41a1f6 100644 --- a/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java -@@ -2129,7 +2129,23 @@ public class ServerLevel extends Level implements WorldGenLevel { +@@ -2129,13 +2129,25 @@ public class ServerLevel extends Level implements WorldGenLevel { @Nullable @Override public MapItemSavedData getMapData(String id) { -- return (MapItemSavedData) this.getServer().overworld().getDataStorage().get(MapItemSavedData.factory(), id); +- // CraftBukkit start +- MapItemSavedData worldmap = (MapItemSavedData) this.getServer().overworld().getDataStorage().get(MapItemSavedData.factory(), id); +- if (worldmap != null) { +- worldmap.id = id; + // Paper start - Call missing map initialize event & set id + final DimensionDataStorage storage = this.getServer().overworld().getDataStorage(); + @@ -26,23 +31,14 @@ index 82e5a780c993991c00264f7874ccc7f333f3f590..f4d53d9bfe5b060158f69b5d9e4533a5 + new MapInitializeEvent(map.mapView).callEvent(); + return map; + } -+ } ++ } else if (existing instanceof MapItemSavedData mapItemSavedData) { ++ mapItemSavedData.id = id; + } +- return worldmap; +- // CraftBukkit end + + return existing instanceof MapItemSavedData data ? data : null; + // Paper end } @Override -diff --git a/src/main/java/net/minecraft/world/level/storage/DimensionDataStorage.java b/src/main/java/net/minecraft/world/level/storage/DimensionDataStorage.java -index 1aea6a257ffceb511368a6e8dee5051e120894ad..269c81cd60d98a94721c77d700af223bda15a61a 100644 ---- a/src/main/java/net/minecraft/world/level/storage/DimensionDataStorage.java -+++ b/src/main/java/net/minecraft/world/level/storage/DimensionDataStorage.java -@@ -58,7 +58,7 @@ public class DimensionDataStorage { - } - - @Nullable -- private <T extends SavedData> T readSavedData(Function<CompoundTag, T> readFunction, DataFixTypes dataFixTypes, String id) { -+ public <T extends SavedData> T readSavedData(Function<CompoundTag, T> readFunction, DataFixTypes dataFixTypes, String id) { // Paper - try { - File file = this.getDataFile(id); - if (file.exists()) { |