From 52e03b47a2fd8086ef7df9ddac46eadb952ef12e Mon Sep 17 00:00:00 2001 From: CraftBukkit/Spigot Date: Fri, 20 Sep 2024 07:17:47 +1000 Subject: [PATCH] #1479: Use custom #isBlock method in legacy init instead of the one in Material, since it relies on legacy being init By: DerFrZocker --- .../java/org/bukkit/craftbukkit/legacy/CraftLegacy.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/paper-server/src/main/java/org/bukkit/craftbukkit/legacy/CraftLegacy.java b/paper-server/src/main/java/org/bukkit/craftbukkit/legacy/CraftLegacy.java index 01a01dad78..6ba12831af 100644 --- a/paper-server/src/main/java/org/bukkit/craftbukkit/legacy/CraftLegacy.java +++ b/paper-server/src/main/java/org/bukkit/craftbukkit/legacy/CraftLegacy.java @@ -331,7 +331,7 @@ public final class CraftLegacy { } // Handle blocks - if (material.isBlock()) { + if (isBlock(material)) { // Use custom method instead of Material#isBlock since it relies on this being already run for (byte data = 0; data < 16; data++) { MaterialData matData = new MaterialData(material, data); Dynamic blockTag = DataConverterFlattenData.getTag(material.getId() << 4 | data); @@ -438,6 +438,12 @@ public final class CraftLegacy { } } + private static boolean isBlock(Material material) { + // From Material#isBlock before the rewrite to ItemType / BlockType + // Git hash: 42f6cdf4c5dcdd52a27543403dcd17fb60311621 + return 0 <= material.getId() && material.getId() < 256; + } + public static void main(String[] args) { System.err.println(""); }