Skip to content

Commit

Permalink
use lithium's initialization method
Browse files Browse the repository at this point in the history
  • Loading branch information
MicrocontrollersDev authored Nov 16, 2024
1 parent 3dd2fba commit bc4cca2
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,9 @@ public class MathHelperMixin_CompactLUT {
@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
CompactSineLUT.init(); // Force class initialisation
MathHelperMixin_CompactLUT.SIN_TABLE = null;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,10 @@ public class CompactSineLUT {
}
}

public static void init() {
// This is just to force class initialization
}

// [VanillaCopy] MathHelper#sin(float)
public static float sin(float f) {
return lookup((int) (f * 10430.378f) & 0xFFFF);
Expand Down

0 comments on commit bc4cca2

Please sign in to comment.