mirror of
https://github.com/PaperMC/Paper.git
synced 2024-11-01 08:20:51 +01:00
7c2dc4b342
* finish implementing all adventure components in codecs * add some initial tests * Add round trip tests for text and translatable components * Add more round trip test data (score component is failing) * Add more round trip test data * Fix SCORE_COMPONENT_MAP_CODEC * Improve test failure messages * Add failure cases * Add a couple more test data * Make use of AdventureCodecs * Update patches after rebase * Squash changes into adventure patch * Fix AT formatting * update comment --------- Co-authored-by: Jason Penilla <11360596+jpenilla@users.noreply.github.com>
31 lines
1.4 KiB
Diff
31 lines
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 8c06ff72bcc7cce2c853bf999bda8afc10e53ca6..7081aebf67cc3d8deb27dfc508970f0fa5e9d1b6 100644
|
|
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemStack.java
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemStack.java
|
|
@@ -157,7 +157,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;
|
|
}
|
|
}
|