mirror of
https://github.com/tjsga/minecraft.git
synced 2025-04-09 22:10:18 -04:00
45 lines
1.3 KiB
Java
45 lines
1.3 KiB
Java
package net.flytre.hoco_sg.mixin;
|
|
|
|
import net.minecraft.entity.player.HungerManager;
|
|
import net.minecraft.entity.player.PlayerEntity;
|
|
import org.spongepowered.asm.mixin.Mixin;
|
|
import org.spongepowered.asm.mixin.injection.At;
|
|
import org.spongepowered.asm.mixin.injection.Constant;
|
|
import org.spongepowered.asm.mixin.injection.ModifyConstant;
|
|
import org.spongepowered.asm.mixin.injection.Redirect;
|
|
|
|
|
|
/**
|
|
* Reverts healing to 1.11 style
|
|
*/
|
|
@Mixin(HungerManager.class)
|
|
public abstract class HungerManagerMixin {
|
|
|
|
|
|
/**
|
|
* Removes rapid health regen at full hunger by making the conditions required for it always false
|
|
*/
|
|
@Redirect(method = "update", at = @At(value = "INVOKE", target = "Lnet/minecraft/entity/player/PlayerEntity;canFoodHeal()Z", ordinal = 0))
|
|
public boolean hoco_sg$oldRegen(PlayerEntity player) {
|
|
return false;
|
|
}
|
|
|
|
|
|
/**
|
|
* Makes it take 5 seconds between regenerating one health instead of 4
|
|
*/
|
|
@ModifyConstant(method = "update", constant = @Constant(intValue = 80))
|
|
public int hoco_sg$slowRegen(int eighty) {
|
|
return 100;
|
|
}
|
|
|
|
/**
|
|
* Makes it take 2/3 of the exhaustion to heal a health to combat food scarcity.
|
|
*/
|
|
@ModifyConstant(method = "update", constant = @Constant(floatValue = 6.0f))
|
|
public float hoco_sg$lessExhaustion(float six) {
|
|
return 4f;
|
|
}
|
|
}
|
|
|