9
0
mirror of https://github.com/LeavesMC/Leaves.git synced 2025-12-19 14:59:32 +00:00

Merge Paper#11831 (#695)

This commit is contained in:
violetc
2025-08-24 11:42:38 +08:00
parent 13651b1120
commit 513768c965
4 changed files with 90 additions and 37 deletions

View File

@@ -0,0 +1,82 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: MC_XiaoHei <xor7xiaohei@gmail.com>
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<ServerPlayer> 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);
}
}

View File

@@ -1,29 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: MC_XiaoHei <xor7xiaohei@gmail.com>
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) {

View File

@@ -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 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 --- a/net/minecraft/world/entity/Entity.java
+++ b/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 @@ -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 boolean collisionLoadChunks = false; // Paper
public org.bukkit.craftbukkit.entity.CraftEntity getBukkitEntity() { 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 @Nullable
public Entity teleport(TeleportTransition teleportTransition) { public Entity teleport(TeleportTransition teleportTransition) {
// Paper start - Fix item duplication and teleport issues // 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()); LOGGER.warn("Illegal Entity Teleport {} to {}:{}", this, teleportTransition.newLevel(), teleportTransition.position(), new Throwable());
return null; 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); entityx.restoreFrom(this);
this.removeAfterChangingDimensions(); this.removeAfterChangingDimensions();
entityx.teleportSetPosition(PositionMoveRotation.of(teleportTransition), teleportTransition.relatives()); entityx.teleportSetPosition(PositionMoveRotation.of(teleportTransition), teleportTransition.relatives());
@@ -56,7 +56,7 @@ index bea4089920191b5e3231e9792a078747923d0c14..e89b6c6de030f1298f3d9919a8b066ed
for (Entity entity2 : list) { for (Entity entity2 : list) {
entity2.startRiding(entityx, true); 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) { public boolean canTeleport(Level fromLevel, Level toLevel) {

View File

@@ -111,7 +111,7 @@ index 86cac164a2bf0e76528396e6aabbfd64cfc29559..da99b4bc7fe8460945070915073be141
int getContainerSize(); int getContainerSize();
diff --git a/net/minecraft/world/entity/Entity.java b/net/minecraft/world/entity/Entity.java 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 --- a/net/minecraft/world/entity/Entity.java
+++ b/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 @@ -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(); private final VecDeltaCodec packetPositionCodec = new VecDeltaCodec();
public boolean hasImpulse; public boolean hasImpulse;
@Nullable @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()); this.setBoundingBox(this.makeBoundingBox());
} }
// Paper end - Block invalid positions and bounding box // Paper end - Block invalid positions and bounding box
@@ -294,10 +294,10 @@ index 7781ca07a0c8fe1140f341b695e66de95802ee2e..f190e8f244d011bdb7f04ccf0f0a35cb
+ // Leaves end - Lithium Sleeping Block Entity + // Leaves end - Lithium Sleeping Block Entity
} }
diff --git a/net/minecraft/world/inventory/AbstractContainerMenu.java b/net/minecraft/world/inventory/AbstractContainerMenu.java 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 --- a/net/minecraft/world/inventory/AbstractContainerMenu.java
+++ b/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 { } else {
float f = 0.0F; float f = 0.0F;