aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--patches/server/1041-Fix-ItemFlags.patch18
1 files changed, 9 insertions, 9 deletions
diff --git a/patches/server/1041-Fix-ItemFlags.patch b/patches/server/1041-Fix-ItemFlags.patch
index 94985c5f11..d304c0b9cc 100644
--- a/patches/server/1041-Fix-ItemFlags.patch
+++ b/patches/server/1041-Fix-ItemFlags.patch
@@ -33,7 +33,7 @@ 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 ba58f0f2f4f9cb99fb6cecfe772ae5781f976b63..9cd528a70ef3e6053a7103a6f9df5e93bb8550a4 100644
+index ba58f0f2f4f9cb99fb6cecfe772ae5781f976b63..04a0f63411ed95bcf5bac1689d29bbe52f345bac 100644
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java
@@ -224,6 +224,12 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta {
@@ -108,11 +108,11 @@ index ba58f0f2f4f9cb99fb6cecfe772ae5781f976b63..9cd528a70ef3e6053a7103a6f9df5e93
}
+ // Paper start
-+ if (this.canPlaceOnPredicates != null || this.hasItemFlag(ItemFlag.HIDE_PLACED_ON)) {
-+ itemTag.put(CraftMetaItem.CAN_PLACE_ON, new net.minecraft.world.item.AdventureModePredicate(this.canPlaceOnPredicates != null ? this.canPlaceOnPredicates : Collections.emptyList(), !this.hasItemFlag(ItemFlag.HIDE_PLACED_ON)));
++ if (this.canPlaceOnPredicates != null && !this.canPlaceOnPredicates.isEmpty()) {
++ itemTag.put(CraftMetaItem.CAN_PLACE_ON, new net.minecraft.world.item.AdventureModePredicate(this.canPlaceOnPredicates, !this.hasItemFlag(ItemFlag.HIDE_PLACED_ON)));
+ }
-+ if (this.canBreakPredicates != null || this.hasItemFlag(ItemFlag.HIDE_DESTROYS)) {
-+ itemTag.put(CraftMetaItem.CAN_BREAK, new net.minecraft.world.item.AdventureModePredicate(this.canBreakPredicates != null ? this.canBreakPredicates : Collections.emptyList(), !this.hasItemFlag(ItemFlag.HIDE_DESTROYS)));
++ if (this.canBreakPredicates != null && !this.canBreakPredicates.isEmpty()) {
++ itemTag.put(CraftMetaItem.CAN_BREAK, new net.minecraft.world.item.AdventureModePredicate(this.canBreakPredicates, !this.hasItemFlag(ItemFlag.HIDE_DESTROYS)));
+ }
+ // Paper end
+
@@ -166,13 +166,13 @@ index ba58f0f2f4f9cb99fb6cecfe772ae5781f976b63..9cd528a70ef3e6053a7103a6f9df5e93
}
+ // Paper start
-+ final boolean canBreakAddToUnhandled = this.canBreakPredicates != null || this.hasItemFlag(ItemFlag.HIDE_DESTROYS);
++ final boolean canBreakAddToUnhandled = this.canBreakPredicates != null && !this.canBreakPredicates.isEmpty();
+ if (canBreakAddToUnhandled) {
-+ this.unhandledTags.set(DataComponents.CAN_BREAK, new net.minecraft.world.item.AdventureModePredicate(this.canBreakPredicates != null ? this.canBreakPredicates : Collections.emptyList(), !this.hasItemFlag(ItemFlag.HIDE_DESTROYS)));
++ this.unhandledTags.set(DataComponents.CAN_BREAK, new net.minecraft.world.item.AdventureModePredicate(this.canBreakPredicates, !this.hasItemFlag(ItemFlag.HIDE_DESTROYS)));
+ }
-+ final boolean canPlaceOnAddToUnhandled = this.canPlaceOnPredicates != null || this.hasItemFlag(ItemFlag.HIDE_PLACED_ON);
++ final boolean canPlaceOnAddToUnhandled = this.canPlaceOnPredicates != null && !this.canPlaceOnPredicates.isEmpty();
+ if (canPlaceOnAddToUnhandled) {
-+ this.unhandledTags.set(DataComponents.CAN_PLACE_ON, new net.minecraft.world.item.AdventureModePredicate(this.canPlaceOnPredicates != null ? this.canPlaceOnPredicates : Collections.emptyList(), !this.hasItemFlag(ItemFlag.HIDE_PLACED_ON)));
++ this.unhandledTags.set(DataComponents.CAN_PLACE_ON, new net.minecraft.world.item.AdventureModePredicate(this.canPlaceOnPredicates, !this.hasItemFlag(ItemFlag.HIDE_PLACED_ON)));
+ }
+ // Paper end
if (!this.unhandledTags.isEmpty()) {