Move tiara/dodge renders, use forge's gui offsetting for flight bar

Fixes #3118
This commit is contained in:
Hubry committed 2020-01-19 17:33:04 +01:00
1 parent 8fa3d9c790
commit 81391688ae
3 files changed
+9 -28

No files matched your search

@@ -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) {
@@ -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);
@@ -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);