File tree Expand file tree Collapse file tree
src/main/java/fr/iamacat/optimizationsandtweaks Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -105,7 +105,9 @@ public enum Mixin implements IMixin {
105105 common_core_MixinNBTTagCompound (Side .COMMON ,
106106 avoid (TargetedMod .DRAGONAPI ).and (m -> OptimizationsandTweaksConfig .enableMixinNBTTagCompound ),
107107 "core.MixinNBTTagCompound" ),
108-
108+ common_core_MixinNBTBase (Side .COMMON ,
109+ avoid (TargetedMod .DRAGONAPI ).and (m -> OptimizationsandTweaksConfig .enableMixinNBTBase ),
110+ "core.MixinNBTBase" ),
109111 common_core_MixinMapGenStructure (Side .COMMON ,
110112 avoid (TargetedMod .DRAGONAPI ).and (m -> OptimizationsandTweaksConfig .enableMixinMapGenStructure ),
111113 "core.MixinMapGenStructure" ),
Original file line number Diff line number Diff line change @@ -266,6 +266,10 @@ public class OptimizationsandTweaksConfig {
266266 @ Config .DefaultBoolean (true )
267267 @ Config .RequiresWorldRestart
268268 public static boolean enableMixinNBTTagCompound ;
269+ @ Config .Comment ("Optimize NBTBase to reduce equals() overhead" )
270+ @ Config .DefaultBoolean (true )
271+ @ Config .RequiresWorldRestart
272+ public static boolean enableMixinNBTBase ;
269273 @ Config .Comment ("Optimize EntityList" )
270274 @ Config .DefaultBoolean (true )
271275 @ Config .RequiresWorldRestart
Original file line number Diff line number Diff line change 1+ package fr .iamacat .optimizationsandtweaks .mixins .common .core ;
2+
3+ import org .spongepowered .asm .mixin .Mixin ;
4+ import org .spongepowered .asm .mixin .Overwrite ;
5+ import org .spongepowered .asm .mixin .Shadow ;
6+
7+ import net .minecraft .nbt .NBTBase ;
8+
9+ @ Mixin (NBTBase .class )
10+ public abstract class MixinNBTBase {
11+ @ Shadow
12+ public abstract byte getId ();
13+
14+ @ Overwrite
15+ public boolean equals (Object p_equals_1_ ) {
16+ if (this == p_equals_1_ ) {
17+ return true ;
18+ }
19+
20+ if (!(p_equals_1_ instanceof NBTBase )) {
21+ return false ;
22+ }
23+ NBTBase nbtbase = (NBTBase )p_equals_1_ ;
24+ return this .getId () == nbtbase .getId ();
25+ }
26+ }
You can’t perform that action at this time.
0 commit comments