From 6c8462282e29b37ebf512789b1dae6f7fabd3b28 Mon Sep 17 00:00:00 2001 From: Brianna Date: Sat, 4 Apr 2020 07:57:27 -0400 Subject: [PATCH] Added a isRecycled method. --- .../core/compatibility/CompatibleMaterial.java | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/Core/src/main/java/com/songoda/core/compatibility/CompatibleMaterial.java b/Core/src/main/java/com/songoda/core/compatibility/CompatibleMaterial.java index c059978d..b12e226f 100644 --- a/Core/src/main/java/com/songoda/core/compatibility/CompatibleMaterial.java +++ b/Core/src/main/java/com/songoda/core/compatibility/CompatibleMaterial.java @@ -1034,7 +1034,11 @@ public enum CompatibleMaterial { static { for (CompatibleMaterial m : values()) { - lookupMap.put(m.name(), m); + if (m.isRecycled()) { + lookupMap.put(m.legacy, m); + continue; + } + lookupMap.put(m.name(), m); if (!m.usesCompatibility()) { lookupMap.put(m.material + ":" + (m.data == null ? "" : m.data), m); } @@ -1160,6 +1164,15 @@ public enum CompatibleMaterial { //return compatibleMaterial != null && ServerVersion.isServerVersionBelow(compatibleMaterial.versionLessThan); } + /** + * Is this item reused in later versions of Minecraft? + * + * @return + */ + public boolean isRecycled() { + return usesLegacy() && this == CompatibleMaterial.GRASS; + } + /** * Get the legacy data value for this material if there is one, or -1 if * none