Fixed loading issue with BetterMountHud

This commit is contained in:
FlorianMichael 2023-03-06 19:57:24 +01:00
parent dc23ac56eb
commit 80b93de586
2 changed files with 7 additions and 5 deletions

View File

@ -8,7 +8,7 @@ yarn_mappings=1.19.3+build.5
loader_version=0.14.14 loader_version=0.14.14
# viafabricplus # viafabricplus
mod_version=1.7.2 mod_version=1.7.3
maven_group=de.florianmichael maven_group=de.florianmichael
archives_base_name=viafabricplus archives_base_name=viafabricplus

View File

@ -10,6 +10,7 @@ import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow; import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.injection.*; import org.spongepowered.asm.mixin.injection.*;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
@Mixin(InGameHud.class) @Mixin(InGameHud.class)
public abstract class MixinInGameHud { public abstract class MixinInGameHud {
@ -39,10 +40,11 @@ public abstract class MixinInGameHud {
if (VisualSettings.getClassWrapper().removeNewerHudElements.getValue()) ci.cancel(); if (VisualSettings.getClassWrapper().removeNewerHudElements.getValue()) ci.cancel();
} }
@Redirect(method = "renderStatusBars", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/hud/InGameHud;getHeartCount(Lnet/minecraft/entity/LivingEntity;)I")) @Inject(method = "getHeartCount", at = @At("HEAD"), cancellable = true)
private int removeHungerBar(InGameHud instance, LivingEntity entity) { public void removeHungerBar(LivingEntity entity, CallbackInfoReturnable<Integer> cir) {
if (VisualSettings.getClassWrapper().removeNewerHudElements.getValue()) return 1; if (VisualSettings.getClassWrapper().removeNewerHudElements.getValue()) {
return getHeartCount(entity); cir.setReturnValue(1);
}
} }
// Moving down all remaining elements // Moving down all remaining elements