79 lines
4.7 KiB
Diff
79 lines
4.7 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: mrhua269 <mrhua269@gmail.com>
|
|
Date: Tue, 26 Aug 2025 10:38:44 +0800
|
|
Subject: [PATCH] Leaves: TEMP Merge Paper#11831
|
|
|
|
A part of Leaves(https://github.com/LeavesMC/Leaves)
|
|
|
|
Original patch: https://github.com/LeavesMC/Leaves/blob/513768c965cb43bfb2361ca8689b6dee2ac0d792/leaves-server/minecraft-patches/features/0134-TEMP-Merge-Paper-11831.patch#L59
|
|
Co-authored-by: MC_XiaoHei <xor7xiaohei@gmail.com>
|
|
Original license: GPL3(https://github.com/LeavesMC/Leaves/blob/master/licenses/GPL.md)
|
|
|
|
diff --git a/net/minecraft/server/commands/GiveCommand.java b/net/minecraft/server/commands/GiveCommand.java
|
|
index f7002d6752aa03603eb06e298ba1d7130cf13826..7ef109cb9921c25987905149616eddbd0b2f9b9c 100644
|
|
--- a/net/minecraft/server/commands/GiveCommand.java
|
|
+++ b/net/minecraft/server/commands/GiveCommand.java
|
|
@@ -101,11 +101,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 0a2bdd4cb84abe58ce891cf39a63c658e3cd8298..4e33cc402bf34aa9b216323a52158d5fe2eb736b 100644
|
|
--- a/net/minecraft/world/entity/Entity.java
|
|
+++ b/net/minecraft/world/entity/Entity.java
|
|
@@ -2816,10 +2816,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 1f41c14a146c9e412fe6f6d9d362208ddbd40e6c..6b759432136321c345ddce22e419fbfe8acc39de 100644
|
|
--- a/net/minecraft/world/entity/LivingEntity.java
|
|
+++ b/net/minecraft/world/entity/LivingEntity.java
|
|
@@ -3958,11 +3958,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 06846950348954328c07f64cd9b3359e79a1a468..d2a570e559150d8bc8a1ba68d8ce57b2bababab9 100644
|
|
--- a/net/minecraft/world/inventory/AbstractContainerMenu.java
|
|
+++ b/net/minecraft/world/inventory/AbstractContainerMenu.java
|
|
@@ -644,7 +644,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);
|
|
}
|
|
}
|