From 513768c965cb43bfb2361ca8689b6dee2ac0d792 Mon Sep 17 00:00:00 2001 From: violetc <58360096+s-yh-china@users.noreply.github.com> Date: Sun, 24 Aug 2025 11:42:38 +0800 Subject: [PATCH] Merge Paper#11831 (#695) --- .../0134-TEMP-Merge-Paper-11831.patch | 82 +++++++++++++++++++ .../features/0134-temp-fix-quick-craft.patch | 29 ------- ...ender-dragon-part-can-use-end-portal.patch | 8 +- .../0138-Lithium-Sleeping-Block-Entity.patch | 8 +- 4 files changed, 90 insertions(+), 37 deletions(-) create mode 100644 leaves-server/minecraft-patches/features/0134-TEMP-Merge-Paper-11831.patch delete mode 100644 leaves-server/minecraft-patches/features/0134-temp-fix-quick-craft.patch diff --git a/leaves-server/minecraft-patches/features/0134-TEMP-Merge-Paper-11831.patch b/leaves-server/minecraft-patches/features/0134-TEMP-Merge-Paper-11831.patch new file mode 100644 index 00000000..17cb482c --- /dev/null +++ b/leaves-server/minecraft-patches/features/0134-TEMP-Merge-Paper-11831.patch @@ -0,0 +1,82 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: MC_XiaoHei +Date: Sat, 5 Jul 2025 11:31:44 +0800 +Subject: [PATCH] TEMP Merge Paper#11831 + +Dec 27, 2024 ~ Today + +diff --git a/net/minecraft/server/commands/GiveCommand.java b/net/minecraft/server/commands/GiveCommand.java +index f6e18d62db18616a422ae74d6f329d1b3a96300b..eb34f3f9821f50f0a31fb22d9314c26b3e829d47 100644 +--- a/net/minecraft/server/commands/GiveCommand.java ++++ b/net/minecraft/server/commands/GiveCommand.java +@@ -54,7 +54,6 @@ public class GiveCommand { + + private static int giveItem(CommandSourceStack source, ItemInput item, Collection targets, int count) throws CommandSyntaxException { + ItemStack itemStack = item.createItemStack(1, false); +- final Component displayName = itemStack.getDisplayName(); // Paper - get display name early + int maxStackSize = org.leavesmc.leaves.util.ItemOverstackUtils.getItemStackMaxCount(itemStack); // Leaves - item over-stack util + int i = maxStackSize * 100; + if (count > i) { +@@ -99,11 +98,11 @@ public class GiveCommand { + + if (targets.size() == 1) { + source.sendSuccess( +- () -> Component.translatable("commands.give.success.single", count, displayName, targets.iterator().next().getDisplayName()), // Paper - use cached display name ++ () -> Component.translatable("commands.give.success.single", count, itemStack.getDisplayName(), targets.iterator().next().getDisplayName()), // Paper - use cached display name + true + ); + } else { +- source.sendSuccess(() -> Component.translatable("commands.give.success.single", count, displayName, targets.size()), true); // Paper - use cached display name ++ source.sendSuccess(() -> Component.translatable("commands.give.success.single", count, itemStack.getDisplayName(), targets.size()), true); // Paper - use cached display name + } + + return targets.size(); +diff --git a/net/minecraft/world/entity/Entity.java b/net/minecraft/world/entity/Entity.java +index bea4089920191b5e3231e9792a078747923d0c14..3b9bd49fa39e3b44a7cbf51072e7cf09b186f254 100644 +--- a/net/minecraft/world/entity/Entity.java ++++ b/net/minecraft/world/entity/Entity.java +@@ -2844,10 +2844,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess + return null; + } + // CraftBukkit end +- ItemEntity itemEntity = new ItemEntity(level, this.getX() + offset.x, this.getY() + offset.y, this.getZ() + offset.z, stack.copy()); // Paper - copy so we can destroy original +- stack.setCount(0); // Paper - destroy this item - if this ever leaks due to game bugs, ensure it doesn't dupe +- +- itemEntity.setDefaultPickUpDelay(); ++ ItemEntity itemEntity = new ItemEntity(level, this.getX() + offset.x, this.getY() + offset.y, this.getZ() + offset.z, stack.copy()); // Paper - copy + itemEntity.setDefaultPickUpDelay(); // Paper - diff on change (in dropConsumer) + // Paper start - Call EntityDropItemEvent + return this.spawnAtLocation(level, itemEntity); +diff --git a/net/minecraft/world/entity/LivingEntity.java b/net/minecraft/world/entity/LivingEntity.java +index 6b776ff621275e842c113000bd69528c96a598c3..0d493c8343057898166f94a4006a374a214ae7b2 100644 +--- a/net/minecraft/world/entity/LivingEntity.java ++++ b/net/minecraft/world/entity/LivingEntity.java +@@ -3961,11 +3961,6 @@ public abstract class LivingEntity extends Entity implements Attackable, Waypoin + return null; + } else { + double d = this.getEyeY() - 0.3F; +- // Paper start +- final ItemStack tmp = stack.copy(); +- stack.setCount(0); +- stack = tmp; +- // Paper end + ItemEntity itemEntity = new ItemEntity(this.level(), this.getX(), d, this.getZ(), stack); + itemEntity.setPickUpDelay(40); + if (includeThrower) { +diff --git a/net/minecraft/world/inventory/AbstractContainerMenu.java b/net/minecraft/world/inventory/AbstractContainerMenu.java +index c1ca84cf0dbb4fd091cfab517721c87e0f9074a0..403afadbd2280325f1289e302a1ff409f8f0941c 100644 +--- a/net/minecraft/world/inventory/AbstractContainerMenu.java ++++ b/net/minecraft/world/inventory/AbstractContainerMenu.java +@@ -652,7 +652,11 @@ public abstract class AbstractContainerMenu { + } + + carried = slot2.safeTake(i1, Integer.MAX_VALUE, player); +- player.drop(carried, true); ++ // CraftBukkit start - SPIGOT-8010: break loop ++ if (player.drop(carried, true) == null) { ++ break; ++ } ++ // CraftBukkit end - SPIGOT-8010: break loop + player.handleCreativeModeItemDrop(carried); + } + } diff --git a/leaves-server/minecraft-patches/features/0134-temp-fix-quick-craft.patch b/leaves-server/minecraft-patches/features/0134-temp-fix-quick-craft.patch deleted file mode 100644 index 60321a2c..00000000 --- a/leaves-server/minecraft-patches/features/0134-temp-fix-quick-craft.patch +++ /dev/null @@ -1,29 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: MC_XiaoHei -Date: Sat, 5 Jul 2025 11:31:44 +0800 -Subject: [PATCH] temp fix quick craft - -caused by PaperMC/Paper#11765 -should remove when PaperMC/Paper#11831 merged - -diff --git a/net/minecraft/world/entity/LivingEntity.java b/net/minecraft/world/entity/LivingEntity.java -index 6b776ff621275e842c113000bd69528c96a598c3..deec9de308c90aef7844623569e847c727644b74 100644 ---- a/net/minecraft/world/entity/LivingEntity.java -+++ b/net/minecraft/world/entity/LivingEntity.java -@@ -3961,11 +3961,11 @@ public abstract class LivingEntity extends Entity implements Attackable, Waypoin - return null; - } else { - double d = this.getEyeY() - 0.3F; -- // Paper start -- final ItemStack tmp = stack.copy(); -- stack.setCount(0); -- stack = tmp; -- // Paper end -+ // Paper start // Leaves start - wtf this for? it breaks quick craft -+ // final ItemStack tmp = stack.copy(); -+ // stack.setCount(0); -+ // stack = tmp; -+ // Paper end // Leaves end - ItemEntity itemEntity = new ItemEntity(this.level(), this.getX(), d, this.getZ(), stack); - itemEntity.setPickUpDelay(40); - if (includeThrower) { diff --git a/leaves-server/minecraft-patches/features/0135-Old-ender-dragon-part-can-use-end-portal.patch b/leaves-server/minecraft-patches/features/0135-Old-ender-dragon-part-can-use-end-portal.patch index b9ebd4a5..c03c8ddd 100644 --- a/leaves-server/minecraft-patches/features/0135-Old-ender-dragon-part-can-use-end-portal.patch +++ b/leaves-server/minecraft-patches/features/0135-Old-ender-dragon-part-can-use-end-portal.patch @@ -26,7 +26,7 @@ This patch is Powered by CrystalCarpetAddition(https://github.com/Crystal0404/Cr */ diff --git a/net/minecraft/world/entity/Entity.java b/net/minecraft/world/entity/Entity.java -index bea4089920191b5e3231e9792a078747923d0c14..e89b6c6de030f1298f3d9919a8b066ed7467ce69 100644 +index 3b9bd49fa39e3b44a7cbf51072e7cf09b186f254..6b56178967872923be58983ce8b14102ec0c3e14 100644 --- a/net/minecraft/world/entity/Entity.java +++ b/net/minecraft/world/entity/Entity.java @@ -185,7 +185,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess @@ -38,7 +38,7 @@ index bea4089920191b5e3231e9792a078747923d0c14..e89b6c6de030f1298f3d9919a8b066ed public boolean collisionLoadChunks = false; // Paper public org.bukkit.craftbukkit.entity.CraftEntity getBukkitEntity() { -@@ -3961,7 +3961,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess +@@ -3958,7 +3958,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess @Nullable public Entity teleport(TeleportTransition teleportTransition) { // Paper start - Fix item duplication and teleport issues @@ -47,7 +47,7 @@ index bea4089920191b5e3231e9792a078747923d0c14..e89b6c6de030f1298f3d9919a8b066ed LOGGER.warn("Illegal Entity Teleport {} to {}:{}", this, teleportTransition.newLevel(), teleportTransition.position(), new Throwable()); return null; } -@@ -4077,7 +4077,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess +@@ -4074,7 +4074,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess entityx.restoreFrom(this); this.removeAfterChangingDimensions(); entityx.teleportSetPosition(PositionMoveRotation.of(teleportTransition), teleportTransition.relatives()); @@ -56,7 +56,7 @@ index bea4089920191b5e3231e9792a078747923d0c14..e89b6c6de030f1298f3d9919a8b066ed for (Entity entity2 : list) { entity2.startRiding(entityx, true); -@@ -4212,6 +4212,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess +@@ -4209,6 +4209,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess } public boolean canTeleport(Level fromLevel, Level toLevel) { diff --git a/leaves-server/minecraft-patches/features/0138-Lithium-Sleeping-Block-Entity.patch b/leaves-server/minecraft-patches/features/0138-Lithium-Sleeping-Block-Entity.patch index 91bff4f1..84146675 100644 --- a/leaves-server/minecraft-patches/features/0138-Lithium-Sleeping-Block-Entity.patch +++ b/leaves-server/minecraft-patches/features/0138-Lithium-Sleeping-Block-Entity.patch @@ -111,7 +111,7 @@ index 86cac164a2bf0e76528396e6aabbfd64cfc29559..da99b4bc7fe8460945070915073be141 int getContainerSize(); diff --git a/net/minecraft/world/entity/Entity.java b/net/minecraft/world/entity/Entity.java -index e89b6c6de030f1298f3d9919a8b066ed7467ce69..22c6a11dd9ea70a242804b91c8fa89cdac2f6f1a 100644 +index 6b56178967872923be58983ce8b14102ec0c3e14..7a85d94f333b6e1def5926b5b7727c22da0a203f 100644 --- a/net/minecraft/world/entity/Entity.java +++ b/net/minecraft/world/entity/Entity.java @@ -309,7 +309,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess @@ -123,7 +123,7 @@ index e89b6c6de030f1298f3d9919a8b066ed7467ce69..22c6a11dd9ea70a242804b91c8fa89cd private final VecDeltaCodec packetPositionCodec = new VecDeltaCodec(); public boolean hasImpulse; @Nullable -@@ -5153,6 +5153,19 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess +@@ -5150,6 +5150,19 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess this.setBoundingBox(this.makeBoundingBox()); } // Paper end - Block invalid positions and bounding box @@ -294,10 +294,10 @@ index 7781ca07a0c8fe1140f341b695e66de95802ee2e..f190e8f244d011bdb7f04ccf0f0a35cb + // Leaves end - Lithium Sleeping Block Entity } diff --git a/net/minecraft/world/inventory/AbstractContainerMenu.java b/net/minecraft/world/inventory/AbstractContainerMenu.java -index c1ca84cf0dbb4fd091cfab517721c87e0f9074a0..5f70277c3548a9cd423585d37497842267652620 100644 +index 403afadbd2280325f1289e302a1ff409f8f0941c..029b8fcc951875c7bc845c507e4f7a91cebc1156 100644 --- a/net/minecraft/world/inventory/AbstractContainerMenu.java +++ b/net/minecraft/world/inventory/AbstractContainerMenu.java -@@ -931,6 +931,7 @@ public abstract class AbstractContainerMenu { +@@ -935,6 +935,7 @@ public abstract class AbstractContainerMenu { } else { float f = 0.0F;