From 770119566d9c90462b420402e30677ad65c928bc Mon Sep 17 00:00:00 2001 From: KnightMiner Date: Mon, 9 Dec 2024 20:21:39 -0500 Subject: [PATCH] Fix crash when retextured blocks have invalid NBT (#207) Only really happens when people misuse commands, but better to not crash --- src/main/java/slimeknights/mantle/util/RetexturedHelper.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/main/java/slimeknights/mantle/util/RetexturedHelper.java b/src/main/java/slimeknights/mantle/util/RetexturedHelper.java index e3a8ef48..616ab069 100644 --- a/src/main/java/slimeknights/mantle/util/RetexturedHelper.java +++ b/src/main/java/slimeknights/mantle/util/RetexturedHelper.java @@ -36,7 +36,10 @@ public final class RetexturedHelper { */ public static Block getBlock(String name) { if (!name.isEmpty()) { - return Registry.BLOCK.get(new ResourceLocation(name)); + ResourceLocation location = ResourceLocation.tryParse(name); + if (location != null) { + return Registry.BLOCK.get(location); + } } return Blocks.AIR; }