-
Notifications
You must be signed in to change notification settings - Fork 64
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix the local temperature can go below absolute zero (#384)
* add mixin * address requested changes --------- Co-authored-by: Martin Robertz <dream-master@gmx.net>
- Loading branch information
1 parent
973b07c
commit 6a9a25c
Showing
3 changed files
with
29 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 21 additions & 0 deletions
21
src/main/java/com/mitchej123/hodgepodge/mixins/early/minecraft/MixinBiomeGenBase.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
package com.mitchej123.hodgepodge.mixins.early.minecraft; | ||
|
||
import net.minecraft.world.biome.BiomeGenBase; | ||
|
||
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; | ||
|
||
@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)); | ||
} | ||
} |