From e8efb5c1f8bf2efb0c2a59b1c4f57075c847595a Mon Sep 17 00:00:00 2001 From: PseudoKnight Date: Sun, 22 Dec 2024 21:57:20 -0800 Subject: [PATCH] Fix old UNCRAFTABLE base potion conversion --- .../java/com/laytonsmith/abstraction/enums/MCPotionType.java | 2 ++ src/main/java/com/laytonsmith/core/ObjectGenerator.java | 3 +++ 2 files changed, 5 insertions(+) diff --git a/src/main/java/com/laytonsmith/abstraction/enums/MCPotionType.java b/src/main/java/com/laytonsmith/abstraction/enums/MCPotionType.java index 1261fa494..a5147a595 100644 --- a/src/main/java/com/laytonsmith/abstraction/enums/MCPotionType.java +++ b/src/main/java/com/laytonsmith/abstraction/enums/MCPotionType.java @@ -26,6 +26,8 @@ public static MCPotionType valueOf(String test) throws IllegalArgumentException MCVanillaPotionType oldType = MCVanillaPotionType.valueOf(test); if(oldType.rename != null) { return MAP.get(oldType.rename); + } else if(oldType == MCVanillaPotionType.UNCRAFTABLE) { + return null; } throw new IllegalArgumentException("Unknown potion type: " + test); } diff --git a/src/main/java/com/laytonsmith/core/ObjectGenerator.java b/src/main/java/com/laytonsmith/core/ObjectGenerator.java index 2b319a4e5..97c84af7b 100644 --- a/src/main/java/com/laytonsmith/core/ObjectGenerator.java +++ b/src/main/java/com/laytonsmith/core/ObjectGenerator.java @@ -2021,6 +2021,9 @@ public MCPotionType legacyPotionData(CArray potionArray, Target t) { } catch (IllegalArgumentException ex) { throw new CREFormatException("Invalid potion type: " + potionArray.get("type", t).val(), t); } + if(type == null) { + return null; + } boolean extended = false; boolean upgraded = false; if(potionArray.containsKey("extended")) {