Skip to content

Commit

Permalink
Fix crash when retextured blocks have invalid NBT (#207)
Browse files Browse the repository at this point in the history
Only really happens when people misuse commands, but better to not crash
  • Loading branch information
KnightMiner committed Dec 10, 2024
1 parent f86893e commit 7701195
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/main/java/slimeknights/mantle/util/RetexturedHelper.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down

0 comments on commit 7701195

Please sign in to comment.