From 911aa28df15aaeb2e925560275ec1581cec30098 Mon Sep 17 00:00:00 2001 From: MicrocontrollersDev <66657148+MicrocontrollersDev@users.noreply.github.com> Date: Mon, 11 Nov 2024 06:16:12 -0600 Subject: [PATCH] clear sin table (#78) --- .../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