File tree Expand file tree Collapse file tree 1 file changed +29
-0
lines changed
common/src/main/java/org/embeddedt/modernfix/common/mixin/perf/mojang_registry_size Expand file tree Collapse file tree 1 file changed +29
-0
lines changed Original file line number Diff line number Diff line change 1+ package org .embeddedt .modernfix .common .mixin .perf .mojang_registry_size ;
2+
3+ import com .google .common .collect .ImmutableTable ;
4+ import com .google .common .collect .Table ;
5+ import net .minecraft .world .level .block .state .StateHolder ;
6+ import net .minecraft .world .level .block .state .properties .Property ;
7+ import org .embeddedt .modernfix .annotation .RequiresMod ;
8+ import org .spongepowered .asm .mixin .Mixin ;
9+ import org .spongepowered .asm .mixin .Shadow ;
10+ import org .spongepowered .asm .mixin .injection .At ;
11+ import org .spongepowered .asm .mixin .injection .Inject ;
12+ import org .spongepowered .asm .mixin .injection .callback .CallbackInfo ;
13+
14+ /**
15+ * Minor mixin to avoid duplicate empty neighbor tables, used when FerriteCore is not present. Won't be enabled in 99% of
16+ * modded environments but is useful for testing in dev without dragging in Fabric API.
17+ */
18+ @ Mixin (StateHolder .class )
19+ @ RequiresMod ("!ferritecore" )
20+ public class StateHolderMixin {
21+ @ Shadow private Table <Property <?>, Comparable <?>, ?> neighbours ;
22+
23+ /* optimize the case where block has no properties */
24+ @ Inject (method = "populateNeighbours" , at = @ At ("RETURN" ), require = 0 )
25+ private void replaceEmptyTable (CallbackInfo ci ) {
26+ if (this .neighbours .isEmpty ())
27+ this .neighbours = ImmutableTable .of ();
28+ }
29+ }
You can’t perform that action at this time.
0 commit comments