Skip to content

Commit 536eb03

Browse files
committed
Trigger classloading of Items when deferring blockstate cache rebuild
1 parent 1b37c9d commit 536eb03

File tree

1 file changed

+3
-0
lines changed
  • common/src/main/java/org/embeddedt/modernfix/common/mixin/perf/reduce_blockstate_cache_rebuilds

1 file changed

+3
-0
lines changed

common/src/main/java/org/embeddedt/modernfix/common/mixin/perf/reduce_blockstate_cache_rebuilds/BlocksMixin.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package org.embeddedt.modernfix.common.mixin.perf.reduce_blockstate_cache_rebuilds;
22

3+
import net.minecraft.world.item.Items;
34
import net.minecraft.world.level.block.Blocks;
45
import net.minecraft.world.level.block.state.BlockState;
56
import org.embeddedt.modernfix.blockstate.BlockStateCacheHandler;
@@ -22,6 +23,8 @@ private static Consumer getEmptyConsumer(Consumer original) {
2223
// require = 0 due to Forge removing the BLOCK_STATE_REGISTRY init here
2324
@Redirect(method = "<clinit>", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/level/block/state/BlockState;initCache()V"), require = 0)
2425
private static void skipCacheInit(BlockState state) {
26+
// Trigger classloading of Items in case a mod expects it.
27+
Items.AIR.asItem();
2528
// Mark the cache as invalid
2629
((IBlockState)state).clearCache();
2730
}

0 commit comments

Comments
 (0)