From aac94a50d17fa3a7c9686e533ee58217e5161385 Mon Sep 17 00:00:00 2001 From: MicrocontrollersDev Date: Sun, 10 Nov 2024 23:33:57 -0600 Subject: [PATCH] clear sin table --- .../performance/MathHelperMixin_CompactLUT.java | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/src/main/java/club/sk1er/patcher/mixins/performance/MathHelperMixin_CompactLUT.java b/src/main/java/club/sk1er/patcher/mixins/performance/MathHelperMixin_CompactLUT.java index c7ca61bf..bd5949d1 100644 --- a/src/main/java/club/sk1er/patcher/mixins/performance/MathHelperMixin_CompactLUT.java +++ b/src/main/java/club/sk1er/patcher/mixins/performance/MathHelperMixin_CompactLUT.java @@ -2,11 +2,24 @@ import me.jellysquid.mods.lithium.common.util.math.CompactSineLUT; import net.minecraft.util.MathHelper; -import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.Overwrite; +import org.spongepowered.asm.mixin.*; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Inject; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; @Mixin(MathHelper.class) public class MathHelperMixin_CompactLUT { + @Mutable + @Shadow + @Final + private static float[] SIN_TABLE; + + @SuppressWarnings("InstantiationOfUtilityClass") + @Inject(method = "", at = @At("RETURN")) + private static void clearSinTable(CallbackInfo ci) { + new CompactSineLUT(); // Force class initialisation + MathHelperMixin_CompactLUT.SIN_TABLE = null; + } /** * @author Wyvest