From 89bf08158b0ef5e0ff304bcd7705992ed2381a01 Mon Sep 17 00:00:00 2001 From: Owen1212055 <23108066+Owen1212055@users.noreply.github.com> Date: Thu, 24 Oct 2024 09:53:28 -0400 Subject: [PATCH] Patch --- .../0919-Add-Lifecycle-Event-system.patch} | 6 +- .../0920-ItemStack-Tooltip-API.patch} | 2 +- ...Snapshot-includeLightData-parameter.patch} | 8 +- .../0922-Add-FluidState-API.patch} | 6 +- .../0923-add-number-format-api.patch} | 0 .../0924-improve-BanList-types.patch} | 4 +- .../0925-Expanded-Hopper-API.patch} | 0 ...6-Add-BlockBreakProgressUpdateEvent.patch} | 4 +- .../0927-Deprecate-ItemStack-setType.patch} | 4 +- .../0928-Add-CartographyItemEvent.patch} | 6 +- .../0929-More-Raid-API.patch} | 8 +- ...ng-message-for-initial-server-start.patch} | 6 +- ...-Configurable-max-block-fluid-ticks.patch} | 4 +- .../0932-Fix-bees-aging-inside-hives.patch} | 6 +- ...3-Disable-memory-reserve-allocating.patch} | 0 ...ByEntityEvent-for-unowned-wither-sk.patch} | 6 +- .../0935-Fix-DamageSource-API.patch} | 68 +++++----- ...nvalid-block-entity-during-world-ge.patch} | 6 +- ...tackOverflowError-for-some-dispenses.patch | 95 ++++++++++++++ .../0938-Improve-tag-parser-handling.patch} | 31 ++--- .../0939-Item-Mutation-Fixes.patch} | 6 +- ...-Per-world-ticks-per-spawn-settings.patch} | 6 +- ...e-changed-item-from-dispense-events.patch} | 40 +++--- ...nd-End-Portal-Frames-from-being-des.patch} | 52 ++++---- ...-for-mobs-immune-to-default-effects.patch} | 8 +- .../0944-Deep-clone-nbt-tags-in-PDC.patch} | 8 +- ...tackOverflowError-for-some-dispenses.patch | 117 ------------------ ...re-disarming-not-working-as-intended.patch | 22 ---- 28 files changed, 234 insertions(+), 295 deletions(-) rename patches/{unapplied/server/0926-Add-Lifecycle-Event-system.patch => server/0919-Add-Lifecycle-Event-system.patch} (99%) rename patches/{unapplied/server/0927-ItemStack-Tooltip-API.patch => server/0920-ItemStack-Tooltip-API.patch} (95%) rename patches/{unapplied/server/0928-Add-getChunkSnapshot-includeLightData-parameter.patch => server/0921-Add-getChunkSnapshot-includeLightData-parameter.patch} (92%) rename patches/{unapplied/server/0929-Add-FluidState-API.patch => server/0922-Add-FluidState-API.patch} (97%) rename patches/{unapplied/server/0930-add-number-format-api.patch => server/0923-add-number-format-api.patch} (100%) rename patches/{unapplied/server/0931-improve-BanList-types.patch => server/0924-improve-BanList-types.patch} (89%) rename patches/{unapplied/server/0932-Expanded-Hopper-API.patch => server/0925-Expanded-Hopper-API.patch} (100%) rename patches/{unapplied/server/0933-Add-BlockBreakProgressUpdateEvent.patch => server/0926-Add-BlockBreakProgressUpdateEvent.patch} (87%) rename patches/{unapplied/server/0934-Deprecate-ItemStack-setType.patch => server/0927-Deprecate-ItemStack-setType.patch} (89%) rename patches/{unapplied/server/0935-Add-CartographyItemEvent.patch => server/0928-Add-CartographyItemEvent.patch} (91%) rename patches/{unapplied/server/0936-More-Raid-API.patch => server/0929-More-Raid-API.patch} (93%) rename patches/{unapplied/server/0937-Add-onboarding-message-for-initial-server-start.patch => server/0930-Add-onboarding-message-for-initial-server-start.patch} (95%) rename patches/{unapplied/server/0938-Configurable-max-block-fluid-ticks.patch => server/0931-Configurable-max-block-fluid-ticks.patch} (85%) rename patches/{unapplied/server/0939-Fix-bees-aging-inside-hives.patch => server/0932-Fix-bees-aging-inside-hives.patch} (90%) rename patches/{unapplied/server/0940-Disable-memory-reserve-allocating.patch => server/0933-Disable-memory-reserve-allocating.patch} (100%) rename patches/{unapplied/server/0941-Fire-EntityDamageByEntityEvent-for-unowned-wither-sk.patch => server/0934-Fire-EntityDamageByEntityEvent-for-unowned-wither-sk.patch} (67%) rename patches/{unapplied/server/0942-Fix-DamageSource-API.patch => server/0935-Fix-DamageSource-API.patch} (76%) rename patches/{unapplied/server/0943-Fix-creation-of-invalid-block-entity-during-world-ge.patch => server/0936-Fix-creation-of-invalid-block-entity-during-world-ge.patch} (93%) create mode 100644 patches/server/0937-Fix-possible-StackOverflowError-for-some-dispenses.patch rename patches/{unapplied/server/0945-Improve-tag-parser-handling.patch => server/0938-Improve-tag-parser-handling.patch} (92%) rename patches/{unapplied/server/0946-Item-Mutation-Fixes.patch => server/0939-Item-Mutation-Fixes.patch} (90%) rename patches/{unapplied/server/0947-Per-world-ticks-per-spawn-settings.patch => server/0940-Per-world-ticks-per-spawn-settings.patch} (90%) rename patches/{unapplied/server/0948-Properly-track-the-changed-item-from-dispense-events.patch => server/0941-Properly-track-the-changed-item-from-dispense-events.patch} (73%) rename patches/{unapplied/server/0949-Protect-Bedrock-and-End-Portal-Frames-from-being-des.patch => server/0942-Protect-Bedrock-and-End-Portal-Frames-from-being-des.patch} (86%) rename patches/{unapplied/server/0951-Add-config-for-mobs-immune-to-default-effects.patch => server/0943-Add-config-for-mobs-immune-to-default-effects.patch} (86%) rename patches/{unapplied/server/0952-Deep-clone-nbt-tags-in-PDC.patch => server/0944-Deep-clone-nbt-tags-in-PDC.patch} (89%) delete mode 100644 patches/unapplied/server/0944-Fix-possible-StackOverflowError-for-some-dispenses.patch delete mode 100644 patches/unapplied/server/0950-Fix-tripwire-disarming-not-working-as-intended.patch diff --git a/patches/unapplied/server/0926-Add-Lifecycle-Event-system.patch b/patches/server/0919-Add-Lifecycle-Event-system.patch similarity index 99% rename from patches/unapplied/server/0926-Add-Lifecycle-Event-system.patch rename to patches/server/0919-Add-Lifecycle-Event-system.patch index f6600c4370..2f7888db41 100644 --- a/patches/unapplied/server/0926-Add-Lifecycle-Event-system.patch +++ b/patches/server/0919-Add-Lifecycle-Event-system.patch @@ -727,10 +727,10 @@ index 2e96308696e131f3f013469a395e5ddda2c5d529..65a66e484c1c39c5f41d97db52f31c67 } catch (Throwable e) { LOGGER.error("Failed to run bootstrapper for %s. This plugin will not be loaded.".formatted(provider.getSource()), e); diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -index 8b871d29d883119cd8ad9ca134f4c1fce9362705..f6b87a5249e1a21b3221f253f891d8978249c50a 100644 +index 2934e232c84603224470fdaba0103d42fc06e8b4..4dc64ab006399d62251f4a238d9c2caebd595301 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -@@ -1048,6 +1048,11 @@ public final class CraftServer implements Server { +@@ -1051,6 +1051,11 @@ public final class CraftServer implements Server { @Override public void reload() { @@ -743,7 +743,7 @@ index 8b871d29d883119cd8ad9ca134f4c1fce9362705..f6b87a5249e1a21b3221f253f891d897 this.reloadCount++; this.configuration = YamlConfiguration.loadConfiguration(this.getConfigFile()); diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java -index 73a3e708f21c1b9c5de1fc180f728d6da7eea0fb..b89db5335aa3984b76513165456ebe43ad9a0cc7 100644 +index b6591836a8d9301b8cf909223426df0e8e675c1f..6396af834c5ca2328896613c5d97e43624eb305d 100644 --- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java +++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java @@ -652,6 +652,13 @@ public final class CraftMagicNumbers implements UnsafeValues { diff --git a/patches/unapplied/server/0927-ItemStack-Tooltip-API.patch b/patches/server/0920-ItemStack-Tooltip-API.patch similarity index 95% rename from patches/unapplied/server/0927-ItemStack-Tooltip-API.patch rename to patches/server/0920-ItemStack-Tooltip-API.patch index c487ffd71f..006236f389 100644 --- a/patches/unapplied/server/0927-ItemStack-Tooltip-API.patch +++ b/patches/server/0920-ItemStack-Tooltip-API.patch @@ -5,7 +5,7 @@ Subject: [PATCH] ItemStack Tooltip API diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java -index b89db5335aa3984b76513165456ebe43ad9a0cc7..6e8838245b0792b15fd9788f2ce11f6503d0e070 100644 +index 6396af834c5ca2328896613c5d97e43624eb305d..6e070dada87083656a19b4abf78db63f4b2513e6 100644 --- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java +++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java @@ -628,6 +628,21 @@ public final class CraftMagicNumbers implements UnsafeValues { diff --git a/patches/unapplied/server/0928-Add-getChunkSnapshot-includeLightData-parameter.patch b/patches/server/0921-Add-getChunkSnapshot-includeLightData-parameter.patch similarity index 92% rename from patches/unapplied/server/0928-Add-getChunkSnapshot-includeLightData-parameter.patch rename to patches/server/0921-Add-getChunkSnapshot-includeLightData-parameter.patch index 54aa35539f..ba33560bab 100644 --- a/patches/unapplied/server/0928-Add-getChunkSnapshot-includeLightData-parameter.patch +++ b/patches/server/0921-Add-getChunkSnapshot-includeLightData-parameter.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Add getChunkSnapshot includeLightData parameter diff --git a/src/main/java/org/bukkit/craftbukkit/CraftChunk.java b/src/main/java/org/bukkit/craftbukkit/CraftChunk.java -index d6eab2a0fdbafc35efa7ed5b404357391565f4f3..69c7fe5bf5b914276a9f7a0e57ce668e569d91f9 100644 +index 887a17a0833064eb5701222e5fb6f5ccf9511588..5fc9e8e969debb3e15ed474b36a1c48b086d0449 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftChunk.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftChunk.java @@ -328,12 +328,21 @@ public class CraftChunk implements Chunk { @@ -49,10 +49,10 @@ index d6eab2a0fdbafc35efa7ed5b404357391565f4f3..69c7fe5bf5b914276a9f7a0e57ce668e if (biome != null) { biome[i] = ((PalettedContainer>) cs[i].getBiomes()).copy(); // Paper - Perf: use copy instead of round tripping with codecs diff --git a/src/main/java/org/bukkit/craftbukkit/CraftChunkSnapshot.java b/src/main/java/org/bukkit/craftbukkit/CraftChunkSnapshot.java -index 85029f1acfdbb411d9ebdf95838d6db3898f4e58..0756b5adb3039997feadeb94afb10b596abd9424 100644 +index c88e4ba701b2a2325b76478b7f47278157afd2ef..ddcbdbcbfeb6efe0a587b1181505423cc9d2c951 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftChunkSnapshot.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftChunkSnapshot.java -@@ -118,6 +118,7 @@ public class CraftChunkSnapshot implements ChunkSnapshot { +@@ -119,6 +119,7 @@ public class CraftChunkSnapshot implements ChunkSnapshot { @Override public final int getBlockSkyLight(int x, int y, int z) { @@ -60,7 +60,7 @@ index 85029f1acfdbb411d9ebdf95838d6db3898f4e58..0756b5adb3039997feadeb94afb10b59 this.validateChunkCoordinates(x, y, z); int off = ((y & 0xF) << 7) | (z << 3) | (x >> 1); -@@ -126,6 +127,7 @@ public class CraftChunkSnapshot implements ChunkSnapshot { +@@ -127,6 +128,7 @@ public class CraftChunkSnapshot implements ChunkSnapshot { @Override public final int getBlockEmittedLight(int x, int y, int z) { diff --git a/patches/unapplied/server/0929-Add-FluidState-API.patch b/patches/server/0922-Add-FluidState-API.patch similarity index 97% rename from patches/unapplied/server/0929-Add-FluidState-API.patch rename to patches/server/0922-Add-FluidState-API.patch index aac0912819..8fa8aecc02 100644 --- a/patches/unapplied/server/0929-Add-FluidState-API.patch +++ b/patches/server/0922-Add-FluidState-API.patch @@ -173,7 +173,7 @@ index 0000000000000000000000000000000000000000..c0c2805cb045cdd835b402776a6923fe + +} diff --git a/src/main/java/org/bukkit/craftbukkit/CraftRegionAccessor.java b/src/main/java/org/bukkit/craftbukkit/CraftRegionAccessor.java -index a14d3e6c43b94c543790571b13808713444a239f..284234fcdd15c4c7a4567c7c887d47bf0b7967f4 100644 +index 29825ea687827c075b87e88c45672e7b0093ed17..9af491e6e9ac96fc766462a1f672f44f8fc50ef1 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftRegionAccessor.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftRegionAccessor.java @@ -108,6 +108,13 @@ public abstract class CraftRegionAccessor implements RegionAccessor { @@ -191,10 +191,10 @@ index a14d3e6c43b94c543790571b13808713444a239f..284234fcdd15c4c7a4567c7c887d47bf public BlockData getBlockData(Location location) { return this.getBlockData(location.getBlockX(), location.getBlockY(), location.getBlockZ()); diff --git a/src/main/java/org/bukkit/craftbukkit/generator/CraftLimitedRegion.java b/src/main/java/org/bukkit/craftbukkit/generator/CraftLimitedRegion.java -index eaa9ba70b0b80d86eb376a0641420093a7c9dfdb..25598df0bb0d4347b2c17b6ec0afbfe4ecf808b9 100644 +index a23269e3bdb83f85a1d08d5f7b54742025223ada..a57ac9dc8d08b12ec00ad41d9a1779e5a81e4e8b 100644 --- a/src/main/java/org/bukkit/craftbukkit/generator/CraftLimitedRegion.java +++ b/src/main/java/org/bukkit/craftbukkit/generator/CraftLimitedRegion.java -@@ -303,4 +303,11 @@ public class CraftLimitedRegion extends CraftRegionAccessor implements LimitedRe +@@ -304,4 +304,11 @@ public class CraftLimitedRegion extends CraftRegionAccessor implements LimitedRe return centerChunkZ; } // Paper end - Add more LimitedRegion API diff --git a/patches/unapplied/server/0930-add-number-format-api.patch b/patches/server/0923-add-number-format-api.patch similarity index 100% rename from patches/unapplied/server/0930-add-number-format-api.patch rename to patches/server/0923-add-number-format-api.patch diff --git a/patches/unapplied/server/0931-improve-BanList-types.patch b/patches/server/0924-improve-BanList-types.patch similarity index 89% rename from patches/unapplied/server/0931-improve-BanList-types.patch rename to patches/server/0924-improve-BanList-types.patch index a3e327bc83..24c44ced87 100644 --- a/patches/unapplied/server/0931-improve-BanList-types.patch +++ b/patches/server/0924-improve-BanList-types.patch @@ -5,10 +5,10 @@ Subject: [PATCH] improve BanList types diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -index f6b87a5249e1a21b3221f253f891d8978249c50a..0fc6e659915a4547c2db9205fed205a1d28f21d4 100644 +index 4dc64ab006399d62251f4a238d9c2caebd595301..97850b3111dfa86d15186fa200937b28bec428de 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -@@ -2256,6 +2256,21 @@ public final class CraftServer implements Server { +@@ -2223,6 +2223,21 @@ public final class CraftServer implements Server { }; } diff --git a/patches/unapplied/server/0932-Expanded-Hopper-API.patch b/patches/server/0925-Expanded-Hopper-API.patch similarity index 100% rename from patches/unapplied/server/0932-Expanded-Hopper-API.patch rename to patches/server/0925-Expanded-Hopper-API.patch diff --git a/patches/unapplied/server/0933-Add-BlockBreakProgressUpdateEvent.patch b/patches/server/0926-Add-BlockBreakProgressUpdateEvent.patch similarity index 87% rename from patches/unapplied/server/0933-Add-BlockBreakProgressUpdateEvent.patch rename to patches/server/0926-Add-BlockBreakProgressUpdateEvent.patch index 3481a288ee..7d82cc97af 100644 --- a/patches/unapplied/server/0933-Add-BlockBreakProgressUpdateEvent.patch +++ b/patches/server/0926-Add-BlockBreakProgressUpdateEvent.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Add BlockBreakProgressUpdateEvent diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java -index 34ece37aee68e4d8eeaa919e8bd489a672756049..dcd024afef50c90974723632c879258fb1dda073 100644 +index e3df141a2a49f10e83fe132514a9b1d969cc4417..3f0e5bd457e3231d84b9d14396d8d8859989f3f4 100644 --- a/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java -@@ -1320,6 +1320,17 @@ public class ServerLevel extends Level implements WorldGenLevel { +@@ -1315,6 +1315,17 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe if (entity instanceof Player) entityhuman = (Player) entity; // CraftBukkit end diff --git a/patches/unapplied/server/0934-Deprecate-ItemStack-setType.patch b/patches/server/0927-Deprecate-ItemStack-setType.patch similarity index 89% rename from patches/unapplied/server/0934-Deprecate-ItemStack-setType.patch rename to patches/server/0927-Deprecate-ItemStack-setType.patch index e0a6acc747..e58b22013f 100644 --- a/patches/unapplied/server/0934-Deprecate-ItemStack-setType.patch +++ b/patches/server/0927-Deprecate-ItemStack-setType.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Deprecate ItemStack#setType diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemStack.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemStack.java -index a1a32a77bda0560a7b7f30a5d1c1837ee96997d3..9be7859ccb5283b2040ba68d72d6dbdafb4d6835 100644 +index ffd7ba14be38a117f5a7d7035a8d71a20fb1c4fc..7228d43d331de16cbaa0e97c7e3fa45c0bc89558 100644 --- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemStack.java +++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemStack.java -@@ -417,4 +417,24 @@ public final class CraftItemStack extends ItemStack { +@@ -429,4 +429,24 @@ public final class CraftItemStack extends ItemStack { static boolean hasItemMeta(net.minecraft.world.item.ItemStack item) { return !(item == null || item.getComponentsPatch().isEmpty()); } diff --git a/patches/unapplied/server/0935-Add-CartographyItemEvent.patch b/patches/server/0928-Add-CartographyItemEvent.patch similarity index 91% rename from patches/unapplied/server/0935-Add-CartographyItemEvent.patch rename to patches/server/0928-Add-CartographyItemEvent.patch index 9e48767381..ca08d014f8 100644 --- a/patches/unapplied/server/0935-Add-CartographyItemEvent.patch +++ b/patches/server/0928-Add-CartographyItemEvent.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Add CartographyItemEvent diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index d377804026f3f5cf80a623228d24e09c56ef0dae..fb935b505ec048522f9ab5d689b2c64c64f401a7 100644 +index 8b5be8870a0077b82e345027b323b8b4f448f231..80755a80dfd484af361c208fd4de309ca7ef8553 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -@@ -3108,6 +3108,19 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl +@@ -3125,6 +3125,19 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl } } @@ -29,7 +29,7 @@ index d377804026f3f5cf80a623228d24e09c56ef0dae..fb935b505ec048522f9ab5d689b2c64c AbstractContainerMenu oldContainer = this.player.containerMenu; // SPIGOT-1224 this.cserver.getPluginManager().callEvent(event); diff --git a/src/main/java/net/minecraft/world/inventory/CartographyTableMenu.java b/src/main/java/net/minecraft/world/inventory/CartographyTableMenu.java -index ab98637bf967ac19f0bc06e8cb7f18a8b13ec809..a90e2c56c54797b2fec40eb3865835c5f640a544 100644 +index b3a16b024e46ee8203b225ee429a5c973eab12c6..dc42d42ef91bc3e49f967c0a30a0d1b56e09cf21 100644 --- a/src/main/java/net/minecraft/world/inventory/CartographyTableMenu.java +++ b/src/main/java/net/minecraft/world/inventory/CartographyTableMenu.java @@ -71,7 +71,7 @@ public class CartographyTableMenu extends AbstractContainerMenu { diff --git a/patches/unapplied/server/0936-More-Raid-API.patch b/patches/server/0929-More-Raid-API.patch similarity index 93% rename from patches/unapplied/server/0936-More-Raid-API.patch rename to patches/server/0929-More-Raid-API.patch index 8824526cad..6e3632dd09 100644 --- a/patches/unapplied/server/0936-More-Raid-API.patch +++ b/patches/server/0929-More-Raid-API.patch @@ -7,7 +7,7 @@ Subject: [PATCH] More Raid API public net.minecraft.world.entity.raid.Raid raidEvent diff --git a/src/main/java/net/minecraft/world/entity/raid/Raid.java b/src/main/java/net/minecraft/world/entity/raid/Raid.java -index fe2a01ae8207c97203d331bbab51699502b977e2..dcbef04bbaab988096bf416163264833e84d1967 100644 +index 28922f2a1cf4762d5d7d09635b9268c6091300c3..11cf2d9def087b0898c828eaa21eb5f7b8811d5f 100644 --- a/src/main/java/net/minecraft/world/entity/raid/Raid.java +++ b/src/main/java/net/minecraft/world/entity/raid/Raid.java @@ -107,6 +107,11 @@ public class Raid { @@ -34,7 +34,7 @@ index fe2a01ae8207c97203d331bbab51699502b977e2..dcbef04bbaab988096bf416163264833 } -@@ -867,6 +877,11 @@ public class Raid { +@@ -862,6 +872,11 @@ public class Raid { } nbt.put("HeroesOfTheVillage", nbttaglist); @@ -86,10 +86,10 @@ index b8ce1c1c2447f9cff1717bfcfd6eb911ade0d4b3..51f21af9d75769abdcba713b9aa33392 + // Paper end - more Raid API } diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java -index f27568d26e02b5244a84d0fb6d8c1d9f14b7a519..e8404d5bad60b8fa290f334d3c64ee5503e01e5c 100644 +index 1675ad5818340f21c7e5b6982af315bcad30240b..149377347fc632358a8bb97e644b1c4ab9be413d 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java -@@ -2313,6 +2313,14 @@ public class CraftWorld extends CraftRegionAccessor implements World { +@@ -2326,6 +2326,14 @@ public class CraftWorld extends CraftRegionAccessor implements World { return (raid == null) ? null : new CraftRaid(raid); } diff --git a/patches/unapplied/server/0937-Add-onboarding-message-for-initial-server-start.patch b/patches/server/0930-Add-onboarding-message-for-initial-server-start.patch similarity index 95% rename from patches/unapplied/server/0937-Add-onboarding-message-for-initial-server-start.patch rename to patches/server/0930-Add-onboarding-message-for-initial-server-start.patch index 5bb4e9d2fc..f6da9e5a3d 100644 --- a/patches/unapplied/server/0937-Add-onboarding-message-for-initial-server-start.patch +++ b/patches/server/0930-Add-onboarding-message-for-initial-server-start.patch @@ -17,7 +17,7 @@ index d9502ba028a96f9cc846f9ed428bd8066b857ca3..87e5f614ba988547a827486740db217e node = loader.load(); this.verifyGlobalConfigVersion(node); diff --git a/src/main/java/io/papermc/paper/configuration/GlobalConfiguration.java b/src/main/java/io/papermc/paper/configuration/GlobalConfiguration.java -index 917bd0c1dd8f356edc3741ee59d24e4d090af182..f19b4a17a7e22969f7b51d3bea4056b41ab25484 100644 +index 73e8a524925ed6f2580d3bd01616646fabafda78..450a1cc8f1624dce2daf52210d017e0732b1bdf7 100644 --- a/src/main/java/io/papermc/paper/configuration/GlobalConfiguration.java +++ b/src/main/java/io/papermc/paper/configuration/GlobalConfiguration.java @@ -27,6 +27,7 @@ public class GlobalConfiguration extends ConfigurationPart { @@ -29,10 +29,10 @@ index 917bd0c1dd8f356edc3741ee59d24e4d090af182..f19b4a17a7e22969f7b51d3bea4056b4 return instance; } diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index 3ee0e2adf576e312c18da90adc46160ad85179fb..42a74f5471da882d63c194b1e212f78a94b103ec 100644 +index f1b1be0caff83720d77454d333abae4613c66e72..f575c0042f67c70df0ddb1d1db68e0138cf0b534 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java -@@ -1135,6 +1135,16 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop modifiers, Map> modifierFunctions, boolean cancelled) { CraftDamageSource bukkitDamageSource = new CraftDamageSource(source); diff --git a/patches/unapplied/server/0943-Fix-creation-of-invalid-block-entity-during-world-ge.patch b/patches/server/0936-Fix-creation-of-invalid-block-entity-during-world-ge.patch similarity index 93% rename from patches/unapplied/server/0943-Fix-creation-of-invalid-block-entity-during-world-ge.patch rename to patches/server/0936-Fix-creation-of-invalid-block-entity-during-world-ge.patch index 8e09c4fb05..f476845b96 100644 --- a/patches/unapplied/server/0943-Fix-creation-of-invalid-block-entity-during-world-ge.patch +++ b/patches/server/0936-Fix-creation-of-invalid-block-entity-during-world-ge.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Fix creation of invalid block entity during world generation diff --git a/src/main/java/net/minecraft/server/level/WorldGenRegion.java b/src/main/java/net/minecraft/server/level/WorldGenRegion.java -index 682c8cfbd917c086072f1756861a340800ea40da..b26a4a38144ec1b171db911bbf949b53ed35708f 100644 +index 2e72e92762877b28dd908711671e1dfb933de9b0..b7d29389a357f142237cecd75f8ca91cf1eb6b5b 100644 --- a/src/main/java/net/minecraft/server/level/WorldGenRegion.java +++ b/src/main/java/net/minecraft/server/level/WorldGenRegion.java @@ -324,7 +324,7 @@ public class WorldGenRegion implements WorldGenLevel { @@ -36,10 +36,10 @@ index 682c8cfbd917c086072f1756861a340800ea40da..b26a4a38144ec1b171db911bbf949b53 nbttagcompound.putInt("x", pos.getX()); diff --git a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java -index 59f9ff720e92c69e11afe7f6ccecd81b0e54a74d..86eb9029969f4de3ada7be9e135e9764172b85f5 100644 +index 7181acfafad91aa5f6ab7ce663d9be4a1b65b02a..5dd1df0da1f954778aebe0f40611ae0f3a7866ab 100644 --- a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java +++ b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java -@@ -961,9 +961,14 @@ public class LevelChunk extends ChunkAccess { +@@ -994,9 +994,14 @@ public class LevelChunk extends ChunkAccess { if (this.blockEntity.getType().isValid(iblockdata)) { this.ticker.tick(LevelChunk.this.level, this.blockEntity.getBlockPos(), iblockdata, this.blockEntity); this.loggedInvalidBlockState = false; diff --git a/patches/server/0937-Fix-possible-StackOverflowError-for-some-dispenses.patch b/patches/server/0937-Fix-possible-StackOverflowError-for-some-dispenses.patch new file mode 100644 index 0000000000..7e0fabb39a --- /dev/null +++ b/patches/server/0937-Fix-possible-StackOverflowError-for-some-dispenses.patch @@ -0,0 +1,95 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Jake Potrebic +Date: Sat, 29 Oct 2022 17:02:42 -0700 +Subject: [PATCH] Fix possible StackOverflowError for some dispenses + +For saddles, carpets, horse armor, and chests for horse-likes +a BlockDispenseEvent handler that always mutated the item without +changing the type would result in a SO error because when it went +to find the replacement dispense behavior (since the item "changed") +it didn't properly handle if the replacement was the same instance +of dispense behavior. + +Additionally equippable mob heads, wither skulls, and carved pumpkins +are subject to the same possible error. + +diff --git a/src/main/java/net/minecraft/core/dispenser/DispenseItemBehavior.java b/src/main/java/net/minecraft/core/dispenser/DispenseItemBehavior.java +index 18304349c9ab24657c4152aff800dba969174665..63b8c806b6ee0ea3cc5e6a7f613b5e57c94bfcf1 100644 +--- a/src/main/java/net/minecraft/core/dispenser/DispenseItemBehavior.java ++++ b/src/main/java/net/minecraft/core/dispenser/DispenseItemBehavior.java +@@ -232,7 +232,7 @@ public interface DispenseItemBehavior { + // Chain to handler for new item + ItemStack eventStack = CraftItemStack.asNMSCopy(event.getItem()); + DispenseItemBehavior idispensebehavior = (DispenseItemBehavior) DispenserBlock.DISPENSER_REGISTRY.get(eventStack.getItem()); +- if (idispensebehavior != DispenseItemBehavior.NOOP && idispensebehavior != EquipmentDispenseItemBehavior.INSTANCE) { ++ if (idispensebehavior != DispenseItemBehavior.NOOP && idispensebehavior != EquipmentDispenseItemBehavior.INSTANCE && idispensebehavior != this) { // Paper - fix possible StackOverflowError + idispensebehavior.dispense(pointer, eventStack); + return stack; + } +@@ -283,7 +283,7 @@ public interface DispenseItemBehavior { + // Chain to handler for new item + ItemStack eventStack = CraftItemStack.asNMSCopy(event.getItem()); + DispenseItemBehavior idispensebehavior = (DispenseItemBehavior) DispenserBlock.DISPENSER_REGISTRY.get(eventStack.getItem()); +- if (idispensebehavior != DispenseItemBehavior.NOOP && idispensebehavior != EquipmentDispenseItemBehavior.INSTANCE) { ++ if (idispensebehavior != DispenseItemBehavior.NOOP && idispensebehavior != EquipmentDispenseItemBehavior.INSTANCE && idispensebehavior != this) { // Paper - fix possible StackOverflowError + idispensebehavior.dispense(pointer, eventStack); + return stack; + } +@@ -645,7 +645,7 @@ public interface DispenseItemBehavior { + stack.shrink(1); + this.setSuccess(true); + } else { +- this.setSuccess(EquipmentDispenseItemBehavior.dispenseEquipment(pointer, stack)); ++ this.setSuccess(EquipmentDispenseItemBehavior.dispenseEquipment(pointer, stack, this)); // Paper - fix possible StackOverflowError + } + + return stack; +@@ -691,7 +691,7 @@ public interface DispenseItemBehavior { + stack.shrink(1); + this.setSuccess(true); + } else { +- this.setSuccess(EquipmentDispenseItemBehavior.dispenseEquipment(pointer, stack)); ++ this.setSuccess(EquipmentDispenseItemBehavior.dispenseEquipment(pointer, stack, this)); // Paper - fix possible StackOverflowError + } + + return stack; +@@ -819,7 +819,7 @@ public interface DispenseItemBehavior { + // Chain to handler for new item + ItemStack eventStack = CraftItemStack.asNMSCopy(event.getItem()); + DispenseItemBehavior idispensebehavior = (DispenseItemBehavior) DispenserBlock.DISPENSER_REGISTRY.get(eventStack.getItem()); +- if (idispensebehavior != DispenseItemBehavior.NOOP && idispensebehavior != EquipmentDispenseItemBehavior.INSTANCE) { ++ if (idispensebehavior != DispenseItemBehavior.NOOP && idispensebehavior != EquipmentDispenseItemBehavior.INSTANCE && idispensebehavior != this) { // Paper - fix possible StackOverflowError + idispensebehavior.dispense(pointer, eventStack); + return stack; + } +diff --git a/src/main/java/net/minecraft/core/dispenser/EquipmentDispenseItemBehavior.java b/src/main/java/net/minecraft/core/dispenser/EquipmentDispenseItemBehavior.java +index a03cc350973fda213251cad273a2db86f438904b..036dd3b15dfee4cd079710eba1255d2bdb4d7220 100644 +--- a/src/main/java/net/minecraft/core/dispenser/EquipmentDispenseItemBehavior.java ++++ b/src/main/java/net/minecraft/core/dispenser/EquipmentDispenseItemBehavior.java +@@ -23,10 +23,15 @@ public class EquipmentDispenseItemBehavior extends DefaultDispenseItemBehavior { + + @Override + protected ItemStack execute(BlockSource pointer, ItemStack stack) { +- return EquipmentDispenseItemBehavior.dispenseEquipment(pointer, stack) ? stack : super.execute(pointer, stack); ++ return EquipmentDispenseItemBehavior.dispenseEquipment(pointer, stack, null) ? stack : super.execute(pointer, stack); // Paper - fix possible StackOverflowError + } + +- public static boolean dispenseEquipment(BlockSource pointer, ItemStack stack) { ++ @Deprecated @io.papermc.paper.annotation.DoNotUse // Paper ++ public static boolean dispenseEquipment(BlockSource pointer, ItemStack armor) { ++ // Paper start ++ return dispenseEquipment(pointer, armor, null); ++ } ++ public static boolean dispenseEquipment(BlockSource pointer, ItemStack stack, @javax.annotation.Nullable DispenseItemBehavior currentBehavior) { + BlockPos blockposition = pointer.pos().relative((Direction) pointer.state().getValue(DispenserBlock.FACING)); + List list = pointer.level().getEntitiesOfClass(LivingEntity.class, new AABB(blockposition), (entityliving) -> { + return entityliving.canEquipWithDispenser(stack); +@@ -59,7 +64,7 @@ public class EquipmentDispenseItemBehavior extends DefaultDispenseItemBehavior { + // Chain to handler for new item + ItemStack eventStack = CraftItemStack.asNMSCopy(event.getItem()); + DispenseItemBehavior idispensebehavior = (DispenseItemBehavior) DispenserBlock.DISPENSER_REGISTRY.get(eventStack.getItem()); +- if (idispensebehavior != DispenseItemBehavior.NOOP && idispensebehavior != EquipmentDispenseItemBehavior.INSTANCE) { ++ if (idispensebehavior != DispenseItemBehavior.NOOP && (currentBehavior == null || idispensebehavior != EquipmentDispenseItemBehavior.INSTANCE)) { // Paper - fix possible StackOverflowError + idispensebehavior.dispense(pointer, eventStack); + return true; + } diff --git a/patches/unapplied/server/0945-Improve-tag-parser-handling.patch b/patches/server/0938-Improve-tag-parser-handling.patch similarity index 92% rename from patches/unapplied/server/0945-Improve-tag-parser-handling.patch rename to patches/server/0938-Improve-tag-parser-handling.patch index 9ffa70e388..91b570e5aa 100644 --- a/patches/unapplied/server/0945-Improve-tag-parser-handling.patch +++ b/patches/server/0938-Improve-tag-parser-handling.patch @@ -167,27 +167,18 @@ index df26c39a2bb20e2021b50211dce905483a77f4e6..5634122dac8afeecab0cde623e9868d8 text -> stream.map(Component::literal) .reduce((accumulator, current) -> accumulator.append(text).append(current)) diff --git a/src/main/java/net/minecraft/network/chat/contents/SelectorContents.java b/src/main/java/net/minecraft/network/chat/contents/SelectorContents.java -index 1337853badf8e124aa8439ce33a255bc4164125b..933388a60eda2af259d4ef761e31c5abb69c31fd 100644 +index 5e87f5a2bbffe2eba3fc4fb0da51acee99e72fc2..4131067620f723be28a6cdb7508e14d7e2aed48b 100644 --- a/src/main/java/net/minecraft/network/chat/contents/SelectorContents.java +++ b/src/main/java/net/minecraft/network/chat/contents/SelectorContents.java -@@ -50,7 +50,7 @@ public class SelectorContents implements ComponentContents { - EntitySelectorParser entitySelectorParser = new EntitySelectorParser(new StringReader(pattern), true); - entitySelector = entitySelectorParser.parse(); - } catch (CommandSyntaxException var3) { -- LOGGER.warn("Invalid selector component: {}: {}", pattern, var3.getMessage()); -+ return null; // Paper - } - - return entitySelector; -@@ -77,7 +77,7 @@ public class SelectorContents implements ComponentContents { - @Override - public MutableComponent resolve(@Nullable CommandSourceStack source, @Nullable Entity sender, int depth) throws CommandSyntaxException { - if (source != null && this.selector != null) { +@@ -36,7 +36,7 @@ public record SelectorContents(SelectorPattern selector, Optional sep + if (source == null) { + return Component.empty(); + } else { - Optional optional = ComponentUtils.updateForEntity(source, this.separator, sender, depth); + Optional optional = ComponentUtils.updateSeparatorForEntity(source, this.separator, sender, depth); // Paper - validate separator - return ComponentUtils.formatList(this.selector.findEntities(source), optional, Entity::getDisplayName); - } else { - return Component.empty(); + return ComponentUtils.formatList(this.selector.resolved().findEntities(source), optional, Entity::getDisplayName); + } + } diff --git a/src/main/java/net/minecraft/network/chat/contents/TranslatableContents.java b/src/main/java/net/minecraft/network/chat/contents/TranslatableContents.java index 56e641bc5f6edc657647993ea2efbb7bb9c2f732..4aa6232bf0f72fcde32d257100bd15b1c5192aaa 100644 --- a/src/main/java/net/minecraft/network/chat/contents/TranslatableContents.java @@ -248,10 +239,10 @@ index 898b19887ed34c87003fc63cb5905df2ba6234a5..b47eeb23055b135d5567552ba983bfbc private void write(FriendlyByteBuf buf) { diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index fb935b505ec048522f9ab5d689b2c64c64f401a7..e0c46e548a34c963750c9411dfd3c0946d67a7c7 100644 +index 80755a80dfd484af361c208fd4de309ca7ef8553..74b70c7a41d03bae57e1b2863b7ce947f951da46 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -@@ -766,6 +766,13 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl +@@ -770,6 +770,13 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl return; } // Paper end - Don't suggest if tab-complete is disabled @@ -265,7 +256,7 @@ index fb935b505ec048522f9ab5d689b2c64c64f401a7..e0c46e548a34c963750c9411dfd3c094 // Paper start - AsyncTabCompleteEvent TAB_COMPLETE_EXECUTOR.execute(() -> this.handleCustomCommandSuggestions0(packet)); } -@@ -818,6 +825,13 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl +@@ -822,6 +829,13 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl private void sendServerSuggestions(final ServerboundCommandSuggestionPacket packet, final StringReader stringreader) { // Paper end - AsyncTabCompleteEvent ParseResults parseresults = this.server.getCommands().getDispatcher().parse(stringreader, this.player.createCommandSourceStack()); diff --git a/patches/unapplied/server/0946-Item-Mutation-Fixes.patch b/patches/server/0939-Item-Mutation-Fixes.patch similarity index 90% rename from patches/unapplied/server/0946-Item-Mutation-Fixes.patch rename to patches/server/0939-Item-Mutation-Fixes.patch index bad3be61f9..f7242e591f 100644 --- a/patches/unapplied/server/0946-Item-Mutation-Fixes.patch +++ b/patches/server/0939-Item-Mutation-Fixes.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Item Mutation Fixes diff --git a/src/main/java/net/minecraft/world/inventory/EnchantmentMenu.java b/src/main/java/net/minecraft/world/inventory/EnchantmentMenu.java -index fff1c39920e7d7051dfe3dd39c77865d3bdf113e..1ef014b29645ed09ccffb898f1819428c3dc6259 100644 +index 36496144dd6fa87163b692034570eba70c83678c..b7300052f3c3d496ea41b681a2d5d5b554e67c63 100644 --- a/src/main/java/net/minecraft/world/inventory/EnchantmentMenu.java +++ b/src/main/java/net/minecraft/world/inventory/EnchantmentMenu.java -@@ -232,7 +232,7 @@ public class EnchantmentMenu extends AbstractContainerMenu { +@@ -220,7 +220,7 @@ public class EnchantmentMenu extends AbstractContainerMenu { return false; } else if (this.costs[id] > 0 && !itemstack.isEmpty() && (player.experienceLevel >= j && player.experienceLevel >= this.costs[id] || player.getAbilities().instabuild)) { this.access.execute((world, blockposition) -> { @@ -17,7 +17,7 @@ index fff1c39920e7d7051dfe3dd39c77865d3bdf113e..1ef014b29645ed09ccffb898f1819428 List list = this.getEnchantmentList(world.registryAccess(), itemstack, id, this.costs[id]); // CraftBukkit start -@@ -255,10 +255,16 @@ public class EnchantmentMenu extends AbstractContainerMenu { +@@ -243,10 +243,16 @@ public class EnchantmentMenu extends AbstractContainerMenu { return; } // CraftBukkit end diff --git a/patches/unapplied/server/0947-Per-world-ticks-per-spawn-settings.patch b/patches/server/0940-Per-world-ticks-per-spawn-settings.patch similarity index 90% rename from patches/unapplied/server/0947-Per-world-ticks-per-spawn-settings.patch rename to patches/server/0940-Per-world-ticks-per-spawn-settings.patch index 0d7c9ea5b4..a028a8c234 100644 --- a/patches/unapplied/server/0947-Per-world-ticks-per-spawn-settings.patch +++ b/patches/server/0940-Per-world-ticks-per-spawn-settings.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Per world ticks per spawn settings diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java -index 471fd54edf6aa962d997878ee638974f7f594fa8..b7bf7b3b91046c81467aeb483087e12b6d9191bf 100644 +index 83537aa240ebff8dd19b450956730dc3d4f355a0..ffe894f3034a967f7e3d820c6416acb8adbcfb84 100644 --- a/src/main/java/net/minecraft/world/level/Level.java +++ b/src/main/java/net/minecraft/world/level/Level.java @@ -186,6 +186,15 @@ public abstract class Level implements LevelAccessor, AutoCloseable { @@ -22,9 +22,9 @@ index 471fd54edf6aa962d997878ee638974f7f594fa8..b7bf7b3b91046c81467aeb483087e12b + } + // Paper end - public abstract ResourceKey getTypeKey(); -@@ -198,7 +207,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable { + public abstract ResourceKey getTypeKey(); +@@ -199,7 +208,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable { // CraftBukkit Ticks things for (SpawnCategory spawnCategory : SpawnCategory.values()) { if (CraftSpawnCategory.isValidForLimits(spawnCategory)) { diff --git a/patches/unapplied/server/0948-Properly-track-the-changed-item-from-dispense-events.patch b/patches/server/0941-Properly-track-the-changed-item-from-dispense-events.patch similarity index 73% rename from patches/unapplied/server/0948-Properly-track-the-changed-item-from-dispense-events.patch rename to patches/server/0941-Properly-track-the-changed-item-from-dispense-events.patch index 2dc797fea7..4b58da1d33 100644 --- a/patches/unapplied/server/0948-Properly-track-the-changed-item-from-dispense-events.patch +++ b/patches/server/0941-Properly-track-the-changed-item-from-dispense-events.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Properly track the changed item from dispense events diff --git a/src/main/java/net/minecraft/core/dispenser/DispenseItemBehavior.java b/src/main/java/net/minecraft/core/dispenser/DispenseItemBehavior.java -index 0c0b8a49b3342cd015381c6a93fab23c32cd32e6..60d3319016beb4f60cbc26dde165f64cf7577602 100644 +index 63b8c806b6ee0ea3cc5e6a7f613b5e57c94bfcf1..cd77e86ff289634d2dd1c56002e569ff70d15f25 100644 --- a/src/main/java/net/minecraft/core/dispenser/DispenseItemBehavior.java +++ b/src/main/java/net/minecraft/core/dispenser/DispenseItemBehavior.java -@@ -134,10 +134,14 @@ public interface DispenseItemBehavior { +@@ -129,10 +129,14 @@ public interface DispenseItemBehavior { idispensebehavior.dispense(pointer, eventStack); return stack; } @@ -19,12 +19,12 @@ index 0c0b8a49b3342cd015381c6a93fab23c32cd32e6..60d3319016beb4f60cbc26dde165f64c } try { -- entitytypes.spawn(pointer.level(), stack, (Player) null, pointer.pos().relative(enumdirection), MobSpawnType.DISPENSER, enumdirection != Direction.UP, false); -+ entitytypes.spawn(pointer.level(), itemstack1, (Player) null, pointer.pos().relative(enumdirection), MobSpawnType.DISPENSER, enumdirection != Direction.UP, false); // Paper - track changed item in dispense event +- entitytypes.spawn(pointer.level(), stack, (Player) null, pointer.pos().relative(enumdirection), EntitySpawnReason.DISPENSER, enumdirection != Direction.UP, false); ++ entitytypes.spawn(pointer.level(), itemstack1, (Player) null, pointer.pos().relative(enumdirection), EntitySpawnReason.DISPENSER, enumdirection != Direction.UP, false); // Paper - track changed item in dispense event } catch (Exception exception) { DispenseItemBehavior.LOGGER.error("Error while dispensing spawn egg from dispenser at {}", pointer.pos(), exception); // CraftBukkit - decompile error return ItemStack.EMPTY; -@@ -192,9 +196,10 @@ public interface DispenseItemBehavior { +@@ -186,9 +190,10 @@ public interface DispenseItemBehavior { } // CraftBukkit end @@ -33,19 +33,19 @@ index 0c0b8a49b3342cd015381c6a93fab23c32cd32e6..60d3319016beb4f60cbc26dde165f64c entityarmorstand.setYRot(enumdirection.toYRot()); - }, worldserver, stack, (Player) null); + }, worldserver, newStack, (Player) null); // Paper - track changed items in the dispense event - ArmorStand entityarmorstand = (ArmorStand) EntityType.ARMOR_STAND.spawn(worldserver, consumer, blockposition, MobSpawnType.DISPENSER, false, false); + ArmorStand entityarmorstand = (ArmorStand) EntityType.ARMOR_STAND.spawn(worldserver, consumer, blockposition, EntitySpawnReason.DISPENSER, false, false); if (entityarmorstand != null) { -@@ -244,7 +249,7 @@ public interface DispenseItemBehavior { +@@ -237,7 +242,7 @@ public interface DispenseItemBehavior { return stack; } } - ((Saddleable) list.get(0)).equipSaddle(itemstack1, SoundSource.BLOCKS); + ((Saddleable) list.get(0)).equipSaddle(CraftItemStack.asNMSCopy(event.getItem()), SoundSource.BLOCKS); // Paper - track changed items in dispense event // CraftBukkit end - if (shrink) stack.shrink(1); // Paper - actually handle here this.setSuccess(true); -@@ -414,6 +419,7 @@ public interface DispenseItemBehavior { + return stack; +@@ -330,6 +335,7 @@ public interface DispenseItemBehavior { int y = blockposition.getY(); int z = blockposition.getZ(); BlockState iblockdata = worldserver.getBlockState(blockposition); @@ -53,7 +53,7 @@ index 0c0b8a49b3342cd015381c6a93fab23c32cd32e6..60d3319016beb4f60cbc26dde165f64c // Paper start - correctly check if the bucket place will succeed /* Taken from SolidBucketItem#emptyContents */ boolean willEmptyContentsSolidBucketItem = dispensiblecontaineritem instanceof net.minecraft.world.item.SolidBucketItem && worldserver.isInWorldBounds(blockposition) && iblockdata.isAir(); -@@ -443,12 +449,15 @@ public interface DispenseItemBehavior { +@@ -359,12 +365,15 @@ public interface DispenseItemBehavior { } } @@ -72,28 +72,20 @@ index 0c0b8a49b3342cd015381c6a93fab23c32cd32e6..60d3319016beb4f60cbc26dde165f64c } else { return this.defaultDispenseItemBehavior.dispense(pointer, stack); diff --git a/src/main/java/net/minecraft/core/dispenser/ProjectileDispenseBehavior.java b/src/main/java/net/minecraft/core/dispenser/ProjectileDispenseBehavior.java -index 985954030654d521291cccbfc3ca49b67ee4357d..e37d2d29f3ba67cfe28abe4847a3dca07121f0be 100644 +index a9d230d6ff22d5e3a11b2f31e7d751f44888a12c..df495161a5842cf38518adabd359bb35193ee2b3 100644 --- a/src/main/java/net/minecraft/core/dispenser/ProjectileDispenseBehavior.java +++ b/src/main/java/net/minecraft/core/dispenser/ProjectileDispenseBehavior.java -@@ -36,7 +36,7 @@ public class ProjectileDispenseBehavior extends DefaultDispenseItemBehavior { - ServerLevel worldserver = pointer.level(); - Direction enumdirection = (Direction) pointer.state().getValue(DispenserBlock.FACING); - Position iposition = this.dispenseConfig.positionFunction().getDispensePosition(pointer, enumdirection); -- Projectile iprojectile = this.projectileItem.asProjectile(worldserver, iposition, stack, enumdirection); -+ // Paper - move down - - // CraftBukkit start - // this.projectileItem.shoot(iprojectile, (double) enumdirection.getStepX(), (double) enumdirection.getStepY(), (double) enumdirection.getStepZ(), this.dispenseConfig.power(), this.dispenseConfig.uncertainty()); -@@ -66,6 +66,7 @@ public class ProjectileDispenseBehavior extends DefaultDispenseItemBehavior { +@@ -64,7 +64,7 @@ public class ProjectileDispenseBehavior extends DefaultDispenseItemBehavior { } } -+ Projectile iprojectile = this.projectileItem.asProjectile(worldserver, iposition, CraftItemStack.unwrap(event.getItem()), enumdirection); // Paper - move from above and track changed items in the dispense event; unwrap is safe here because all uses of the stack make their own copies - this.projectileItem.shoot(iprojectile, event.getVelocity().getX(), event.getVelocity().getY(), event.getVelocity().getZ(), this.dispenseConfig.power(), this.dispenseConfig.uncertainty()); +- Projectile iprojectile = Projectile.spawnProjectileUsingShoot(this.projectileItem.asProjectile(worldserver, iposition, stack, enumdirection), worldserver, stack, event.getVelocity().getX(), event.getVelocity().getY(), event.getVelocity().getZ(), this.dispenseConfig.power(), this.dispenseConfig.uncertainty()); ++ Projectile iprojectile = Projectile.spawnProjectileUsingShoot(this.projectileItem.asProjectile(worldserver, iposition, CraftItemStack.unwrap(event.getItem()), enumdirection), worldserver, stack, event.getVelocity().getX(), event.getVelocity().getY(), event.getVelocity().getZ(), this.dispenseConfig.power(), this.dispenseConfig.uncertainty()); // Paper - mtrack changed items in the dispense event; unwrap is safe here because all uses of the stack make their own copies ((Entity) iprojectile).projectileSource = new org.bukkit.craftbukkit.projectiles.CraftBlockProjectileSource(pointer.blockEntity()); + // itemstack.shrink(1); // CraftBukkit - Handled during event processing // CraftBukkit end diff --git a/src/main/java/net/minecraft/core/dispenser/ShulkerBoxDispenseBehavior.java b/src/main/java/net/minecraft/core/dispenser/ShulkerBoxDispenseBehavior.java -index 6f2adf2334e35e8a617a4ced0c1af2abf32bbd8d..cb308808906a8cdb127df8284e106e00553473ca 100644 +index f84987c36a16df19286d6f1badfb1ffb9cc7e770..8e089f7d5e7fa9ddeccd0691185555f279d55426 100644 --- a/src/main/java/net/minecraft/core/dispenser/ShulkerBoxDispenseBehavior.java +++ b/src/main/java/net/minecraft/core/dispenser/ShulkerBoxDispenseBehavior.java @@ -57,7 +57,12 @@ public class ShulkerBoxDispenseBehavior extends OptionalDispenseItemBehavior { diff --git a/patches/unapplied/server/0949-Protect-Bedrock-and-End-Portal-Frames-from-being-des.patch b/patches/server/0942-Protect-Bedrock-and-End-Portal-Frames-from-being-des.patch similarity index 86% rename from patches/unapplied/server/0949-Protect-Bedrock-and-End-Portal-Frames-from-being-des.patch rename to patches/server/0942-Protect-Bedrock-and-End-Portal-Frames-from-being-des.patch index 89974873d2..e76c0c9c87 100644 --- a/patches/unapplied/server/0949-Protect-Bedrock-and-End-Portal-Frames-from-being-des.patch +++ b/patches/server/0942-Protect-Bedrock-and-End-Portal-Frames-from-being-des.patch @@ -12,20 +12,8 @@ So protect them from a multitude of methods of destroying them. A config is provided if you rather let players use these exploits, and let them destroy the worlds End Portals and get on top of the nether easy. -diff --git a/src/main/java/net/minecraft/world/level/Explosion.java b/src/main/java/net/minecraft/world/level/Explosion.java -index edcc9d53ad81e2b2444335ac79abde5a4e2d9d47..2109257fde8606abda4f41427f690da3b96c0175 100644 ---- a/src/main/java/net/minecraft/world/level/Explosion.java -+++ b/src/main/java/net/minecraft/world/level/Explosion.java -@@ -194,6 +194,7 @@ public class Explosion { - for (float f1 = 0.3F; f > 0.0F; f -= 0.22500001F) { - BlockPos blockposition = BlockPos.containing(d4, d5, d6); - BlockState iblockdata = this.level.getBlockState(blockposition); -+ if (!iblockdata.isDestroyable()) continue; // Paper - Protect Bedrock and End Portal/Frames from being destroyed - FluidState fluid = iblockdata.getFluidState(); // Paper - Perf: Optimize call to getFluid for explosions - - if (!this.level.isInWorldBounds(blockposition)) { diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java -index 9ca71a060f916868e70222e0cdc0f96b96bac450..751da19e147049c4f196d9b200b7baf9bebaed81 100644 +index ffe894f3034a967f7e3d820c6416acb8adbcfb84..35b9a6d382e420844fc21c88b7d8044e3b8b8368 100644 --- a/src/main/java/net/minecraft/world/level/Level.java +++ b/src/main/java/net/minecraft/world/level/Level.java @@ -447,6 +447,10 @@ public abstract class Level implements LevelAccessor, AutoCloseable { @@ -39,8 +27,20 @@ index 9ca71a060f916868e70222e0cdc0f96b96bac450..751da19e147049c4f196d9b200b7baf9 CraftBlockState blockstate = this.capturedBlockStates.get(pos); if (blockstate == null) { blockstate = CapturedBlockState.getTreeBlockState(this, pos, flags); +diff --git a/src/main/java/net/minecraft/world/level/ServerExplosion.java b/src/main/java/net/minecraft/world/level/ServerExplosion.java +index 86656de31b1e33381eddd3ef210122118b31e620..fd1ecedfab037e377e4dded61539689bacc90f80 100644 +--- a/src/main/java/net/minecraft/world/level/ServerExplosion.java ++++ b/src/main/java/net/minecraft/world/level/ServerExplosion.java +@@ -150,6 +150,7 @@ public class ServerExplosion implements Explosion { + for (float f1 = 0.3F; f > 0.0F; f -= 0.22500001F) { + BlockPos blockposition = BlockPos.containing(d4, d5, d6); + BlockState iblockdata = this.level.getBlockState(blockposition); ++ if (!iblockdata.isDestroyable()) continue; // Paper - Protect Bedrock and End Portal/Frames from being destroyed + FluidState fluid = iblockdata.getFluidState(); // Paper - Perf: Optimize call to getFluid for explosions + + if (!this.level.isInWorldBounds(blockposition)) { diff --git a/src/main/java/net/minecraft/world/level/block/Block.java b/src/main/java/net/minecraft/world/level/block/Block.java -index bf52c36f31992a01a7403d8c85151327c9e944c4..3b06c080afebde1d649f05eca0af938ba32931c1 100644 +index 9917df070d9815b6915e4a0b022dfe4e5b7861e7..729c3d8279b13d21c65ede89ea50869b69d5bfe6 100644 --- a/src/main/java/net/minecraft/world/level/block/Block.java +++ b/src/main/java/net/minecraft/world/level/block/Block.java @@ -89,6 +89,19 @@ public class Block extends BlockBehaviour implements ItemLike { @@ -64,10 +64,10 @@ index bf52c36f31992a01a7403d8c85151327c9e944c4..3b06c080afebde1d649f05eca0af938b public co.aikar.timings.Timing getTiming() { if (timing == null) { diff --git a/src/main/java/net/minecraft/world/level/block/piston/PistonBaseBlock.java b/src/main/java/net/minecraft/world/level/block/piston/PistonBaseBlock.java -index e6bfbe2588e0c2a1be14e38d654e889d392ad4db..e0c62227b279a5fe0f3868fbf9ce8c78c515a09c 100644 +index b27cf7d27672ba9ff8ade84b5a8454b19b935607..83bffe2ac011ed0cbd86149e3c803393d30a9e6e 100644 --- a/src/main/java/net/minecraft/world/level/block/piston/PistonBaseBlock.java +++ b/src/main/java/net/minecraft/world/level/block/piston/PistonBaseBlock.java -@@ -213,6 +213,12 @@ public class PistonBaseBlock extends DirectionalBlock { +@@ -216,6 +216,12 @@ public class PistonBaseBlock extends DirectionalBlock { @Override protected boolean triggerEvent(BlockState state, Level world, BlockPos pos, int type, int data) { Direction enumdirection = (Direction) state.getValue(PistonBaseBlock.FACING); @@ -80,7 +80,7 @@ index e6bfbe2588e0c2a1be14e38d654e889d392ad4db..e0c62227b279a5fe0f3868fbf9ce8c78 BlockState iblockdata1 = (BlockState) state.setValue(PistonBaseBlock.EXTENDED, true); if (!world.isClientSide) { -@@ -253,7 +259,7 @@ public class PistonBaseBlock extends DirectionalBlock { +@@ -256,7 +262,7 @@ public class PistonBaseBlock extends DirectionalBlock { } // Paper end - Fix sticky pistons and BlockPistonRetractEvent world.setBlock(pos, iblockdata2, 20); @@ -89,7 +89,7 @@ index e6bfbe2588e0c2a1be14e38d654e889d392ad4db..e0c62227b279a5fe0f3868fbf9ce8c78 world.blockUpdated(pos, iblockdata2.getBlock()); iblockdata2.updateNeighbourShapes(world, pos, 2); if (this.isSticky) { -@@ -289,7 +295,14 @@ public class PistonBaseBlock extends DirectionalBlock { +@@ -292,7 +298,14 @@ public class PistonBaseBlock extends DirectionalBlock { } } } else { @@ -106,19 +106,19 @@ index e6bfbe2588e0c2a1be14e38d654e889d392ad4db..e0c62227b279a5fe0f3868fbf9ce8c78 world.playSound((Player) null, pos, SoundEvents.PISTON_CONTRACT, SoundSource.BLOCKS, 0.5F, world.random.nextFloat() * 0.15F + 0.6F); diff --git a/src/main/java/net/minecraft/world/level/block/state/BlockBehaviour.java b/src/main/java/net/minecraft/world/level/block/state/BlockBehaviour.java -index 240c250a93289776686d09d7eae17c07d7278da5..f2036917c5ba9f536087d7ee559704055469730e 100644 +index 1b988b92e80faa1ac224caf9f9e955ac43a4c45a..95d30c2db7e291d65c24feb114b0f3598d280912 100644 --- a/src/main/java/net/minecraft/world/level/block/state/BlockBehaviour.java +++ b/src/main/java/net/minecraft/world/level/block/state/BlockBehaviour.java -@@ -174,7 +174,7 @@ public abstract class BlockBehaviour implements FeatureElement { +@@ -178,7 +178,7 @@ public abstract class BlockBehaviour implements FeatureElement { } - protected void onExplosionHit(BlockState state, Level world, BlockPos pos, Explosion explosion, BiConsumer stackMerger) { + protected void onExplosionHit(BlockState state, ServerLevel world, BlockPos pos, Explosion explosion, BiConsumer stackMerger) { - if (!state.isAir() && explosion.getBlockInteraction() != Explosion.BlockInteraction.TRIGGER_BLOCK) { + if (!state.isAir() && explosion.getBlockInteraction() != Explosion.BlockInteraction.TRIGGER_BLOCK && state.isDestroyable()) { // Paper - Protect Bedrock and End Portal/Frames from being destroyed Block block = state.getBlock(); boolean flag = explosion.getIndirectSourceEntity() instanceof Player; -@@ -254,7 +254,7 @@ public abstract class BlockBehaviour implements FeatureElement { +@@ -257,7 +257,7 @@ public abstract class BlockBehaviour implements FeatureElement { } protected boolean canBeReplaced(BlockState state, BlockPlaceContext context) { @@ -127,7 +127,7 @@ index 240c250a93289776686d09d7eae17c07d7278da5..f2036917c5ba9f536087d7ee55970405 } protected boolean canBeReplaced(BlockState state, Fluid fluid) { -@@ -883,6 +883,12 @@ public abstract class BlockBehaviour implements FeatureElement { +@@ -945,6 +945,12 @@ public abstract class BlockBehaviour implements FeatureElement { return this.legacySolid; } @@ -140,7 +140,7 @@ index 240c250a93289776686d09d7eae17c07d7278da5..f2036917c5ba9f536087d7ee55970405 public boolean isValidSpawn(BlockGetter world, BlockPos pos, EntityType type) { return this.getBlock().properties.isValidSpawn.test(this.asState(), world, pos, type); } -@@ -986,7 +992,7 @@ public abstract class BlockBehaviour implements FeatureElement { +@@ -1048,7 +1054,7 @@ public abstract class BlockBehaviour implements FeatureElement { } public PushReaction getPistonPushReaction() { @@ -148,9 +148,9 @@ index 240c250a93289776686d09d7eae17c07d7278da5..f2036917c5ba9f536087d7ee55970405 + return !this.isDestroyable() ? PushReaction.BLOCK : this.pushReaction; // Paper - Protect Bedrock and End Portal/Frames from being destroyed } - public boolean isSolidRender(BlockGetter world, BlockPos pos) { + public boolean isSolidRender() { diff --git a/src/main/java/net/minecraft/world/level/portal/PortalForcer.java b/src/main/java/net/minecraft/world/level/portal/PortalForcer.java -index 5c4b2a33d4007c36aef68604bca40a4eba510b4e..fd04a50183ccb1f21fc6efa70256e1bb4db2d6d4 100644 +index eb409fb5e673d2a343813946cc59cb5da2328eec..83d294f6f48b867d09ea0d339c779011bf4138a5 100644 --- a/src/main/java/net/minecraft/world/level/portal/PortalForcer.java +++ b/src/main/java/net/minecraft/world/level/portal/PortalForcer.java @@ -207,6 +207,13 @@ public class PortalForcer { diff --git a/patches/unapplied/server/0951-Add-config-for-mobs-immune-to-default-effects.patch b/patches/server/0943-Add-config-for-mobs-immune-to-default-effects.patch similarity index 86% rename from patches/unapplied/server/0951-Add-config-for-mobs-immune-to-default-effects.patch rename to patches/server/0943-Add-config-for-mobs-immune-to-default-effects.patch index 74dd1a1360..c3b01a16ed 100644 --- a/patches/unapplied/server/0951-Add-config-for-mobs-immune-to-default-effects.patch +++ b/patches/server/0943-Add-config-for-mobs-immune-to-default-effects.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Add config for mobs immune to default effects diff --git a/src/main/java/net/minecraft/world/entity/boss/wither/WitherBoss.java b/src/main/java/net/minecraft/world/entity/boss/wither/WitherBoss.java -index 62271e74399a827a488159da234465ef18e15e6e..d3b4d492aee380dc17f4232d90eaae4f07bb9f86 100644 +index e1be143959fbaa1d54af2a1a2c27187d70e6a9e9..244e38db508efa3eebebb6392c4ebb0805367baf 100644 --- a/src/main/java/net/minecraft/world/entity/boss/wither/WitherBoss.java +++ b/src/main/java/net/minecraft/world/entity/boss/wither/WitherBoss.java -@@ -604,7 +604,7 @@ public class WitherBoss extends Monster implements PowerableMob, RangedAttackMob +@@ -602,7 +602,7 @@ public class WitherBoss extends Monster implements RangedAttackMob { @Override public boolean canBeAffected(MobEffectInstance effect) { @@ -18,7 +18,7 @@ index 62271e74399a827a488159da234465ef18e15e6e..d3b4d492aee380dc17f4232d90eaae4f private class WitherDoNothingGoal extends Goal { diff --git a/src/main/java/net/minecraft/world/entity/monster/Spider.java b/src/main/java/net/minecraft/world/entity/monster/Spider.java -index 9045f18f49a5c6685597d0a77126d7cb35bc5e88..a30fb47559eb74b7fe634678e63a85e7e2cad9a4 100644 +index 72e42605c278028480c368762da18f61806d766a..91e521414c3ea5722aac7506b7589fbb399e9636 100644 --- a/src/main/java/net/minecraft/world/entity/monster/Spider.java +++ b/src/main/java/net/minecraft/world/entity/monster/Spider.java @@ -126,7 +126,7 @@ public class Spider extends Monster { @@ -31,7 +31,7 @@ index 9045f18f49a5c6685597d0a77126d7cb35bc5e88..a30fb47559eb74b7fe634678e63a85e7 public boolean isClimbing() { diff --git a/src/main/java/net/minecraft/world/entity/monster/WitherSkeleton.java b/src/main/java/net/minecraft/world/entity/monster/WitherSkeleton.java -index 56f23d7c7b5838ff8761de8691e685dd59d2eaa2..bb2e7cee612dc1fafa042674a0b0d07d7165b54c 100644 +index c295b604f438c62d589ab05ea44c85dbefcb258b..37d3acda84a984bf4f1c44b3d27e2102839d3e8e 100644 --- a/src/main/java/net/minecraft/world/entity/monster/WitherSkeleton.java +++ b/src/main/java/net/minecraft/world/entity/monster/WitherSkeleton.java @@ -114,6 +114,6 @@ public class WitherSkeleton extends AbstractSkeleton { diff --git a/patches/unapplied/server/0952-Deep-clone-nbt-tags-in-PDC.patch b/patches/server/0944-Deep-clone-nbt-tags-in-PDC.patch similarity index 89% rename from patches/unapplied/server/0952-Deep-clone-nbt-tags-in-PDC.patch rename to patches/server/0944-Deep-clone-nbt-tags-in-PDC.patch index 944099f209..559c6cddea 100644 --- a/patches/unapplied/server/0952-Deep-clone-nbt-tags-in-PDC.patch +++ b/patches/server/0944-Deep-clone-nbt-tags-in-PDC.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Deep clone nbt tags in PDC diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java -index f15456b02cabbbe33d701450ef53a0561d91cb8c..7ad1076de76c81c25b656e52237c2f60a2eca085 100644 +index 3bcc807005a677884255f1ee36cbf1653797ba55..8d13505c36d732f17293c6a6d65cac20919b8b7a 100644 --- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java +++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java -@@ -322,7 +322,7 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta { +@@ -372,7 +372,7 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta { this.maxDamage = meta.maxDamage; this.unhandledTags.copy(meta.unhandledTags.build()); this.removedTags.addAll(meta.removedTags); @@ -17,7 +17,7 @@ index f15456b02cabbbe33d701450ef53a0561d91cb8c..7ad1076de76c81c25b656e52237c2f60 this.customTag = meta.customTag; -@@ -1699,7 +1699,7 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta { +@@ -1966,7 +1966,7 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta { clone.customTag = this.customTag.copy(); } clone.removedTags = Sets.newHashSet(this.removedTags); @@ -25,7 +25,7 @@ index f15456b02cabbbe33d701450ef53a0561d91cb8c..7ad1076de76c81c25b656e52237c2f60 + clone.persistentDataContainer = new CraftPersistentDataContainer(this.persistentDataContainer.getTagsCloned(), CraftMetaItem.DATA_TYPE_REGISTRY); // Paper - deep clone NBT tags clone.hideFlag = this.hideFlag; clone.hideTooltip = this.hideTooltip; - clone.unbreakable = this.unbreakable; + clone.tooltipStyle = this.tooltipStyle; diff --git a/src/main/java/org/bukkit/craftbukkit/persistence/CraftPersistentDataContainer.java b/src/main/java/org/bukkit/craftbukkit/persistence/CraftPersistentDataContainer.java index 5a4e7e7150b7c137b077e0b393f17ed35b5aec34..f55fdd57ced259ad5a95878840e98ffaa3db2e05 100644 --- a/src/main/java/org/bukkit/craftbukkit/persistence/CraftPersistentDataContainer.java diff --git a/patches/unapplied/server/0944-Fix-possible-StackOverflowError-for-some-dispenses.patch b/patches/unapplied/server/0944-Fix-possible-StackOverflowError-for-some-dispenses.patch deleted file mode 100644 index 5351dde83c..0000000000 --- a/patches/unapplied/server/0944-Fix-possible-StackOverflowError-for-some-dispenses.patch +++ /dev/null @@ -1,117 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Jake Potrebic -Date: Sat, 29 Oct 2022 17:02:42 -0700 -Subject: [PATCH] Fix possible StackOverflowError for some dispenses - -For saddles, carpets, horse armor, and chests for horse-likes -a BlockDispenseEvent handler that always mutated the item without -changing the type would result in a SO error because when it went -to find the replacement dispense behavior (since the item "changed") -it didn't properly handle if the replacement was the same instance -of dispense behavior. - -Additionally equippable mob heads, wither skulls, and carved pumpkins -are subject to the same possible error. - -diff --git a/src/main/java/net/minecraft/core/dispenser/DispenseItemBehavior.java b/src/main/java/net/minecraft/core/dispenser/DispenseItemBehavior.java -index 7826e2a52da47914aca39fef958b8f398a2ff937..0c0b8a49b3342cd015381c6a93fab23c32cd32e6 100644 ---- a/src/main/java/net/minecraft/core/dispenser/DispenseItemBehavior.java -+++ b/src/main/java/net/minecraft/core/dispenser/DispenseItemBehavior.java -@@ -239,7 +239,7 @@ public interface DispenseItemBehavior { - // Chain to handler for new item - ItemStack eventStack = CraftItemStack.asNMSCopy(event.getItem()); - DispenseItemBehavior idispensebehavior = (DispenseItemBehavior) DispenserBlock.DISPENSER_REGISTRY.get(eventStack.getItem()); -- if (idispensebehavior != DispenseItemBehavior.NOOP && idispensebehavior != ArmorItem.DISPENSE_ITEM_BEHAVIOR) { -+ if (idispensebehavior != DispenseItemBehavior.NOOP && idispensebehavior != this) { // Paper - fix possible StackOverflowError - idispensebehavior.dispense(pointer, eventStack); - return stack; - } -@@ -295,7 +295,7 @@ public interface DispenseItemBehavior { - // Chain to handler for new item - ItemStack eventStack = CraftItemStack.asNMSCopy(event.getItem()); - DispenseItemBehavior idispensebehavior = (DispenseItemBehavior) DispenserBlock.DISPENSER_REGISTRY.get(eventStack.getItem()); -- if (idispensebehavior != DispenseItemBehavior.NOOP && idispensebehavior != ArmorItem.DISPENSE_ITEM_BEHAVIOR) { -+ if (idispensebehavior != DispenseItemBehavior.NOOP && idispensebehavior != this) { // Paper - fix possible StackOverflowError - idispensebehavior.dispense(pointer, eventStack); - return stack; - } -@@ -369,7 +369,7 @@ public interface DispenseItemBehavior { - // Chain to handler for new item - ItemStack eventStack = CraftItemStack.asNMSCopy(event.getItem()); - DispenseItemBehavior idispensebehavior = (DispenseItemBehavior) DispenserBlock.DISPENSER_REGISTRY.get(eventStack.getItem()); -- if (idispensebehavior != DispenseItemBehavior.NOOP && idispensebehavior != ArmorItem.DISPENSE_ITEM_BEHAVIOR) { -+ if (idispensebehavior != DispenseItemBehavior.NOOP && idispensebehavior != this) { // Paper - fix possible StackOverflowError - idispensebehavior.dispense(pointer, eventStack); - return stack; - } -@@ -690,7 +690,7 @@ public interface DispenseItemBehavior { - OptionalDispenseItemBehavior dispensebehaviormaybe1 = new OptionalDispenseItemBehavior() { - @Override - protected ItemStack execute(BlockSource pointer, ItemStack stack) { -- this.setSuccess(ArmorItem.dispenseArmor(pointer, stack)); -+ this.setSuccess(ArmorItem.dispenseArmor(pointer, stack, this)); // Paper - fix possible StackOverflowError - return stack; - } - }; -@@ -744,7 +744,7 @@ public interface DispenseItemBehavior { - stack.shrink(1); - this.setSuccess(true); - } else { -- this.setSuccess(ArmorItem.dispenseArmor(pointer, stack)); -+ this.setSuccess(ArmorItem.dispenseArmor(pointer, stack, this)); // Paper - fix possible StackOverflowError - } - - return stack; -@@ -790,7 +790,7 @@ public interface DispenseItemBehavior { - stack.shrink(1); - this.setSuccess(true); - } else { -- this.setSuccess(ArmorItem.dispenseArmor(pointer, stack)); -+ this.setSuccess(ArmorItem.dispenseArmor(pointer, stack, this)); // Paper - fix possible StackOverflowError - } - - return stack; -@@ -918,7 +918,7 @@ public interface DispenseItemBehavior { - // Chain to handler for new item - ItemStack eventStack = CraftItemStack.asNMSCopy(event.getItem()); - DispenseItemBehavior idispensebehavior = (DispenseItemBehavior) DispenserBlock.DISPENSER_REGISTRY.get(eventStack.getItem()); -- if (idispensebehavior != DispenseItemBehavior.NOOP && idispensebehavior != ArmorItem.DISPENSE_ITEM_BEHAVIOR) { -+ if (idispensebehavior != DispenseItemBehavior.NOOP && idispensebehavior != this) { // Paper - fix possible StackOverflowError - idispensebehavior.dispense(pointer, eventStack); - return stack; - } -diff --git a/src/main/java/net/minecraft/world/item/ArmorItem.java b/src/main/java/net/minecraft/world/item/ArmorItem.java -index fb518f87cc4ccd810fb32cade2fdd7e09ab0abfc..647a4601deace52f8d855f512a73671f82b4762a 100644 ---- a/src/main/java/net/minecraft/world/item/ArmorItem.java -+++ b/src/main/java/net/minecraft/world/item/ArmorItem.java -@@ -39,14 +39,20 @@ public class ArmorItem extends Item implements Equipable { - public static final DispenseItemBehavior DISPENSE_ITEM_BEHAVIOR = new DefaultDispenseItemBehavior() { - @Override - protected ItemStack execute(BlockSource pointer, ItemStack stack) { -- return ArmorItem.dispenseArmor(pointer, stack) ? stack : super.execute(pointer, stack); -+ return ArmorItem.dispenseArmor(pointer, stack, this) ? stack : super.execute(pointer, stack); // Paper - fix possible StackOverflowError - } - }; - protected final ArmorItem.Type type; - protected final Holder material; - private final Supplier defaultModifiers; - -+ @Deprecated @io.papermc.paper.annotation.DoNotUse // Paper - public static boolean dispenseArmor(BlockSource pointer, ItemStack armor) { -+ // Paper start -+ return dispenseArmor(pointer, armor, null); -+ } -+ public static boolean dispenseArmor(BlockSource pointer, ItemStack armor, @javax.annotation.Nullable DispenseItemBehavior currentBehavior) { -+ // Paper end - BlockPos blockposition = pointer.pos().relative((Direction) pointer.state().getValue(DispenserBlock.FACING)); - List list = pointer.level().getEntitiesOfClass(LivingEntity.class, new AABB(blockposition), EntitySelector.NO_SPECTATORS.and(new EntitySelector.MobCanWearArmorEntitySelector(armor))); - -@@ -77,7 +83,7 @@ public class ArmorItem extends Item implements Equipable { - // Chain to handler for new item - ItemStack eventStack = CraftItemStack.asNMSCopy(event.getItem()); - DispenseItemBehavior idispensebehavior = (DispenseItemBehavior) DispenserBlock.DISPENSER_REGISTRY.get(eventStack.getItem()); -- if (idispensebehavior != DispenseItemBehavior.NOOP && idispensebehavior != ArmorItem.DISPENSE_ITEM_BEHAVIOR) { -+ if (idispensebehavior != DispenseItemBehavior.NOOP && (currentBehavior == null || idispensebehavior != currentBehavior)) { // Paper - fix possible StackOverflowError - idispensebehavior.dispense(pointer, eventStack); - return true; - } diff --git a/patches/unapplied/server/0950-Fix-tripwire-disarming-not-working-as-intended.patch b/patches/unapplied/server/0950-Fix-tripwire-disarming-not-working-as-intended.patch deleted file mode 100644 index fa7f6bde06..0000000000 --- a/patches/unapplied/server/0950-Fix-tripwire-disarming-not-working-as-intended.patch +++ /dev/null @@ -1,22 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: DungeonDev -Date: Sun, 2 Jul 2023 02:34:54 +0100 -Subject: [PATCH] Fix tripwire disarming not working as intended - -Fixes MC-129055 - -diff --git a/src/main/java/net/minecraft/world/level/block/TripWireHookBlock.java b/src/main/java/net/minecraft/world/level/block/TripWireHookBlock.java -index 8614fad5b3df7a6030384b108b1689bf6b9f1209..76aca266d3f3222502ff4c196228f08fcd88c5f8 100644 ---- a/src/main/java/net/minecraft/world/level/block/TripWireHookBlock.java -+++ b/src/main/java/net/minecraft/world/level/block/TripWireHookBlock.java -@@ -202,9 +202,8 @@ public class TripWireHookBlock extends Block { - BlockState iblockdata4 = aiblockdata[l]; - - if (iblockdata4 != null) { -+ if (world.getBlockState(blockposition2).is(Blocks.TRIPWIRE) || io.papermc.paper.configuration.GlobalConfiguration.get().unsupportedSettings.allowTripwireDisarmingExploits) { // Paper - Fix tripwire disarming not working as intended - world.setBlock(blockposition2, (BlockState) iblockdata4.trySetValue(TripWireHookBlock.ATTACHED, flag4), 3); -- if (!world.getBlockState(blockposition2).isAir()) { -- ; - } - } - }