geforkt von Mirrors/Paper
2873869bb1
Signs no longer have a specific isEdiable state, the entire API in this regard needs updating/deprecation. The boolean field is completely gone, replaced by a uuid (which will need a new setEditingPlayer(UUID) method on the Sign interface), and the current upstream implementation of setEdiable simply flips the is_waxed state. This patch is hence not needed as it neither allows editing (which will be redone in a later patch) nor is required to copy the is_waxed boolean flag as it lives in the signs compound tag and is covered by applyTo.
31 Zeilen
1.4 KiB
Diff
31 Zeilen
1.4 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: Josh Roy <joshroy126@gmail.com>
|
|
Date: Mon, 23 Jan 2023 19:19:01 -0500
|
|
Subject: [PATCH] Remove CraftItemStack#setAmount null assignment
|
|
|
|
This creates a problem with Paper's item serialization
|
|
api where deserialized items, which are internally
|
|
created as a CraftItemStack, will be completely lost if
|
|
#setAmount(0) is invoked (since the underlying handle
|
|
is set to null), while a regular Bukkit ItemStack
|
|
simply sets the amount field to zero, retaining the
|
|
item's data.
|
|
|
|
Vanilla treats items with zero amounts the same as items
|
|
with less than zero amounts, so this code doesn't create
|
|
a problem with operations on the vanilla ItemStack.
|
|
|
|
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemStack.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemStack.java
|
|
index 8683bb08c2d9a7514ee6b16690b61240fb807d15..24fac69bc63f949001252811f792b21955a13e9d 100644
|
|
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemStack.java
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemStack.java
|
|
@@ -146,7 +146,7 @@ public final class CraftItemStack extends ItemStack {
|
|
}
|
|
|
|
this.handle.setCount(amount);
|
|
- if (amount == 0) {
|
|
+ if (false && amount == 0) { // Paper - remove CraftItemStack#setAmount null assignment
|
|
this.handle = null;
|
|
}
|
|
}
|