fix health bar shaking like crazy when the player has regeneration (#96)

This commit is contained in:
Alexdoru authored and GitHub committed 2023-09-13 16:15:31 +02:00
1 parent 46dabb9f90
commit abc424b02d
1 file changed
+7 -2
@@ -29,6 +29,7 @@ import net.minecraftforge.common.MinecraftForge;
import cpw.mods.fml.common.FMLCommonHandler;
import cpw.mods.fml.common.Loader;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
import cpw.mods.fml.common.gameevent.TickEvent;
import mantle.lib.client.MantleClientRegistry;
import tconstruct.armor.gui.ArmorExtendedGui;
import tconstruct.armor.gui.KnapsackGui;
@@ -83,6 +84,7 @@ public class ArmorProxyClient extends ArmorProxyCommon {
registerManualIcons();
registerManualRecipes();
MinecraftForge.EVENT_BUS.register(this);
FMLCommonHandler.instance().bus().register(this);
}
private void registerManualIcons() {
@@ -249,6 +251,11 @@ public class ArmorProxyClient extends ArmorProxyCommon {
// event.newfov = 1.0f;
}
@SubscribeEvent
public void onTick(TickEvent.ClientTickEvent event) {
if (event.phase == TickEvent.Phase.START) this.updateCounter++;
}
/* HUD */
@SubscribeEvent
public void renderHealthbar(RenderGameOverlayEvent.Pre event) {
@@ -268,8 +275,6 @@ public class ArmorProxyClient extends ArmorProxyCommon {
return;
}
updateCounter++;
int scaledWidth = event.resolution.getScaledWidth();
int scaledHeight = event.resolution.getScaledHeight();
int xBasePos = scaledWidth / 2 - 91;