Skip filtering states when not in a world

This commit is contained in:
embeddedt 2024-09-21 14:17:03 -04:00
parent 1572bd705d
commit 9df79d8c8c
No known key found for this signature in database
GPG Key ID: A69433EC199B5613

View File

@ -52,8 +52,8 @@ public abstract class BlockStateModelLoaderMixin implements IBlockStateModelLoad
var optionalBlock = BuiltInRegistries.BLOCK.getOptional(location.id());
if(optionalBlock.isPresent()) {
try {
// Only filter states if we are not in the loading overlay
filteredStates = Minecraft.getInstance().getOverlay() == null ? ModelBakeryHelpers.getBlockStatesForMRL(optionalBlock.get().getStateDefinition(), location) : null;
// Only filter states if we are in a world and not in the loading overlay
filteredStates = (Minecraft.getInstance().getOverlay() == null && Minecraft.getInstance().level != null) ? ModelBakeryHelpers.getBlockStatesForMRL(optionalBlock.get().getStateDefinition(), location) : null;
} catch(RuntimeException e) {
ModernFix.LOGGER.error("Exception filtering states on {}", location, e);
filteredStates = null;