-
Notifications
You must be signed in to change notification settings - Fork 37
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement Simple Difficulty altitude modifier tweak
- Loading branch information
Showing
4 changed files
with
44 additions
and
1 deletion.
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
27 changes: 27 additions & 0 deletions
27
...ava/mod/acgaming/universaltweaks/mods/simpledifficulty/mixin/UTModifierAltitudeMixin.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,27 @@ | ||
package mod.acgaming.universaltweaks.mods.simpledifficulty.mixin; | ||
|
||
import net.minecraft.util.math.BlockPos; | ||
import net.minecraft.world.World; | ||
|
||
import com.charles445.simpledifficulty.config.ModConfig; | ||
import com.charles445.simpledifficulty.temperature.ModifierAltitude; | ||
import mod.acgaming.universaltweaks.config.UTConfigMods; | ||
import org.spongepowered.asm.mixin.Mixin; | ||
import org.spongepowered.asm.mixin.injection.At; | ||
import org.spongepowered.asm.mixin.injection.Inject; | ||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; | ||
|
||
@Mixin(value = ModifierAltitude.class, remap = false) | ||
public class UTModifierAltitudeMixin | ||
{ | ||
@Inject(method = "getWorldInfluence", at = @At(value = "RETURN"), cancellable = true) | ||
public void utModifierAltitude(World world, BlockPos pos, CallbackInfoReturnable<Float> cir) | ||
{ | ||
if (!world.provider.isSurfaceWorld()) cir.setReturnValue(0.0F); | ||
|
||
float seaLevel = UTConfigMods.SIMPLE_DIFFICULTY.utAltitudeSeaLevel; | ||
float multiplier = pos.getY() > seaLevel ? (float) UTConfigMods.SIMPLE_DIFFICULTY.utAltitudeMultiplierAboveSeaLevel : (float) UTConfigMods.SIMPLE_DIFFICULTY.utAltitudeMultiplierBelowSeaLevel; | ||
|
||
cir.setReturnValue(-1.0F * (Math.abs(((seaLevel - pos.getY()) / seaLevel * ModConfig.server.temperature.altitudeMultiplier * multiplier) + 1.0F))); | ||
} | ||
} |
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