Skip to content

Commit

Permalink
fix getFloatTemperature causing lag (#461)
Browse files Browse the repository at this point in the history
(cherry picked from commit bdbb754)
  • Loading branch information
Lyfts authored and Dream-Master committed Dec 28, 2024
1 parent cffa73c commit cd5b4bc
Showing 1 changed file with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,17 @@
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Unique;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;

import com.llamalad7.mixinextras.injector.ModifyReturnValue;

@Mixin(BiomeGenBase.class)
public abstract class MixinBiomeGenBase {

@Unique
private static final float ABSOLUTE_ZERO = -459.67f / 100f; // in Fahrenheit scale

@Inject(method = "getFloatTemperature", at = @At("RETURN"), cancellable = true)
public final void hodgepodge$getFloatTemperature(int x, int y, int z, CallbackInfoReturnable<Float> cir) {
cir.setReturnValue(Math.max(cir.getReturnValue(), ABSOLUTE_ZERO));
@ModifyReturnValue(method = "getFloatTemperature", at = @At("RETURN"))
public final float hodgepodge$getFloatTemperature(float original) {
return Math.max(original, ABSOLUTE_ZERO);
}
}

0 comments on commit cd5b4bc

Please sign in to comment.