Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make Hypothermia/Hyperthermia Damage Tweakable/Configurable #883

Open
Kongga666 opened this issue Oct 16, 2024 · 1 comment
Open

Make Hypothermia/Hyperthermia Damage Tweakable/Configurable #883

Kongga666 opened this issue Oct 16, 2024 · 1 comment
Labels

Comments

@Kongga666
Copy link

Overview

Allow through config, the possibility to increase/decrease Hypothermia/Hypertermia damages, or even increase food exhaustion or thirst.

Code Exemple

In TemperatureHandler.java

 // Hurt the player if hyperthermic
        if (TemperatureHelper.isFullyHyperthermic(player)) {
            if (player.tickCount % 80 == 0) {
                ThirstHelper.getThirst(player).addExhaustion(3.0F);
            }
            if (player.tickCount % 320 == 0) {
                player.hurt(player.damageSources().source(TANDamageTypes.HYPERTHERMIA), 1);
            }
        }

In MixinLivingEntity.java

@Redirect(method = "aiStep", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/entity/LivingEntity;isFullyFrozen()Z", ordinal = 0))
public boolean onAiStep_isFullyFrozen(LivingEntity instance) {
    if (!(instance instanceof Player)) {
        return instance.isFullyFrozen();
    }
    Player player = (Player) instance;

    if (!player.level().isClientSide && player.tickCount % 40 == 0 && player.isFullyFrozen() && player.canFreeze()) {
        if (player.tickCount % 80 == 0) {
            player.getFoodData().addExhaustion(3.0F);
        }
        if (player.tickCount % 320 == 0) {
            player.hurt(player.damageSources().freeze(), 1.0F);
        }
    }
    return false;
}

In those exemples, Hypothermia/Hyperthermia deal much more less damage, but increase fatigue (food/thirst) much more quicker.

Why would this feature be useful?

This Configurable feature will allow players to softer the mod (yeah i know the mod name is TOUGH as Nails), and make temperature managment less prominent, much in line with food and thirst managment.

The players would be able to tweak their experience to their need.
We can even imagine things like:

  • No damage
  • More damage
  • Cold consume slowly food
  • Warm consume slowly thirst
  • Hypothermia, drains food + small damages
  • Hyperthermia, drains thirst + small damages
  • etc...

I proposed this idea, because i tweaked the code for a private server with my friend, and wanted to play with this mod, but my friend wanted to nerf the Hypotermia/Hypertermia mechanics.
If my friends, wanted the mechanics nerfed, i guessed other players might want it.

@NotADeveloper4665
Copy link

please add this

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants