Skip to content

Commit 8e1270d

Browse files
committed
Skip filtering blockstates if client is not in world
1 parent fec7eb6 commit 8e1270d

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

fabric/src/main/java/org/embeddedt/modernfix/fabric/mixin/perf/dynamic_resources/ModelBakeryMixin.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -297,7 +297,7 @@ private <T extends Comparable<T>, V extends T> BlockState setPropertyGeneric(Blo
297297
}
298298
@Redirect(method = "loadModel", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/level/block/state/StateDefinition;getPossibleStates()Lcom/google/common/collect/ImmutableList;"))
299299
private ImmutableList<BlockState> loadOnlyRelevantBlockState(StateDefinition<Block, BlockState> stateDefinition, ResourceLocation location) {
300-
if(!(location instanceof ModelResourceLocation) || Minecraft.getInstance().getOverlay() != null)
300+
if(!(location instanceof ModelResourceLocation) || Minecraft.getInstance().getOverlay() != null || Minecraft.getInstance().level == null)
301301
return stateDefinition.getPossibleStates();
302302
return ModelBakeryHelpers.getBlockStatesForMRL(stateDefinition, (ModelResourceLocation)location);
303303
}

forge/src/main/java/org/embeddedt/modernfix/forge/mixin/perf/dynamic_resources/ModelBakeryMixin.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -303,7 +303,7 @@ private <T extends Comparable<T>, V extends T> BlockState setPropertyGeneric(Blo
303303
}
304304
@Redirect(method = "loadModel", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/level/block/state/StateDefinition;getPossibleStates()Lcom/google/common/collect/ImmutableList;"))
305305
private ImmutableList<BlockState> loadOnlyRelevantBlockState(StateDefinition<Block, BlockState> stateDefinition, ResourceLocation location) {
306-
if(!(location instanceof ModelResourceLocation) || Minecraft.getInstance().getOverlay() != null)
306+
if(!(location instanceof ModelResourceLocation) || Minecraft.getInstance().getOverlay() != null || Minecraft.getInstance().level == null)
307307
return stateDefinition.getPossibleStates();
308308
return ModelBakeryHelpers.getBlockStatesForMRL(stateDefinition, (ModelResourceLocation)location);
309309
}

0 commit comments

Comments
 (0)