File tree Expand file tree Collapse file tree 1 file changed +22
-0
lines changed
common/src/main/java/org/embeddedt/modernfix/common/mixin/perf/compact_mojang_registries Expand file tree Collapse file tree 1 file changed +22
-0
lines changed Original file line number Diff line number Diff line change 1+ package org .embeddedt .modernfix .common .mixin .perf .compact_mojang_registries ;
2+
3+ import com .llamalad7 .mixinextras .injector .wrapmethod .WrapMethod ;
4+ import com .llamalad7 .mixinextras .injector .wrapoperation .Operation ;
5+ import net .minecraft .core .HolderLookup ;
6+ import net .minecraft .data .registries .VanillaRegistries ;
7+ import org .spongepowered .asm .mixin .Mixin ;
8+
9+ @ Mixin (VanillaRegistries .class )
10+ public class VanillaRegistriesMixin {
11+ private static HolderLookup .Provider STATIC_PROVIDER ;
12+
13+ @ WrapMethod (method = "createLookup" )
14+ private static HolderLookup .Provider modernfix$memoizeLookup (Operation <HolderLookup .Provider > original ) {
15+ synchronized (VanillaRegistries .class ) {
16+ if (STATIC_PROVIDER == null ) {
17+ STATIC_PROVIDER = original .call ();
18+ }
19+ return STATIC_PROVIDER ;
20+ }
21+ }
22+ }
You can’t perform that action at this time.
0 commit comments