fix CompassMeta not being correct (#10737)

This commit is contained in:
Jake Potrebic 2024-05-19 17:15:44 -07:00 committed by GitHub
parent 0ad09de75b
commit b3b340617e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -194,6 +194,43 @@ index 3f78a0935d738854182254b345064e3c225dcd5f..218df87c596d47b431dbbf2aa42822ef
}
if (this.resolved) {
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaCompass.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaCompass.java
index bbca26f5debb263b04516e68f6e49f68a38fa5b1..aacc4d010f4dfa4d9d11332b802205a6f35b6de3 100644
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaCompass.java
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaCompass.java
@@ -36,7 +36,7 @@ public class CraftMetaCompass extends CraftMetaItem implements CompassMeta {
private int lodestoneX;
private int lodestoneY;
private int lodestoneZ;
- private boolean tracked = true;
+ private Boolean tracked = null; // Paper - tri-state
CraftMetaCompass(CraftMetaItem meta) {
super(meta);
@@ -80,7 +80,7 @@ public class CraftMetaCompass extends CraftMetaItem implements CompassMeta {
this.setLodestone(lodestone);
}
}
- this.tracked = SerializableMeta.getBoolean(map, CraftMetaCompass.LODESTONE_TRACKED.BUKKIT);
+ this.tracked = SerializableMeta.getObjectOptionally(Boolean.class, map, CraftMetaCompass.LODESTONE_TRACKED.BUKKIT, true).orElse(null); // Paper - tri-state
}
@Override
@@ -146,12 +146,12 @@ public class CraftMetaCompass extends CraftMetaItem implements CompassMeta {
}
boolean hasLodestoneTracked() {
- return !this.tracked;
+ return this.tracked != null; // Paper - tri-state
}
@Override
public boolean isLodestoneTracked() {
- return this.tracked;
+ return this.tracked != null && this.tracked; // Paper - tri-state
}
@Override
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaFirework.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaFirework.java
index 8e0dd4b7a7a25a8beb27b507047bc48d8227627c..cf5d27ccc2225bac3aa57912f444f95d2f37e32e 100644
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaFirework.java