Skip to content

Commit

Permalink
clear sin table (#78)
Browse files Browse the repository at this point in the history
  • Loading branch information
MicrocontrollersDev authored Nov 11, 2024
1 parent f794674 commit 911aa28
Showing 1 changed file with 15 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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 = "<clinit>", at = @At("RETURN"))
private static void clearSinTable(CallbackInfo ci) {
new CompactSineLUT(); // Force class initialisation
MathHelperMixin_CompactLUT.SIN_TABLE = null;
}

/**
* @author Wyvest
Expand Down

0 comments on commit 911aa28

Please sign in to comment.