diff --git a/common/src/main/java/org/embeddedt/modernfix/common/mixin/perf/deduplicate_wall_shapes/WallBlockMixin.java b/common/src/main/java/org/embeddedt/modernfix/common/mixin/perf/deduplicate_wall_shapes/WallBlockMixin.java index 169852fe..fb8af245 100644 --- a/common/src/main/java/org/embeddedt/modernfix/common/mixin/perf/deduplicate_wall_shapes/WallBlockMixin.java +++ b/common/src/main/java/org/embeddedt/modernfix/common/mixin/perf/deduplicate_wall_shapes/WallBlockMixin.java @@ -40,13 +40,19 @@ public abstract class WallBlockMixin extends Block { return; ImmutableMap.Builder builder = ImmutableMap.builder(); for(BlockState state : this.stateDefinition.getPossibleStates()) { - builder.put(state, cache.getFirst().get(state.getValues())); + VoxelShape shape = cache.getFirst().get(state.getValues()); + if(shape == null) + return; // fallback to vanilla logic + builder.put(state, shape); } cir.setReturnValue(builder.build()); } @Inject(method = "makeShapes", at = @At("RETURN")) private synchronized void storeCachedShapesByProperty(float f1, float f2, float f3, float f4, float f5, float f6, CallbackInfoReturnable> cir) { + // never populate cache as a non-vanilla block + if((Class)this.getClass() != WallBlock.class) + return; ImmutableList key = ImmutableList.of(f1, f2, f3, f4, f5, f6); if(!CACHE_BY_SHAPE_VALS.containsKey(key)) { Map, Comparable>, VoxelShape> cacheByProperties = new HashMap<>();