aboutsummaryrefslogtreecommitdiffhomepage
path: root/patches/server/1033-Fix-ItemFlags.patch
diff options
context:
space:
mode:
Diffstat (limited to 'patches/server/1033-Fix-ItemFlags.patch')
-rw-r--r--patches/server/1033-Fix-ItemFlags.patch38
1 files changed, 17 insertions, 21 deletions
diff --git a/patches/server/1033-Fix-ItemFlags.patch b/patches/server/1033-Fix-ItemFlags.patch
index df5328f3a8..24f5e95581 100644
--- a/patches/server/1033-Fix-ItemFlags.patch
+++ b/patches/server/1033-Fix-ItemFlags.patch
@@ -33,10 +33,10 @@ index fca0cfba14dd2cc6f24b56eaf269594b2d87fd04..8734f0b777432cd8639094b75a3da1b9
@Override
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java
-index eb9ba1a161f4feade220507a602086bc9d6ce03f..2caa968b3fea322d1cb3210d2dfa7bc844961189 100644
+index b525bfbab2c4a5ea408981287f477a8b35d699ca..43a4a76d3829fb2ed7b5635d804fd826484c16db 100644
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java
-@@ -238,6 +238,12 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta {
+@@ -243,6 +243,12 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta {
static final ItemMetaKeyType<Unit> HIDE_ADDITIONAL_TOOLTIP = new ItemMetaKeyType(DataComponents.HIDE_ADDITIONAL_TOOLTIP);
@Specific(Specific.To.NBT)
static final ItemMetaKeyType<CustomData> CUSTOM_DATA = new ItemMetaKeyType<>(DataComponents.CUSTOM_DATA);
@@ -49,7 +49,7 @@ index eb9ba1a161f4feade220507a602086bc9d6ce03f..2caa968b3fea322d1cb3210d2dfa7bc8
// We store the raw original JSON representation of all text data. See SPIGOT-5063, SPIGOT-5656, SPIGOT-5304
private Component displayName;
-@@ -310,6 +316,10 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta {
+@@ -319,6 +325,10 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta {
this.customTag = meta.customTag;
this.version = meta.version;
@@ -60,7 +60,7 @@ index eb9ba1a161f4feade220507a602086bc9d6ce03f..2caa968b3fea322d1cb3210d2dfa7bc8
}
CraftMetaItem(DataComponentPatch tag) {
-@@ -402,6 +412,20 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta {
+@@ -414,6 +424,20 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta {
this.customTag = null;
}
});
@@ -81,12 +81,8 @@ index eb9ba1a161f4feade220507a602086bc9d6ce03f..2caa968b3fea322d1cb3210d2dfa7bc8
Set<Map.Entry<DataComponentType<?>, Optional<?>>> keys = tag.entrySet();
for (Map.Entry<DataComponentType<?>, Optional<?>> key : keys) {
-@@ -583,10 +607,19 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta {
-
- String unhandled = SerializableMeta.getString(map, "unhandled", true);
- if (unhandled != null) {
-- ByteArrayInputStream buf = new ByteArrayInputStream(Base64.getDecoder().decode(internal));
-+ ByteArrayInputStream buf = new ByteArrayInputStream(Base64.getDecoder().decode(unhandled)); // Paper - fix deserializing unhandled tags
+@@ -603,7 +627,16 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta {
+ ByteArrayInputStream buf = new ByteArrayInputStream(Base64.getDecoder().decode(unhandled));
try {
CompoundTag unhandledTag = NbtIo.readCompressed(buf, NbtAccounter.unlimitedHeap());
- this.unhandledTags.copy(DataComponentPatch.CODEC.parse(MinecraftServer.getDefaultRegistryAccess().createSerializationContext(NbtOps.INSTANCE), unhandledTag).result().get());
@@ -103,7 +99,7 @@ index eb9ba1a161f4feade220507a602086bc9d6ce03f..2caa968b3fea322d1cb3210d2dfa7bc8
} catch (IOException ex) {
Logger.getLogger(CraftMetaItem.class.getName()).log(Level.SEVERE, null, ex);
}
-@@ -796,6 +829,15 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta {
+@@ -817,6 +850,15 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta {
itemTag.put(CraftMetaItem.MAX_DAMAGE, this.maxDamage);
}
@@ -119,17 +115,17 @@ index eb9ba1a161f4feade220507a602086bc9d6ce03f..2caa968b3fea322d1cb3210d2dfa7bc8
for (Map.Entry<DataComponentType<?>, Optional<?>> e : this.unhandledTags.build().entrySet()) {
e.getValue().ifPresentOrElse((value) -> {
itemTag.builder.set((DataComponentType) e.getKey(), value);
-@@ -870,7 +912,7 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta {
+@@ -891,7 +933,7 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta {
@Overridden
boolean isEmpty() {
-- return !(this.hasDisplayName() || this.hasItemName() || this.hasLocalizedName() || this.hasEnchants() || (this.lore != null) || this.hasCustomModelData() || this.hasBlockData() || this.hasRepairCost() || !this.unhandledTags.build().isEmpty() || !this.persistentDataContainer.isEmpty() || this.hideFlag != 0 || this.isHideTooltip() || this.isUnbreakable() || this.hasEnchantmentGlintOverride() || this.isFireResistant() || this.hasMaxStackSize() || this.hasRarity() || this.hasFood() || this.hasDamage() || this.hasMaxDamage() || this.hasAttributeModifiers() || this.customTag != null);
-+ return !(this.hasDisplayName() || this.hasItemName() || this.hasLocalizedName() || this.hasEnchants() || (this.lore != null) || this.hasCustomModelData() || this.hasBlockData() || this.hasRepairCost() || !this.unhandledTags.build().isEmpty() || !this.persistentDataContainer.isEmpty() || this.hideFlag != 0 || this.isHideTooltip() || this.isUnbreakable() || this.hasEnchantmentGlintOverride() || this.isFireResistant() || this.hasMaxStackSize() || this.hasRarity() || this.hasFood() || this.hasDamage() || this.hasMaxDamage() || this.hasAttributeModifiers() || this.customTag != null || this.canPlaceOnPredicates != null || this.canBreakPredicates != null); // Paper
+- return !(this.hasDisplayName() || this.hasItemName() || this.hasLocalizedName() || this.hasEnchants() || (this.lore != null) || this.hasCustomModelData() || this.hasBlockData() || this.hasRepairCost() || !this.unhandledTags.build().isEmpty() || !this.persistentDataContainer.isEmpty() || this.hideFlag != 0 || this.isHideTooltip() || this.isUnbreakable() || this.hasEnchantmentGlintOverride() || this.isFireResistant() || this.hasMaxStackSize() || this.hasRarity() || this.hasFood() || this.hasTool() || this.hasDamage() || this.hasMaxDamage() || this.hasAttributeModifiers() || this.customTag != null);
++ return !(this.hasDisplayName() || this.hasItemName() || this.hasLocalizedName() || this.hasEnchants() || (this.lore != null) || this.hasCustomModelData() || this.hasBlockData() || this.hasRepairCost() || !this.unhandledTags.build().isEmpty() || !this.persistentDataContainer.isEmpty() || this.hideFlag != 0 || this.isHideTooltip() || this.isUnbreakable() || this.hasEnchantmentGlintOverride() || this.isFireResistant() || this.hasMaxStackSize() || this.hasRarity() || this.hasFood() || this.hasTool() || this.hasDamage() || this.hasMaxDamage() || this.hasAttributeModifiers() || this.customTag != null || this.canPlaceOnPredicates != null || this.canBreakPredicates != null); // Paper
}
// Paper start
-@@ -1507,6 +1549,8 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta {
- && (this.hasFood() ? that.hasFood() && this.food.equals(that.food) : !that.hasFood())
+@@ -1544,6 +1586,8 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta {
+ && (this.hasTool() ? that.hasTool() && this.tool.equals(that.tool) : !that.hasTool())
&& (this.hasDamage() ? that.hasDamage() && this.damage == that.damage : !that.hasDamage())
&& (this.hasMaxDamage() ? that.hasMaxDamage() && this.maxDamage.equals(that.maxDamage) : !that.hasMaxDamage())
+ && (this.canPlaceOnPredicates != null ? that.canPlaceOnPredicates != null && this.canPlaceOnPredicates.equals(that.canPlaceOnPredicates) : that.canPlaceOnPredicates == null) // Paper
@@ -137,7 +133,7 @@ index eb9ba1a161f4feade220507a602086bc9d6ce03f..2caa968b3fea322d1cb3210d2dfa7bc8
&& (this.version == that.version);
}
-@@ -1549,6 +1593,8 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta {
+@@ -1587,6 +1631,8 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta {
hash = 61 * hash + (this.hasDamage() ? this.damage : 0);
hash = 61 * hash + (this.hasMaxDamage() ? 1231 : 1237);
hash = 61 * hash + (this.hasAttributeModifiers() ? this.attributeModifiers.hashCode() : 0);
@@ -146,7 +142,7 @@ index eb9ba1a161f4feade220507a602086bc9d6ce03f..2caa968b3fea322d1cb3210d2dfa7bc8
hash = 61 * hash + this.version;
return hash;
}
-@@ -1586,6 +1632,14 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta {
+@@ -1627,6 +1673,14 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta {
clone.damage = this.damage;
clone.maxDamage = this.maxDamage;
clone.version = this.version;
@@ -161,7 +157,7 @@ index eb9ba1a161f4feade220507a602086bc9d6ce03f..2caa968b3fea322d1cb3210d2dfa7bc8
return clone;
} catch (CloneNotSupportedException e) {
throw new Error(e);
-@@ -1695,6 +1749,16 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta {
+@@ -1740,6 +1794,16 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta {
}
}
@@ -178,7 +174,7 @@ index eb9ba1a161f4feade220507a602086bc9d6ce03f..2caa968b3fea322d1cb3210d2dfa7bc8
if (!this.unhandledTags.isEmpty()) {
Tag unhandled = DataComponentPatch.CODEC.encodeStart(MinecraftServer.getDefaultRegistryAccess().createSerializationContext(NbtOps.INSTANCE), this.unhandledTags.build()).getOrThrow(IllegalStateException::new);
try {
-@@ -1705,6 +1769,14 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta {
+@@ -1750,6 +1814,14 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta {
Logger.getLogger(CraftMetaItem.class.getName()).log(Level.SEVERE, null, ex);
}
}
@@ -193,7 +189,7 @@ index eb9ba1a161f4feade220507a602086bc9d6ce03f..2caa968b3fea322d1cb3210d2dfa7bc8
if (!this.persistentDataContainer.isEmpty()) { // Store custom tags, wrapped in their compound
builder.put(CraftMetaItem.BUKKIT_CUSTOM_TAG.BUKKIT, this.persistentDataContainer.serialize());
-@@ -1846,6 +1918,8 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta {
+@@ -1888,6 +1960,8 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta {
CraftMetaItem.MAX_DAMAGE.TYPE,
CraftMetaItem.CUSTOM_DATA.TYPE,
CraftMetaItem.ATTRIBUTES.TYPE,