diff --git a/a.sh b/a.sh deleted file mode 100644 index 5e98c3969f..0000000000 --- a/a.sh +++ /dev/null @@ -1,9 +0,0 @@ -#!/bin/bash - -cd patches/server - - -for file in [0-9][0-9][0-9][0-9]-*.patch; do - suffix=$(echo $file | cut -d'-' -f2-) - mv "$file" "$suffix" -done diff --git a/patches/unapplied/server/1061-Add-onboarding-message-for-initial-server-start.patch b/patches/server/0970-Add-onboarding-message-for-initial-server-start.patch similarity index 91% rename from patches/unapplied/server/1061-Add-onboarding-message-for-initial-server-start.patch rename to patches/server/0970-Add-onboarding-message-for-initial-server-start.patch index 6210b12485..f9f8a1d3c2 100644 --- a/patches/unapplied/server/1061-Add-onboarding-message-for-initial-server-start.patch +++ b/patches/server/0970-Add-onboarding-message-for-initial-server-start.patch @@ -17,7 +17,7 @@ index c01b4393439838976965823298f12e4762e72eff..218bf89fd7583d6db9f64754c4db8fcc 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 31f34ac1c70df3ef6eb6f6dfd0f870b1b275adfa..30fe1c0645a07d663b08c0f988a1ab3a750bf7c4 100644 +index 0b283171294eca65a898ddd9ab1b7295ad183b0d..481cfe3a291196c0391c2ec8560e566e0e1e2fb8 100644 --- a/src/main/java/io/papermc/paper/configuration/GlobalConfiguration.java +++ b/src/main/java/io/papermc/paper/configuration/GlobalConfiguration.java @@ -25,6 +25,7 @@ public class GlobalConfiguration extends ConfigurationPart { @@ -29,10 +29,10 @@ index 31f34ac1c70df3ef6eb6f6dfd0f870b1b275adfa..30fe1c0645a07d663b08c0f988a1ab3a return instance; } diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index f03f6922d15541c5491e5b37a3efa7ef0abef211..2dc07e5ef249636e85ad9c78e3729e9e066a8fe8 100644 +index 1d8c63a5a0b05340396a9f7ba079eb7fceda03e2..325ba58a1c79fd928ac22d8f1ef93605357300d2 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java -@@ -1155,6 +1155,16 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop modifiers, Map> modifierFunctions, boolean cancelled) { CraftDamageSource bukkitDamageSource = new CraftDamageSource(source); -- Entity damager = source.getCausingEntity(); -+ final Entity damager = source.getCustomEventDamager(); // Paper - fix DamageSource API +- Entity damager = (bukkitDamageSource.isIndirect() && source.getDirectEntity() != null) ? source.getDirectEntity() : source.getCausingEntity(); ++ Entity damager = (bukkitDamageSource.isIndirect() && source.getDirectEntity() != null) ? source.getDirectEntity() : source.getCustomEventDamager(); // Paper - fix DamageSource API if (source.is(DamageTypeTags.IS_EXPLOSION)) { if (damager == null) { return CraftEventFactory.callEntityDamageEvent(source.getDirectBlock(), entity, DamageCause.BLOCK_EXPLOSION, bukkitDamageSource, modifiers, modifierFunctions, cancelled, source.explodedBlockState); // Paper - Include BlockState for damage -@@ -1093,9 +1093,7 @@ public class CraftEventFactory { - } else if (damager != null || source.getDirectEntity() != null) { - DamageCause cause = (source.isSweep()) ? DamageCause.ENTITY_SWEEP_ATTACK : DamageCause.ENTITY_ATTACK; - -- if (bukkitDamageSource.isIndirect() && source.getDirectEntity() != null) { -- damager = source.getDirectEntity(); -- } -+ // Paper - fix DamageSource API - - if (damager instanceof net.minecraft.world.entity.projectile.Projectile) { - if (damager.getBukkitEntity() instanceof ThrownPotion) { diff --git a/patches/unapplied/server/1064-Fix-creation-of-invalid-block-entity-during-world-ge.patch b/patches/server/0975-Fix-creation-of-invalid-block-entity-during-world-ge.patch similarity index 88% rename from patches/unapplied/server/1064-Fix-creation-of-invalid-block-entity-during-world-ge.patch rename to patches/server/0975-Fix-creation-of-invalid-block-entity-during-world-ge.patch index 5f6f4e6b9c..eecbafd499 100644 --- a/patches/unapplied/server/1064-Fix-creation-of-invalid-block-entity-during-world-ge.patch +++ b/patches/server/0975-Fix-creation-of-invalid-block-entity-during-world-ge.patch @@ -5,10 +5,10 @@ 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 5ece375eaf6bcc61864997a389bb5e24625e4505..9c3f8f79c2b3389a118dce9a1558edda52446833 100644 +index 713509e08c6325816fef7c09477d36aacb0008ef..8f8cbb9cc7febe3eb1c7de2be3953f67b0b58116 100644 --- a/src/main/java/net/minecraft/server/level/WorldGenRegion.java +++ b/src/main/java/net/minecraft/server/level/WorldGenRegion.java -@@ -352,6 +352,7 @@ public class WorldGenRegion implements WorldGenLevel { +@@ -339,6 +339,7 @@ public class WorldGenRegion implements WorldGenLevel { ichunkaccess.removeBlockEntity(pos); } } else { @@ -17,10 +17,10 @@ index 5ece375eaf6bcc61864997a389bb5e24625e4505..9c3f8f79c2b3389a118dce9a1558edda 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 6ec3fc801453fd54c25b642e6fa71c19b463311d..465458e8a7dbaf9afb32709a71c7b2620d1e1fd2 100644 +index 744db9eec4f7bdeb32f83300960a7fce63b393d8..8de6ad8b131061b2dae440dff71e2e6e7af2de39 100644 --- a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java +++ b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java -@@ -1169,9 +1169,14 @@ public class LevelChunk extends ChunkAccess { +@@ -1071,9 +1071,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/unapplied/server/1049-Fix-possible-StackOverflowError-for-some-dispenses.patch b/patches/server/0976-Fix-possible-StackOverflowError-for-some-dispenses.patch similarity index 87% rename from patches/unapplied/server/1049-Fix-possible-StackOverflowError-for-some-dispenses.patch rename to patches/server/0976-Fix-possible-StackOverflowError-for-some-dispenses.patch index c9638c6967..21910b922f 100644 --- a/patches/unapplied/server/1049-Fix-possible-StackOverflowError-for-some-dispenses.patch +++ b/patches/server/0976-Fix-possible-StackOverflowError-for-some-dispenses.patch @@ -14,10 +14,10 @@ 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 1fb809486ee56efd3d0ef3fa02503ba9be459f68..58eccc76fe4c24c364e6c634fcca60ab771a5792 100644 +index 4fa838bf97ede6e1c893ba64f53aa7af5db0405a..32084df594649d8da04052bbfa111896d8ea1f91 100644 --- a/src/main/java/net/minecraft/core/dispenser/DispenseItemBehavior.java +++ b/src/main/java/net/minecraft/core/dispenser/DispenseItemBehavior.java -@@ -348,7 +348,7 @@ public interface DispenseItemBehavior { +@@ -238,7 +238,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()); @@ -26,7 +26,7 @@ index 1fb809486ee56efd3d0ef3fa02503ba9be459f68..58eccc76fe4c24c364e6c634fcca60ab idispensebehavior.dispense(pointer, eventStack); return stack; } -@@ -404,7 +404,7 @@ public interface DispenseItemBehavior { +@@ -294,7 +294,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()); @@ -35,7 +35,7 @@ index 1fb809486ee56efd3d0ef3fa02503ba9be459f68..58eccc76fe4c24c364e6c634fcca60ab idispensebehavior.dispense(pointer, eventStack); return stack; } -@@ -478,7 +478,7 @@ public interface DispenseItemBehavior { +@@ -368,7 +368,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()); @@ -44,7 +44,7 @@ index 1fb809486ee56efd3d0ef3fa02503ba9be459f68..58eccc76fe4c24c364e6c634fcca60ab idispensebehavior.dispense(pointer, eventStack); return stack; } -@@ -924,7 +924,7 @@ public interface DispenseItemBehavior { +@@ -710,7 +710,7 @@ public interface DispenseItemBehavior { OptionalDispenseItemBehavior dispensebehaviormaybe1 = new OptionalDispenseItemBehavior() { @Override protected ItemStack execute(BlockSource pointer, ItemStack stack) { @@ -53,7 +53,7 @@ index 1fb809486ee56efd3d0ef3fa02503ba9be459f68..58eccc76fe4c24c364e6c634fcca60ab return stack; } }; -@@ -978,7 +978,7 @@ public interface DispenseItemBehavior { +@@ -764,7 +764,7 @@ public interface DispenseItemBehavior { stack.shrink(1); this.setSuccess(true); } else { @@ -62,7 +62,7 @@ index 1fb809486ee56efd3d0ef3fa02503ba9be459f68..58eccc76fe4c24c364e6c634fcca60ab } return stack; -@@ -1024,7 +1024,7 @@ public interface DispenseItemBehavior { +@@ -810,7 +810,7 @@ public interface DispenseItemBehavior { stack.shrink(1); this.setSuccess(true); } else { @@ -72,10 +72,10 @@ index 1fb809486ee56efd3d0ef3fa02503ba9be459f68..58eccc76fe4c24c364e6c634fcca60ab 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 42d87800a328f71c5127ce5599ca4c71cc9bb1cd..6b81be03f87967124b046708557e05d519aa79e4 100644 +index e766397aae3f73548b290b0809b9d1ca0967ea39..786e4a8700cb84b16dd9b8892a0d1d5803924d81 100644 --- a/src/main/java/net/minecraft/world/item/ArmorItem.java +++ b/src/main/java/net/minecraft/world/item/ArmorItem.java -@@ -43,7 +43,7 @@ public class ArmorItem extends Item implements Equipable { +@@ -48,14 +48,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) { @@ -84,9 +84,8 @@ index 42d87800a328f71c5127ce5599ca4c71cc9bb1cd..6b81be03f87967124b046708557e05d5 } }; protected final ArmorItem.Type type; -@@ -53,7 +53,13 @@ public class ArmorItem extends Item implements Equipable { - protected final ArmorMaterial material; - private final Multimap defaultModifiers; + protected final Holder material; + private final Supplier defaultModifiers; + @Deprecated @io.papermc.paper.annotation.DoNotUse // Paper public static boolean dispenseArmor(BlockSource pointer, ItemStack armor) { @@ -98,7 +97,7 @@ index 42d87800a328f71c5127ce5599ca4c71cc9bb1cd..6b81be03f87967124b046708557e05d5 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))); -@@ -84,7 +90,7 @@ public class ArmorItem extends Item implements Equipable { +@@ -86,7 +92,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()); diff --git a/patches/unapplied/server/1045-Improve-tag-parser-handling.patch b/patches/server/0977-Improve-tag-parser-handling.patch similarity index 89% rename from patches/unapplied/server/1045-Improve-tag-parser-handling.patch rename to patches/server/0977-Improve-tag-parser-handling.patch index 78cf8189d3..7c29564a49 100644 --- a/patches/unapplied/server/1045-Improve-tag-parser-handling.patch +++ b/patches/server/0977-Improve-tag-parser-handling.patch @@ -54,18 +54,18 @@ index 0000000000000000000000000000000000000000..a375ad4ba9db990b24a2b9ff366fcba6 + } +} diff --git a/src/main/java/net/minecraft/nbt/TagParser.java b/src/main/java/net/minecraft/nbt/TagParser.java -index ebe0efe488357ae895aaf752e9bc008b96db156f..c77860a141064aea6a0b510bb44d35fea90aee42 100644 +index da101bca71f4710812621b98f0a0d8cab180346a..3cd112584accb8e8f050ac99738eed11c902e60e 100644 --- a/src/main/java/net/minecraft/nbt/TagParser.java +++ b/src/main/java/net/minecraft/nbt/TagParser.java -@@ -48,6 +48,7 @@ public class TagParser { - } +@@ -49,6 +49,7 @@ public class TagParser { }, CompoundTag::toString); + public static final Codec LENIENT_CODEC = Codec.withAlternative(AS_CODEC, CompoundTag.CODEC); private final StringReader reader; + private int depth; // Paper public static CompoundTag parseTag(String string) throws CommandSyntaxException { return new TagParser(new StringReader(string)).readSingleStruct(); -@@ -158,6 +159,7 @@ public class TagParser { +@@ -159,6 +160,7 @@ public class TagParser { public CompoundTag readStruct() throws CommandSyntaxException { this.expect('{'); @@ -73,7 +73,7 @@ index ebe0efe488357ae895aaf752e9bc008b96db156f..c77860a141064aea6a0b510bb44d35fe CompoundTag compoundTag = new CompoundTag(); this.reader.skipWhitespace(); -@@ -181,6 +183,7 @@ public class TagParser { +@@ -182,6 +184,7 @@ public class TagParser { } this.expect('}'); @@ -81,7 +81,7 @@ index ebe0efe488357ae895aaf752e9bc008b96db156f..c77860a141064aea6a0b510bb44d35fe return compoundTag; } -@@ -190,6 +193,7 @@ public class TagParser { +@@ -191,6 +194,7 @@ public class TagParser { if (!this.reader.canRead()) { throw ERROR_EXPECTED_VALUE.createWithContext(this.reader); } else { @@ -89,7 +89,7 @@ index ebe0efe488357ae895aaf752e9bc008b96db156f..c77860a141064aea6a0b510bb44d35fe ListTag listTag = new ListTag(); TagType tagType = null; -@@ -215,6 +219,7 @@ public class TagParser { +@@ -216,6 +220,7 @@ public class TagParser { } this.expect(']'); @@ -97,7 +97,7 @@ index ebe0efe488357ae895aaf752e9bc008b96db156f..c77860a141064aea6a0b510bb44d35fe return listTag; } } -@@ -287,4 +292,11 @@ public class TagParser { +@@ -288,4 +293,11 @@ public class TagParser { this.reader.skipWhitespace(); this.reader.expect(c); } @@ -110,7 +110,7 @@ index ebe0efe488357ae895aaf752e9bc008b96db156f..c77860a141064aea6a0b510bb44d35fe + } } 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 65debad7aa7ffb1b0b19f89713ff394e8c9d245e..18e53db59082bae94922edc4baa812aa6f089576 100644 +index 56e641bc5f6edc657647993ea2efbb7bb9c2f732..4aa6232bf0f72fcde32d257100bd15b1c5192aaa 100644 --- a/src/main/java/net/minecraft/network/chat/contents/TranslatableContents.java +++ b/src/main/java/net/minecraft/network/chat/contents/TranslatableContents.java @@ -181,6 +181,15 @@ public class TranslatableContents implements ComponentContents { @@ -156,23 +156,23 @@ index 65debad7aa7ffb1b0b19f89713ff394e8c9d245e..18e53db59082bae94922edc4baa812aa @Override public MutableComponent resolve(@Nullable CommandSourceStack source, @Nullable Entity sender, int depth) throws CommandSyntaxException { diff --git a/src/main/java/net/minecraft/network/protocol/game/ServerboundCommandSuggestionPacket.java b/src/main/java/net/minecraft/network/protocol/game/ServerboundCommandSuggestionPacket.java -index a5e438a834826161c52ca9db57d234d9ff80a591..4766994cce060564370b0d24836a7da8b5e4a8a1 100644 +index 898b19887ed34c87003fc63cb5905df2ba6234a5..b47eeb23055b135d5567552ba983bfbc3e1fab67 100644 --- a/src/main/java/net/minecraft/network/protocol/game/ServerboundCommandSuggestionPacket.java +++ b/src/main/java/net/minecraft/network/protocol/game/ServerboundCommandSuggestionPacket.java -@@ -14,7 +14,7 @@ public class ServerboundCommandSuggestionPacket implements Packet this.handleCustomCommandSuggestions0(packet)); } -@@ -824,6 +831,13 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl +@@ -821,6 +828,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/server/0978-Item-Mutation-Fixes.patch b/patches/server/0978-Item-Mutation-Fixes.patch new file mode 100644 index 0000000000..736d493c99 --- /dev/null +++ b/patches/server/0978-Item-Mutation-Fixes.patch @@ -0,0 +1,38 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Owen1212055 <23108066+Owen1212055@users.noreply.github.com> +Date: Wed, 20 Mar 2024 20:41:35 -0400 +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 46beb8e45788950b8ca863aaf07c6d0587d8f693..5b3e33807e0e13480e3359c0cf067719e5749237 100644 +--- a/src/main/java/net/minecraft/world/inventory/EnchantmentMenu.java ++++ b/src/main/java/net/minecraft/world/inventory/EnchantmentMenu.java +@@ -227,7 +227,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) -> { +- ItemStack itemstack2 = itemstack; ++ ItemStack itemstack2 = itemstack; // Paper - diff on change + List list = this.getEnchantmentList(world.enabledFeatures(), itemstack, id, this.costs[id]); + + // CraftBukkit start +@@ -249,10 +249,16 @@ public class EnchantmentMenu extends AbstractContainerMenu { + return; + } + // CraftBukkit end +- if (itemstack.is(Items.BOOK)) { +- itemstack2 = itemstack.transmuteCopy(Items.ENCHANTED_BOOK, 1); ++ // Paper start ++ itemstack2 = org.bukkit.craftbukkit.inventory.CraftItemStack.getOrCloneOnMutation(item, event.getItem()); ++ if (itemstack2 != itemstack) { + this.enchantSlots.setItem(0, itemstack2); + } ++ if (itemstack2.is(Items.BOOK)) { ++ itemstack2 = itemstack2.transmuteCopy(Items.ENCHANTED_BOOK, 1); ++ this.enchantSlots.setItem(0, itemstack2); ++ } ++ // Paper end + + // CraftBukkit start + for (Map.Entry entry : event.getEnchantsToAdd().entrySet()) { diff --git a/patches/unapplied/server/1060-Per-world-ticks-per-spawn-settings.patch b/patches/server/0979-Per-world-ticks-per-spawn-settings.patch similarity index 87% rename from patches/unapplied/server/1060-Per-world-ticks-per-spawn-settings.patch rename to patches/server/0979-Per-world-ticks-per-spawn-settings.patch index cc4a0e5292..f89b02d6c6 100644 --- a/patches/unapplied/server/1060-Per-world-ticks-per-spawn-settings.patch +++ b/patches/server/0979-Per-world-ticks-per-spawn-settings.patch @@ -5,10 +5,10 @@ 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 a09017e74d972a12d0b88b4ade9a3532ce0ecd08..ca89d1593bf1b46c79a882db528cbca1359dc9d4 100644 +index 6ef8b68ceaf710e37ceb63040db95ca47b103ac3..b1f6d6a12865f3b30e9136fb548fa0a48a5ecb6e 100644 --- a/src/main/java/net/minecraft/world/level/Level.java +++ b/src/main/java/net/minecraft/world/level/Level.java -@@ -204,6 +204,15 @@ public abstract class Level implements LevelAccessor, AutoCloseable { +@@ -185,6 +185,15 @@ public abstract class Level implements LevelAccessor, AutoCloseable { return this.getChunkIfLoaded(chunkX, chunkZ) != null; } // Paper end - Use getChunkIfLoadedImmediately @@ -24,7 +24,7 @@ index a09017e74d972a12d0b88b4ade9a3532ce0ecd08..ca89d1593bf1b46c79a882db528cbca1 public abstract ResourceKey getTypeKey(); -@@ -216,7 +225,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable { +@@ -197,7 +206,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/1050-Properly-track-the-changed-item-from-dispense-events.patch b/patches/server/0980-Properly-track-the-changed-item-from-dispense-events.patch similarity index 67% rename from patches/unapplied/server/1050-Properly-track-the-changed-item-from-dispense-events.patch rename to patches/server/0980-Properly-track-the-changed-item-from-dispense-events.patch index f01bec2a48..cde48f6daf 100644 --- a/patches/unapplied/server/1050-Properly-track-the-changed-item-from-dispense-events.patch +++ b/patches/server/0980-Properly-track-the-changed-item-from-dispense-events.patch @@ -4,32 +4,11 @@ Date: Mon, 12 Dec 2022 12:14:03 -0800 Subject: [PATCH] Properly track the changed item from dispense events -diff --git a/src/main/java/net/minecraft/core/dispenser/AbstractProjectileDispenseBehavior.java b/src/main/java/net/minecraft/core/dispenser/AbstractProjectileDispenseBehavior.java -index 155bd3d6d9c7d3cac7fd04de8210301251d1e17a..bc2e763a848b4bf7e9598ffe1ca2aa35a9af4677 100644 ---- a/src/main/java/net/minecraft/core/dispenser/AbstractProjectileDispenseBehavior.java -+++ b/src/main/java/net/minecraft/core/dispenser/AbstractProjectileDispenseBehavior.java -@@ -23,7 +23,7 @@ public abstract class AbstractProjectileDispenseBehavior extends DefaultDispense - ServerLevel worldserver = pointer.level(); - Position iposition = DispenserBlock.getDispensePosition(pointer); - Direction enumdirection = (Direction) pointer.state().getValue(DispenserBlock.FACING); -- Projectile iprojectile = this.getProjectile(worldserver, iposition, stack); -+ // Paper - move down - - // CraftBukkit start - // iprojectile.shoot((double) enumdirection.getStepX(), (double) ((float) enumdirection.getStepY() + 0.1F), (double) enumdirection.getStepZ(), this.getPower(), this.getUncertainty()); -@@ -52,6 +52,7 @@ public abstract class AbstractProjectileDispenseBehavior extends DefaultDispense - return stack; - } - } -+ Projectile iprojectile = this.getProjectile(worldserver, iposition, CraftItemStack.asNMSCopy(event.getItem())); // Paper - move from above and track changed items in the dispense event - - iprojectile.shoot(event.getVelocity().getX(), event.getVelocity().getY(), event.getVelocity().getZ(), this.getPower(), this.getUncertainty()); - ((Entity) iprojectile).projectileSource = new org.bukkit.craftbukkit.projectiles.CraftBlockProjectileSource(pointer.blockEntity()); diff --git a/src/main/java/net/minecraft/core/dispenser/DispenseItemBehavior.java b/src/main/java/net/minecraft/core/dispenser/DispenseItemBehavior.java -index 58eccc76fe4c24c364e6c634fcca60ab771a5792..e2e1273d787536d2fe1bdbbf8af36eb5ac220599 100644 +index 32084df594649d8da04052bbfa111896d8ea1f91..d194c08a50493da39f2457dc55fed953f78c6199 100644 --- a/src/main/java/net/minecraft/core/dispenser/DispenseItemBehavior.java +++ b/src/main/java/net/minecraft/core/dispenser/DispenseItemBehavior.java -@@ -241,10 +241,14 @@ public interface DispenseItemBehavior { +@@ -133,10 +133,14 @@ public interface DispenseItemBehavior { idispensebehavior.dispense(pointer, eventStack); return stack; } @@ -45,7 +24,7 @@ index 58eccc76fe4c24c364e6c634fcca60ab771a5792..e2e1273d787536d2fe1bdbbf8af36eb5 } catch (Exception exception) { DispenseItemBehavior.LOGGER.error("Error while dispensing spawn egg from dispenser at {}", pointer.pos(), exception); // CraftBukkit - decompile error return ItemStack.EMPTY; -@@ -299,10 +303,11 @@ public interface DispenseItemBehavior { +@@ -191,9 +195,10 @@ public interface DispenseItemBehavior { } // CraftBukkit end @@ -53,22 +32,11 @@ index 58eccc76fe4c24c364e6c634fcca60ab771a5792..e2e1273d787536d2fe1bdbbf8af36eb5 Consumer consumer = EntityType.appendDefaultStackConfig((entityarmorstand) -> { entityarmorstand.setYRot(enumdirection.toYRot()); - }, worldserver, stack, (Player) null); -- ArmorStand entityarmorstand = (ArmorStand) EntityType.ARMOR_STAND.spawn(worldserver, stack.getTag(), consumer, blockposition, MobSpawnType.DISPENSER, false, false); + }, worldserver, newStack, (Player) null); // Paper - track changed items in the dispense event -+ ArmorStand entityarmorstand = (ArmorStand) EntityType.ARMOR_STAND.spawn(worldserver, newStack.getTag(), consumer, blockposition, MobSpawnType.DISPENSER, false, false); // Paper - track changed items in the dispense event + ArmorStand entityarmorstand = (ArmorStand) EntityType.ARMOR_STAND.spawn(worldserver, consumer, blockposition, MobSpawnType.DISPENSER, false, false); if (entityarmorstand != null) { - if (shrink) stack.shrink(1); // Paper - actually handle here -@@ -582,7 +587,7 @@ public interface DispenseItemBehavior { - } - - SmallFireball entitysmallfireball = new SmallFireball(worldserver, d0, d1, d2, event.getVelocity().getX(), event.getVelocity().getY(), event.getVelocity().getZ()); -- entitysmallfireball.setItem(itemstack1); -+ entitysmallfireball.setItem(CraftItemStack.unwrap(event.getItem())); // Paper - track changed items in the dispense event (unwrap is save cause setItem already copies) - entitysmallfireball.projectileSource = new org.bukkit.craftbukkit.projectiles.CraftBlockProjectileSource(pointer.blockEntity()); - - worldserver.addFreshEntity(entitysmallfireball); -@@ -628,6 +633,7 @@ public interface DispenseItemBehavior { +@@ -413,6 +418,7 @@ public interface DispenseItemBehavior { int y = blockposition.getY(); int z = blockposition.getZ(); BlockState iblockdata = worldserver.getBlockState(blockposition); @@ -76,7 +44,7 @@ index 58eccc76fe4c24c364e6c634fcca60ab771a5792..e2e1273d787536d2fe1bdbbf8af36eb5 // 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(); -@@ -657,12 +663,15 @@ public interface DispenseItemBehavior { +@@ -442,12 +448,15 @@ public interface DispenseItemBehavior { } } @@ -94,6 +62,27 @@ index 58eccc76fe4c24c364e6c634fcca60ab771a5792..e2e1273d787536d2fe1bdbbf8af36eb5 // CraftBukkit start - Handle stacked buckets Item item = Items.BUCKET; stack.shrink(1); +diff --git a/src/main/java/net/minecraft/core/dispenser/ProjectileDispenseBehavior.java b/src/main/java/net/minecraft/core/dispenser/ProjectileDispenseBehavior.java +index 985954030654d521291cccbfc3ca49b67ee4357d..03503357b50c53e3f3f69db887a002df7285cd38 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 { + } + } + ++ Projectile iprojectile = this.projectileItem.asProjectile(worldserver, iposition, CraftItemStack.asNMSCopy(event.getItem()), enumdirection); // Paper - move from above and track changed items in the dispense event + this.projectileItem.shoot(iprojectile, event.getVelocity().getX(), event.getVelocity().getY(), event.getVelocity().getZ(), this.dispenseConfig.power(), this.dispenseConfig.uncertainty()); + ((Entity) iprojectile).projectileSource = new org.bukkit.craftbukkit.projectiles.CraftBlockProjectileSource(pointer.blockEntity()); + // 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 --- a/src/main/java/net/minecraft/core/dispenser/ShulkerBoxDispenseBehavior.java diff --git a/patches/server/0970-Rewrite-dataconverter-system.patch b/patches/server/0981-Rewrite-dataconverter-system.patch similarity index 100% rename from patches/server/0970-Rewrite-dataconverter-system.patch rename to patches/server/0981-Rewrite-dataconverter-system.patch diff --git a/patches/unapplied/server/1059-Suspicious-Effect-Entry-API.patch b/patches/server/0982-Suspicious-Effect-Entry-API.patch similarity index 63% rename from patches/unapplied/server/1059-Suspicious-Effect-Entry-API.patch rename to patches/server/0982-Suspicious-Effect-Entry-API.patch index 31c7a46ac6..f2153c872a 100644 --- a/patches/unapplied/server/1059-Suspicious-Effect-Entry-API.patch +++ b/patches/server/0982-Suspicious-Effect-Entry-API.patch @@ -14,10 +14,10 @@ in which it replaces PotionEffect. Co-authored-by: Yannick Lamprecht diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftMushroomCow.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftMushroomCow.java -index b453a47cadbda2e22262bcdc5454c4c6cf5b2583..983e0cdbd1bd950807967a36cba49859fb956f31 100644 +index 9cc81bcccbf1141f66fedada1359b7c0dfa8e22a..7491c7cf38d888b31a509613d237b55f9732400a 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftMushroomCow.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftMushroomCow.java -@@ -32,20 +32,32 @@ public class CraftMushroomCow extends CraftCow implements MushroomCow, io.paperm +@@ -34,11 +34,19 @@ public class CraftMushroomCow extends CraftCow implements MushroomCow, io.paperm return ImmutableList.of(); } @@ -34,52 +34,12 @@ index b453a47cadbda2e22262bcdc5454c4c6cf5b2583..983e0cdbd1bd950807967a36cba49859 + public boolean addEffectToNextStew(io.papermc.paper.potion.SuspiciousEffectEntry suspiciousEffectEntry, boolean overwrite) { + Preconditions.checkArgument(suspiciousEffectEntry != null, "SuspiciousEffectEntry cannot be null"); + MobEffect minecraftPotionEffect = CraftPotionEffectType.bukkitToMinecraft(suspiciousEffectEntry.effect()); ++ // Paper end - add overloads to use suspicious effect entry to mushroom cow and suspicious stew meta + if (!overwrite && this.hasEffectForNextStew(suspiciousEffectEntry.effect())) { return false; } -+ SuspiciousEffectHolder.EffectEntry recordSuspiciousEffect = new SuspiciousEffectHolder.EffectEntry(minecraftPotionEffect, suspiciousEffectEntry.duration()); -+ this.removeEffectFromNextStew(suspiciousEffectEntry.effect()); // Avoid duplicates of effects -+ // Paper start - fix modification of immutable stew effects list - if (this.getHandle().stewEffects == null) { -- this.getHandle().stewEffects = new ArrayList<>(); -+ this.getHandle().stewEffects = List.of(recordSuspiciousEffect); -+ } else { -+ this.getHandle().stewEffects = io.papermc.paper.util.MCUtil.copyListAndAdd(this.getHandle().stewEffects, recordSuspiciousEffect); - } -- SuspiciousEffectHolder.EffectEntry recordSuspiciousEffect = new SuspiciousEffectHolder.EffectEntry(minecraftPotionEffect.getEffect(), minecraftPotionEffect.getDuration()); -- this.removeEffectFromNextStew(potionEffect.getType()); // Avoid duplicates of effects -- return this.getHandle().stewEffects.add(recordSuspiciousEffect); -+ // Paper end - fix modification of immutable stew effects list -+ return true; - } -+ // Paper end - add overloads to use suspicious effect entry to mushroom cow and suspicious stew meta - - @Override - public boolean removeEffectFromNextStew(PotionEffectType potionEffectType) { -@@ -54,7 +66,21 @@ public class CraftMushroomCow extends CraftCow implements MushroomCow, io.paperm - return false; - } - MobEffect minecraftPotionEffectType = CraftPotionEffectType.bukkitToMinecraft(potionEffectType); -- return this.getHandle().stewEffects.removeIf(recordSuspiciousEffect -> recordSuspiciousEffect.effect().equals(minecraftPotionEffectType)); -+ // Paper start - fix modification of immutable stew effects list -+ if (this.getHandle().stewEffects == null) return false; -+ -+ final int oldSize = this.getHandle().stewEffects.size(); -+ this.getHandle().stewEffects = io.papermc.paper.util.MCUtil.copyListAndRemoveIf( -+ this.getHandle().stewEffects, s -> java.util.Objects.equals(s.effect(), minecraftPotionEffectType) -+ ); -+ -+ final int newSize = this.getHandle().stewEffects.size(); -+ if (newSize == 0) { -+ this.getHandle().stewEffects = null; // Null the empty list, mojang expect this -+ } -+ -+ return oldSize != newSize; // Yield back if the size changed, implying an object was removed. -+ // Paper end - fix modification of immutable stew effects list - } - - @Override -@@ -89,6 +115,43 @@ public class CraftMushroomCow extends CraftCow implements MushroomCow, io.paperm + SuspiciousStewEffects stewEffects = this.getHandle().stewEffects; +@@ -101,6 +109,43 @@ public class CraftMushroomCow extends CraftCow implements MushroomCow, io.paperm this.getHandle().setVariant(net.minecraft.world.entity.animal.MushroomCow.MushroomType.values()[variant.ordinal()]); } @@ -124,46 +84,30 @@ index b453a47cadbda2e22262bcdc5454c4c6cf5b2583..983e0cdbd1bd950807967a36cba49859 public String toString() { return "CraftMushroomCow"; diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaSuspiciousStew.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaSuspiciousStew.java -index 2c3b9f76067088efdc2250cdb5070df86e2dc0f5..243acae2c69dc46c02290ba103afc1549b618d85 100644 +index 8fc3cd507d333d2bdea759d7c102a56e88ad5f5a..6b229ec0d4110fd0e758610bfacd9e8ec71ad2c5 100644 --- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaSuspiciousStew.java +++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaSuspiciousStew.java -@@ -24,7 +24,7 @@ public class CraftMetaSuspiciousStew extends CraftMetaItem implements Suspicious - static final ItemMetaKey EFFECTS = new ItemMetaKey("effects", "effects"); - static final ItemMetaKey ID = new ItemMetaKey("id", "id"); +@@ -22,7 +22,7 @@ public class CraftMetaSuspiciousStew extends CraftMetaItem implements Suspicious + + static final ItemMetaKeyType EFFECTS = new ItemMetaKeyType<>(DataComponents.SUSPICIOUS_STEW_EFFECTS, "effects"); - private List customEffects; + private List customEffects; // Paper - add overloads to use suspicious effect entry to mushroom cow and suspicious stew meta CraftMetaSuspiciousStew(CraftMetaItem meta) { super(meta); -@@ -57,7 +57,7 @@ public class CraftMetaSuspiciousStew extends CraftMetaItem implements Suspicious - duration = net.minecraft.world.item.SuspiciousStewItem.DEFAULT_DURATION; - } - // Paper end start - default duration is 160 -- this.customEffects.add(new PotionEffect(type, duration, 0)); -+ this.customEffects.add(io.papermc.paper.potion.SuspiciousEffectEntry.create(type, duration)); // Paper - add overloads to use suspicious effect entry to mushroom cow and suspicious stew meta - } - } - } -@@ -84,12 +84,14 @@ public class CraftMetaSuspiciousStew extends CraftMetaItem implements Suspicious - ListTag effectList = new ListTag(); - tag.put(CraftMetaSuspiciousStew.EFFECTS.NBT, effectList); +@@ -74,8 +74,8 @@ public class CraftMetaSuspiciousStew extends CraftMetaItem implements Suspicious + if (this.customEffects != null) { + List effectList = new ArrayList<>(); - for (PotionEffect effect : this.customEffects) { -+ // Paper start - add overloads to use suspicious effect entry to mushroom cow and suspicious stew meta +- effectList.add(new net.minecraft.world.item.component.SuspiciousStewEffects.Entry(CraftPotionEffectType.bukkitToMinecraftHolder(effect.getType()), effect.getDuration())); + for (io.papermc.paper.potion.SuspiciousEffectEntry effect : this.customEffects) { - CompoundTag effectData = new CompoundTag(); -- effectData.putString(CraftMetaSuspiciousStew.ID.NBT, effect.getType().getKey().toString()); -- if (effect.getDuration() != net.minecraft.world.item.SuspiciousStewItem.DEFAULT_DURATION) effectData.putInt(CraftMetaSuspiciousStew.DURATION.NBT, effect.getDuration()); // Paper - don't save duration if it's the default value -+ effectData.putString(CraftMetaSuspiciousStew.ID.NBT, effect.effect().getKey().toString()); -+ if (effect.duration() != net.minecraft.world.item.SuspiciousStewItem.DEFAULT_DURATION) effectData.putInt(CraftMetaSuspiciousStew.DURATION.NBT, effect.duration()); // Paper - don't save duration if it's the default value - effectList.add(effectData); ++ effectList.add(new net.minecraft.world.item.component.SuspiciousStewEffects.Entry(CraftPotionEffectType.bukkitToMinecraftHolder(effect.effect()), effect.duration())); // Paper - add overloads to use suspicious effect entry to mushroom cow and suspicious stew meta } -+ // Paper end - add overloads to use suspicious effect entry to mushroom cow and suspicious stew meta + tag.put(CraftMetaSuspiciousStew.EFFECTS, new SuspiciousStewEffects(effectList)); } - } - -@@ -124,7 +126,7 @@ public class CraftMetaSuspiciousStew extends CraftMetaItem implements Suspicious +@@ -112,7 +112,7 @@ public class CraftMetaSuspiciousStew extends CraftMetaItem implements Suspicious @Override public List getCustomEffects() { if (this.hasCustomEffects()) { @@ -172,7 +116,7 @@ index 2c3b9f76067088efdc2250cdb5070df86e2dc0f5..243acae2c69dc46c02290ba103afc154 } return ImmutableList.of(); } -@@ -132,15 +134,21 @@ public class CraftMetaSuspiciousStew extends CraftMetaItem implements Suspicious +@@ -120,15 +120,21 @@ public class CraftMetaSuspiciousStew extends CraftMetaItem implements Suspicious @Override public boolean addCustomEffect(PotionEffect effect, boolean overwrite) { Preconditions.checkArgument(effect != null, "Potion effect cannot be null"); @@ -198,7 +142,7 @@ index 2c3b9f76067088efdc2250cdb5070df86e2dc0f5..243acae2c69dc46c02290ba103afc154 return true; } else { return false; -@@ -149,10 +157,11 @@ public class CraftMetaSuspiciousStew extends CraftMetaItem implements Suspicious +@@ -137,10 +143,11 @@ public class CraftMetaSuspiciousStew extends CraftMetaItem implements Suspicious if (this.customEffects == null) { this.customEffects = new ArrayList<>(); } @@ -211,7 +155,7 @@ index 2c3b9f76067088efdc2250cdb5070df86e2dc0f5..243acae2c69dc46c02290ba103afc154 @Override public boolean removeCustomEffect(PotionEffectType type) { -@@ -163,10 +172,12 @@ public class CraftMetaSuspiciousStew extends CraftMetaItem implements Suspicious +@@ -151,10 +158,12 @@ public class CraftMetaSuspiciousStew extends CraftMetaItem implements Suspicious } boolean changed = false; @@ -227,7 +171,7 @@ index 2c3b9f76067088efdc2250cdb5070df86e2dc0f5..243acae2c69dc46c02290ba103afc154 iterator.remove(); changed = true; } -@@ -189,7 +200,7 @@ public class CraftMetaSuspiciousStew extends CraftMetaItem implements Suspicious +@@ -177,7 +186,7 @@ public class CraftMetaSuspiciousStew extends CraftMetaItem implements Suspicious } for (int i = 0; i < this.customEffects.size(); i++) { @@ -236,7 +180,7 @@ index 2c3b9f76067088efdc2250cdb5070df86e2dc0f5..243acae2c69dc46c02290ba103afc154 return i; } } -@@ -234,7 +245,7 @@ public class CraftMetaSuspiciousStew extends CraftMetaItem implements Suspicious +@@ -222,7 +231,7 @@ public class CraftMetaSuspiciousStew extends CraftMetaItem implements Suspicious super.serialize(builder); if (this.hasCustomEffects()) { diff --git a/patches/unapplied/server/1054-check-if-itemstack-is-stackable-first.patch b/patches/server/0983-check-if-itemstack-is-stackable-first.patch similarity index 57% rename from patches/unapplied/server/1054-check-if-itemstack-is-stackable-first.patch rename to patches/server/0983-check-if-itemstack-is-stackable-first.patch index 3655bb3a13..6143642997 100644 --- a/patches/unapplied/server/1054-check-if-itemstack-is-stackable-first.patch +++ b/patches/server/0983-check-if-itemstack-is-stackable-first.patch @@ -5,15 +5,15 @@ Subject: [PATCH] check if itemstack is stackable first diff --git a/src/main/java/net/minecraft/world/entity/player/Inventory.java b/src/main/java/net/minecraft/world/entity/player/Inventory.java -index 309acf7bd07e38043aa81e0e686edba1136bd04c..96c898086f35fd83f9b1ce7e3fe53d31b2fa4c31 100644 +index 1e77482a98869e464c1f0a873cff8febf7924c8c..ca7fbe4f8c1e1d2fb90095aa35be4dda3029c23e 100644 --- a/src/main/java/net/minecraft/world/entity/player/Inventory.java +++ b/src/main/java/net/minecraft/world/entity/player/Inventory.java -@@ -114,7 +114,7 @@ public class Inventory implements Container, Nameable { +@@ -111,7 +111,7 @@ public class Inventory implements Container, Nameable { } private boolean hasRemainingSpaceForItem(ItemStack existingStack, ItemStack stack) { -- return !existingStack.isEmpty() && ItemStack.isSameItemSameTags(existingStack, stack) && existingStack.isStackable() && existingStack.getCount() < existingStack.getMaxStackSize() && existingStack.getCount() < this.getMaxStackSize(); -+ return !existingStack.isEmpty() && existingStack.isStackable() && existingStack.getCount() < existingStack.getMaxStackSize() && existingStack.getCount() < this.getMaxStackSize() && ItemStack.isSameItemSameTags(existingStack, stack); // Paper - check if itemstack is stackable first +- return !existingStack.isEmpty() && ItemStack.isSameItemSameComponents(existingStack, stack) && existingStack.isStackable() && existingStack.getCount() < this.getMaxStackSize(existingStack); ++ return !existingStack.isEmpty() && existingStack.isStackable() && existingStack.getCount() < this.getMaxStackSize(existingStack) && ItemStack.isSameItemSameComponents(existingStack, stack); // Paper - check if itemstack is stackable first } // CraftBukkit start - Watch method above! :D diff --git a/patches/unapplied/server/1058-disable-forced-empty-world-ticks.patch b/patches/server/0984-disable-forced-empty-world-ticks.patch similarity index 86% rename from patches/unapplied/server/1058-disable-forced-empty-world-ticks.patch rename to patches/server/0984-disable-forced-empty-world-ticks.patch index 6f3fb1c6f0..1490668793 100644 --- a/patches/unapplied/server/1058-disable-forced-empty-world-ticks.patch +++ b/patches/server/0984-disable-forced-empty-world-ticks.patch @@ -5,10 +5,10 @@ Subject: [PATCH] disable forced empty world ticks diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java -index 4bca3d20d1a01270a10c1e643a312fe462305b5d..bf5e47e8c3706590fdc0731bd9a5858b56d06136 100644 +index b6a4feb182975b36c397a7b6e8ee37e4dbaddb64..f2ccc126bb75bd3b88f17af885a507fd5ab0d7e5 100644 --- a/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java -@@ -876,7 +876,7 @@ public class ServerLevel extends Level implements WorldGenLevel { +@@ -527,7 +527,7 @@ public class ServerLevel extends Level implements WorldGenLevel { this.handlingTick = false; gameprofilerfiller.pop(); diff --git a/patches/server/0971-Starlight.patch b/patches/server/0985-Starlight.patch similarity index 99% rename from patches/server/0971-Starlight.patch rename to patches/server/0985-Starlight.patch index b6609768ba..c8683de8fb 100644 --- a/patches/server/0971-Starlight.patch +++ b/patches/server/0985-Starlight.patch @@ -4858,7 +4858,7 @@ index 0d536d72ac918fbd403397ff369d10143ee9c204..6051e5f272838ef23276a90e21c2fc82 public static TicketType create(String name, Comparator argumentComparator) { return new TicketType<>(name, argumentComparator, 0L); diff --git a/src/main/java/net/minecraft/server/level/WorldGenRegion.java b/src/main/java/net/minecraft/server/level/WorldGenRegion.java -index 713509e08c6325816fef7c09477d36aacb0008ef..b17eb5c228264715bdf58895e4e7a3910a13c6e9 100644 +index 8f8cbb9cc7febe3eb1c7de2be3953f67b0b58116..9297ae20ce5ea5f5a7e8e6d080ef7b2ddff7058c 100644 --- a/src/main/java/net/minecraft/server/level/WorldGenRegion.java +++ b/src/main/java/net/minecraft/server/level/WorldGenRegion.java @@ -109,6 +109,27 @@ public class WorldGenRegion implements WorldGenLevel { @@ -5120,7 +5120,7 @@ index 2953e93965aa688be8fc1620580701ba0c9d907e..aa5dee839d4c0dbc3c2abee9b501ec25 @Override public BlockEntity getBlockEntity(BlockPos pos) { 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 744db9eec4f7bdeb32f83300960a7fce63b393d8..fca31bc427847141e7317b85a10da9e34e9e2bf6 100644 +index 8de6ad8b131061b2dae440dff71e2e6e7af2de39..bac191f92ea3735df19c68d5568c2c7962c8680f 100644 --- a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java +++ b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java @@ -222,6 +222,12 @@ public class LevelChunk extends ChunkAccess { diff --git a/patches/server/0972-Rewrite-chunk-system.patch b/patches/server/0986-Rewrite-chunk-system.patch similarity index 99% rename from patches/server/0972-Rewrite-chunk-system.patch rename to patches/server/0986-Rewrite-chunk-system.patch index 6ad2b98718..fd52880b98 100644 --- a/patches/server/0972-Rewrite-chunk-system.patch +++ b/patches/server/0986-Rewrite-chunk-system.patch @@ -14602,10 +14602,10 @@ index 0000000000000000000000000000000000000000..962d3cae6340fc11607b59355e291629 + +} diff --git a/src/main/java/io/papermc/paper/configuration/GlobalConfiguration.java b/src/main/java/io/papermc/paper/configuration/GlobalConfiguration.java -index 0b283171294eca65a898ddd9ab1b7295ad183b0d..31f34ac1c70df3ef6eb6f6dfd0f870b1b275adfa 100644 +index 481cfe3a291196c0391c2ec8560e566e0e1e2fb8..30fe1c0645a07d663b08c0f988a1ab3a750bf7c4 100644 --- a/src/main/java/io/papermc/paper/configuration/GlobalConfiguration.java +++ b/src/main/java/io/papermc/paper/configuration/GlobalConfiguration.java -@@ -28,6 +28,45 @@ public class GlobalConfiguration extends ConfigurationPart { +@@ -29,6 +29,45 @@ public class GlobalConfiguration extends ConfigurationPart { public static GlobalConfiguration get() { return instance; } @@ -14651,7 +14651,7 @@ index 0b283171294eca65a898ddd9ab1b7295ad183b0d..31f34ac1c70df3ef6eb6f6dfd0f870b1 static void set(GlobalConfiguration instance) { GlobalConfiguration.instance = instance; } -@@ -129,21 +168,6 @@ public class GlobalConfiguration extends ConfigurationPart { +@@ -130,21 +169,6 @@ public class GlobalConfiguration extends ConfigurationPart { public int incomingPacketThreshold = 300; } @@ -14673,7 +14673,7 @@ index 0b283171294eca65a898ddd9ab1b7295ad183b0d..31f34ac1c70df3ef6eb6f6dfd0f870b1 public UnsupportedSettings unsupportedSettings; public class UnsupportedSettings extends ConfigurationPart { -@@ -202,7 +226,7 @@ public class GlobalConfiguration extends ConfigurationPart { +@@ -203,7 +227,7 @@ public class GlobalConfiguration extends ConfigurationPart { @PostProcess private void postProcess() { @@ -15681,7 +15681,7 @@ index c33f85b570f159ab465b5a10a8044a81f2797f43..244a19ecd0234fa1d7a6ecfea2075159 DedicatedServer dedicatedserver1 = new DedicatedServer(optionset, worldLoader.get(), thread, convertable_conversionsession, resourcepackrepository, worldstem, dedicatedserversettings, DataFixers.getDataFixer(), services, LoggerChunkProgressListener::createFromGameruleRadius); diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index 1d8c63a5a0b05340396a9f7ba079eb7fceda03e2..d7699ac1c627f265c403b9e00121f5f55e982341 100644 +index 325ba58a1c79fd928ac22d8f1ef93605357300d2..498fc4ab46eac994f2a65c79eebddca2813f0b65 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java @@ -318,7 +318,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop { @@ -15828,7 +15828,7 @@ index 1d8c63a5a0b05340396a9f7ba079eb7fceda03e2..d7699ac1c627f265c403b9e00121f5f5 if (entity.isRemoved()) { continue; } -@@ -2615,6 +2610,13 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop TicketType create(String name, Comparator argumentComparator) { return new TicketType<>(name, argumentComparator, 0L); diff --git a/src/main/java/net/minecraft/server/level/WorldGenRegion.java b/src/main/java/net/minecraft/server/level/WorldGenRegion.java -index b17eb5c228264715bdf58895e4e7a3910a13c6e9..9c066b1dda5912d7aaf50df381cc4809bedf0604 100644 +index 9297ae20ce5ea5f5a7e8e6d080ef7b2ddff7058c..d05c40c77c7d37eb8eabfd3a9df8860bed5a17e4 100644 --- a/src/main/java/net/minecraft/server/level/WorldGenRegion.java +++ b/src/main/java/net/minecraft/server/level/WorldGenRegion.java -@@ -543,4 +543,21 @@ public class WorldGenRegion implements WorldGenLevel { +@@ -544,4 +544,21 @@ public class WorldGenRegion implements WorldGenLevel { public long nextSubTickCount() { return this.subTickCount.getAndIncrement(); } @@ -19474,7 +19474,7 @@ index ea72dcb064a35bc6245bc5c94d592efedd8faf41..0793dfe47e68a2b48b010aad5b12dcfa public boolean remove(Object object) { int i = this.findIndex((T)object); diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java -index 4e96b6c05bf8b8235e91bdd26e5615c5299fd9aa..64ba2b3f8e0d5176dc24432ceb4a51eea1f24098 100644 +index 3c1bcf8d1a07b35a8688160c9f05f792451338a3..03840f520624662d4ce3ac9f3065a01c71b5f299 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java @@ -482,6 +482,58 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess @@ -19886,10 +19886,10 @@ index bd20bea7f76a7307f1698fb2dfef37125032d166..9a28912f52824acdc80a62243b136e6f List getEntities(EntityTypeTest filter, AABB box, Predicate predicate); diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java -index 6ef8b68ceaf710e37ceb63040db95ca47b103ac3..143ab00a079c0bb2af8717567f7069e82cddd9a6 100644 +index b1f6d6a12865f3b30e9136fb548fa0a48a5ecb6e..1f8e12f5bdd00c683bb55ffbb157d6c78500c683 100644 --- a/src/main/java/net/minecraft/world/level/Level.java +++ b/src/main/java/net/minecraft/world/level/Level.java -@@ -539,6 +539,11 @@ public abstract class Level implements LevelAccessor, AutoCloseable { +@@ -548,6 +548,11 @@ public abstract class Level implements LevelAccessor, AutoCloseable { if ((i & 2) != 0 && (!this.isClientSide || (i & 4) == 0) && (this.isClientSide || chunk == null || (chunk.getFullStatus() != null && chunk.getFullStatus().isOrAfter(FullChunkStatus.BLOCK_TICKING)))) { // allow chunk to be null here as chunk.isReady() is false when we send our notification during block placement this.sendBlockUpdated(blockposition, iblockdata1, iblockdata, i); @@ -19901,7 +19901,7 @@ index 6ef8b68ceaf710e37ceb63040db95ca47b103ac3..143ab00a079c0bb2af8717567f7069e8 } if ((i & 1) != 0) { -@@ -933,7 +938,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable { +@@ -942,7 +947,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable { } // Paper end - Perf: Optimize capturedTileEntities lookup // CraftBukkit end @@ -19910,7 +19910,7 @@ index 6ef8b68ceaf710e37ceb63040db95ca47b103ac3..143ab00a079c0bb2af8717567f7069e8 } public void setBlockEntity(BlockEntity blockEntity) { -@@ -1024,26 +1029,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable { +@@ -1033,26 +1038,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable { public List getEntities(@Nullable Entity except, AABB box, Predicate predicate) { this.getProfiler().incrementCounter("getEntities"); List list = Lists.newArrayList(); @@ -19938,7 +19938,7 @@ index 6ef8b68ceaf710e37ceb63040db95ca47b103ac3..143ab00a079c0bb2af8717567f7069e8 return list; } -@@ -1061,33 +1047,23 @@ public abstract class Level implements LevelAccessor, AutoCloseable { +@@ -1070,33 +1056,23 @@ public abstract class Level implements LevelAccessor, AutoCloseable { public void getEntities(EntityTypeTest filter, AABB box, Predicate predicate, List result, int limit) { this.getProfiler().incrementCounter("getEntities"); @@ -19988,7 +19988,7 @@ index 6ef8b68ceaf710e37ceb63040db95ca47b103ac3..143ab00a079c0bb2af8717567f7069e8 } @Nullable -@@ -1377,4 +1353,45 @@ public abstract class Level implements LevelAccessor, AutoCloseable { +@@ -1386,4 +1362,45 @@ public abstract class Level implements LevelAccessor, AutoCloseable { } } // Paper end - notify observers even if grow failed @@ -20077,7 +20077,7 @@ index c9cd18ce79a6ee7297a8fd14f4dbe712570b3ced..927bdebdb8ae01613f0cea074b3367bd structurestart = structureAccessor.getStartForStructure(SectionPos.bottomOf(ichunkaccess), (Structure) holder.value(), ichunkaccess); } while (structurestart == null); 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 fca31bc427847141e7317b85a10da9e34e9e2bf6..50e86fd70aeb798daf3685e7f7dc780516dd76b4 100644 +index bac191f92ea3735df19c68d5568c2c7962c8680f..5d94aee1303d9eca5f1fa9a2e033ad0d12909635 100644 --- a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java +++ b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java @@ -86,6 +86,7 @@ public class LevelChunk extends ChunkAccess { diff --git a/patches/server/0973-incremental-chunk-and-player-saving.patch b/patches/server/0987-incremental-chunk-and-player-saving.patch similarity index 97% rename from patches/server/0973-incremental-chunk-and-player-saving.patch rename to patches/server/0987-incremental-chunk-and-player-saving.patch index 036f0bd016..9385746d87 100644 --- a/patches/server/0973-incremental-chunk-and-player-saving.patch +++ b/patches/server/0987-incremental-chunk-and-player-saving.patch @@ -5,7 +5,7 @@ Subject: [PATCH] incremental chunk and player saving diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index d7699ac1c627f265c403b9e00121f5f55e982341..0f3601f2f1a7ac53425129df6498ed0df302dec8 100644 +index 498fc4ab46eac994f2a65c79eebddca2813f0b65..4bb0cf4d4eb0b648062c40a8347298002256d39e 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java @@ -916,7 +916,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop getTypeKey(); @@ -1188,7 +1188,7 @@ index 09608b495a460af86dabf34ccd8803cf1c0e3769..a137b4a3be01a0333e5fdc1585098faf this.spigotConfig = new org.spigotmc.SpigotWorldConfig(((net.minecraft.world.level.storage.PrimaryLevelData) worlddatamutable).getLevelName()); // Spigot this.paperConfig = paperWorldConfigCreator.apply(this.spigotConfig); // Paper - create paper world config this.generator = gen; -@@ -277,6 +278,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable { +@@ -286,6 +287,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable { this.keepSpawnInMemory = this.paperConfig().spawn.keepSpawnLoaded; // Paper - Option to keep spawn chunks loaded this.entityLimiter = new org.spigotmc.TickLimiter(this.spigotConfig.entityMaxTickTime); this.tileLimiter = new org.spigotmc.TickLimiter(this.spigotConfig.tileMaxTickTime); @@ -1196,7 +1196,7 @@ index 09608b495a460af86dabf34ccd8803cf1c0e3769..a137b4a3be01a0333e5fdc1585098faf } // Paper start - Cancel hit for vanished players -@@ -552,6 +554,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable { +@@ -561,6 +563,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable { // CraftBukkit end BlockState iblockdata1 = chunk.setBlockState(pos, state, (flags & 64) != 0, (flags & 1024) == 0); // CraftBukkit custom NO_PLACE flag @@ -1230,7 +1230,7 @@ index 383dc47c81b3f34e8166bce180a51a2ccbfaf6ca..1aac95b03a9e2e37c24f2a30bcb259c1 } 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 50e86fd70aeb798daf3685e7f7dc780516dd76b4..a0b5cf2c7b743717c3001db17ed468de9a22a5fb 100644 +index 5d94aee1303d9eca5f1fa9a2e033ad0d12909635..424c4613e202c6ba50fa0de65d2526d400a8e299 100644 --- a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java +++ b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java @@ -93,7 +93,7 @@ public class LevelChunk extends ChunkAccess { diff --git a/patches/server/0984-Improve-cancelling-PreCreatureSpawnEvent-with-per-pl.patch b/patches/server/0998-Improve-cancelling-PreCreatureSpawnEvent-with-per-pl.patch similarity index 100% rename from patches/server/0984-Improve-cancelling-PreCreatureSpawnEvent-with-per-pl.patch rename to patches/server/0998-Improve-cancelling-PreCreatureSpawnEvent-with-per-pl.patch diff --git a/patches/server/0985-Optimize-Collision-to-not-load-chunks.patch b/patches/server/0999-Optimize-Collision-to-not-load-chunks.patch similarity index 98% rename from patches/server/0985-Optimize-Collision-to-not-load-chunks.patch rename to patches/server/0999-Optimize-Collision-to-not-load-chunks.patch index e19f8239a9..6e4dc57958 100644 --- a/patches/server/0985-Optimize-Collision-to-not-load-chunks.patch +++ b/patches/server/0999-Optimize-Collision-to-not-load-chunks.patch @@ -26,7 +26,7 @@ index 5b031c7c13fb2c2e593eec4c8f6a973a3758a60b..65803c0927103e3ae63d8d8616f42090 // CraftBukkit end entityplayer1.setPos(entityplayer1.getX(), entityplayer1.getY() + 1.0D, entityplayer1.getZ()); diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java -index ab529d8c2c10fffd58fe4754882b558eed239fbd..1a8a52a77fa0b7891220bf0f04688f5b7eaa9bd7 100644 +index a13edd1165a5ba4dd3f5c323e454926e7fe75c07..b57644317b5085d74d11ac6ba858c3747d703a47 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java @@ -245,6 +245,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess diff --git a/patches/server/0986-Optimize-GoalSelector-Goal.Flag-Set-operations.patch b/patches/server/1000-Optimize-GoalSelector-Goal.Flag-Set-operations.patch similarity index 100% rename from patches/server/0986-Optimize-GoalSelector-Goal.Flag-Set-operations.patch rename to patches/server/1000-Optimize-GoalSelector-Goal.Flag-Set-operations.patch diff --git a/patches/server/0987-Entity-load-save-limit-per-chunk.patch b/patches/server/1001-Entity-load-save-limit-per-chunk.patch similarity index 100% rename from patches/server/0987-Entity-load-save-limit-per-chunk.patch rename to patches/server/1001-Entity-load-save-limit-per-chunk.patch diff --git a/patches/unapplied/server/1067-Item-Mutation-Fixes.patch b/patches/unapplied/server/1067-Item-Mutation-Fixes.patch deleted file mode 100644 index 4fc0800e22..0000000000 --- a/patches/unapplied/server/1067-Item-Mutation-Fixes.patch +++ /dev/null @@ -1,49 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Owen1212055 <23108066+Owen1212055@users.noreply.github.com> -Date: Wed, 20 Mar 2024 20:41:35 -0400 -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 343f44db579839eb61376f876b5eff2e615dc2e5..e6935b6632c7a7e07f4da459c95f564356242f98 100644 ---- a/src/main/java/net/minecraft/world/inventory/EnchantmentMenu.java -+++ b/src/main/java/net/minecraft/world/inventory/EnchantmentMenu.java -@@ -229,7 +229,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) -> { -- ItemStack itemstack2 = itemstack; -+ ItemStack itemstack2 = itemstack; // Paper - diff on change - List list = this.getEnchantmentList(itemstack, id, this.costs[id]); - - // CraftBukkit start -@@ -251,11 +251,18 @@ public class EnchantmentMenu extends AbstractContainerMenu { - return; - } - // CraftBukkit end -- boolean flag = itemstack.is(Items.BOOK); -+ // Paper start -+ itemstack2 = org.bukkit.craftbukkit.inventory.CraftItemStack.getOrCloneOnMutation(item, event.getItem()); -+ if (itemstack2 != itemstack) { -+ this.enchantSlots.setItem(0, itemstack2); -+ } -+ boolean flag = itemstack2.is(Items.BOOK); -+ // Paper end - - if (flag) { -+ CompoundTag nbttagcompound = itemstack2.getTag(); // Paper - move up - itemstack2 = new ItemStack(Items.ENCHANTED_BOOK); -- CompoundTag nbttagcompound = itemstack.getTag(); -+ // Paper - move up - - if (nbttagcompound != null) { - itemstack2.setTag(nbttagcompound.copy()); -@@ -277,7 +284,7 @@ public class EnchantmentMenu extends AbstractContainerMenu { - EnchantmentInstance weightedrandomenchant = new EnchantmentInstance(nms, entry.getValue()); - EnchantedBookItem.addEnchantment(itemstack2, weightedrandomenchant); - } else { -- item.addUnsafeEnchantment(entry.getKey(), entry.getValue()); -+ CraftItemStack.asCraftMirror(itemstack2).addUnsafeEnchantment(entry.getKey(), entry.getValue()); // Paper - } - } catch (IllegalArgumentException e) { - /* Just swallow invalid enchantments */