From 81391688ae331a228a4049cd9d49c3be97074d71 Mon Sep 17 00:00:00 2001 From: Hubry Date: Sun, 19 Jan 2020 17:33:04 +0100 Subject: [PATCH] Move tiara/dodge renders, use forge's gui offsetting for flight bar Fixes #3118 --- .../client/core/handler/HUDHandler.java | 23 +++++-------------- .../common/core/handler/ConfigHandler.java | 8 ------- .../equipment/bauble/ItemFlightTiara.java | 6 ++--- 3 files changed, 9 insertions(+), 28 deletions(-) diff --git a/src/main/java/vazkii/botania/client/core/handler/HUDHandler.java b/src/main/java/vazkii/botania/client/core/handler/HUDHandler.java index c98e1b8c7..e57d033ae 100644 --- a/src/main/java/vazkii/botania/client/core/handler/HUDHandler.java +++ b/src/main/java/vazkii/botania/client/core/handler/HUDHandler.java @@ -79,14 +79,16 @@ public final class HUDHandler { public static final ResourceLocation manaBar = new ResourceLocation(LibResources.GUI_MANA_HUD); - @SubscribeEvent(priority = EventPriority.HIGHEST) - public static void onDrawScreenPre(RenderGameOverlayEvent.Pre event) { + @SubscribeEvent + public static void onDrawScreenPost(RenderGameOverlayEvent.Post event) { Minecraft mc = Minecraft.getInstance(); IProfiler profiler = mc.getProfiler(); + ItemStack main = mc.player.getHeldItemMainhand(); + ItemStack offhand = mc.player.getHeldItemOffhand(); - if(event.getType() == ElementType.HEALTH) { + if(event.getType() == ElementType.ALL) { profiler.startSection("botania-hud"); - + ItemStack tiara = EquipmentHandler.findOrEmpty(ModItems.flightTiara, mc.player); if(!tiara.isEmpty()) { profiler.startSection("flugelTiara"); @@ -101,19 +103,6 @@ public final class HUDHandler { profiler.endSection(); } - profiler.endSection(); - } - } - - @SubscribeEvent - public static void onDrawScreenPost(RenderGameOverlayEvent.Post event) { - Minecraft mc = Minecraft.getInstance(); - IProfiler profiler = mc.getProfiler(); - ItemStack main = mc.player.getHeldItemMainhand(); - ItemStack offhand = mc.player.getHeldItemOffhand(); - - if(event.getType() == ElementType.ALL) { - profiler.startSection("botania-hud"); RayTraceResult pos = mc.objectMouseOver; if(pos != null) { diff --git a/src/main/java/vazkii/botania/common/core/handler/ConfigHandler.java b/src/main/java/vazkii/botania/common/core/handler/ConfigHandler.java index 9497965f3..8102d96d4 100644 --- a/src/main/java/vazkii/botania/common/core/handler/ConfigHandler.java +++ b/src/main/java/vazkii/botania/common/core/handler/ConfigHandler.java @@ -32,8 +32,6 @@ public final class ConfigHandler { public final ForgeConfigSpec.BooleanValue enableFancySkyboxInNormalWorlds; public final ForgeConfigSpec.IntValue manaBarHeight; - public final ForgeConfigSpec.IntValue flightBarHeight; - public final ForgeConfigSpec.IntValue flightBarBreathHeight; public final ForgeConfigSpec.IntValue glSecondaryTextureUnit; public final ForgeConfigSpec.BooleanValue staticFloaters; @@ -88,12 +86,6 @@ public final class ConfigHandler { manaBarHeight = builder .comment("The height of the mana display bar in above the XP bar. You can change this if you have a mod that changes where the XP bar is.") .defineInRange("hud.mana_bar.height", 29, 0, Integer.MAX_VALUE); - flightBarHeight = builder - .comment("The height of the Flugel Tiara flight bar. You can change this if you have a mod that adds a bar in that spot.") - .defineInRange("hud.flight_bar.height", 49, 0, Integer.MAX_VALUE); - flightBarBreathHeight = builder - .comment("The height of the Flugel Tiara flight bar if your breath bar is shown. You can change this if you have a mod that adds a bar in that spot.") - .defineInRange("hud.flight_bar_breath.height", 59, 0, Integer.MAX_VALUE); glSecondaryTextureUnit = builder .comment("The GL Texture Unit to use for the secondary sampler passed in to the Lexica Botania's category button shader. DO NOT TOUCH THIS IF YOU DON'T KNOW WHAT YOU'RE DOING") .defineInRange("shaders.secondary_unit", 7, 0, Integer.MAX_VALUE); diff --git a/src/main/java/vazkii/botania/common/item/equipment/bauble/ItemFlightTiara.java b/src/main/java/vazkii/botania/common/item/equipment/bauble/ItemFlightTiara.java index 0d7f16774..8d21708de 100644 --- a/src/main/java/vazkii/botania/common/item/equipment/bauble/ItemFlightTiara.java +++ b/src/main/java/vazkii/botania/common/item/equipment/bauble/ItemFlightTiara.java @@ -33,6 +33,7 @@ import net.minecraft.util.text.TranslationTextComponent; import net.minecraft.world.World; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; +import net.minecraftforge.client.ForgeIngameGui; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.event.entity.living.LivingEvent.LivingUpdateEvent; import net.minecraftforge.event.entity.player.PlayerEvent; @@ -474,9 +475,8 @@ public class ItemFlightTiara extends ItemBauble implements IManaUsingItem { mc.textureManager.bindTexture(textureHud); int xo = mc.mainWindow.getScaledWidth() / 2 + 10; int x = xo; - int y = mc.mainWindow.getScaledHeight() - ConfigHandler.CLIENT.flightBarHeight.get(); - if(player.areEyesInFluid(FluidTags.WATER)) - y = mc.mainWindow.getScaledHeight() - ConfigHandler.CLIENT.flightBarBreathHeight.get(); + int y = mc.mainWindow.getScaledHeight() - ForgeIngameGui.right_height; + ForgeIngameGui.right_height += 10; int left = ItemNBTHelper.getInt(stack, TAG_TIME_LEFT, MAX_FLY_TIME);