mirror of
https://github.com/GTNewHorizons/Draconic-Evolution.git
synced 2026-11-19 19:59:34 +00:00
smack renders
This commit is contained in:
3 files changed
+33
-3
No files matched your search
@@ -5,6 +5,7 @@ import java.util.List;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.FontRenderer;
|
||||
import net.minecraft.client.gui.ScaledResolution;
|
||||
import net.minecraft.client.renderer.RenderHelper;
|
||||
import net.minecraft.client.renderer.entity.RenderItem;
|
||||
import net.minecraft.item.ItemStack;
|
||||
@@ -84,6 +85,24 @@ public final class DashboardHud {
|
||||
HudRegistry.register(MAGNET_ICON);
|
||||
}
|
||||
|
||||
// False means the player hid the element, so skip drawing it and do not call endRender()
|
||||
|
||||
static boolean beginInfoBox(ScaledResolution resolution) {
|
||||
return HudRegistry.beginRender(INFO_BOX, resolution);
|
||||
}
|
||||
|
||||
static boolean beginArmorHud(ScaledResolution resolution) {
|
||||
return HudRegistry.beginRender(ARMOR_HUD, resolution);
|
||||
}
|
||||
|
||||
static boolean beginMagnetIcon(ScaledResolution resolution) {
|
||||
return HudRegistry.beginRender(MAGNET_ICON, resolution);
|
||||
}
|
||||
|
||||
static void endRender() {
|
||||
HudRegistry.endRender();
|
||||
}
|
||||
|
||||
/** Thousandths of the screen, like Draconic's position settings. */
|
||||
private static int getPosition(int index, int screenSize) {
|
||||
return (int) (ConfigHandler.hudSettings[index] / 1000f * screenSize);
|
||||
|
||||
@@ -16,6 +16,7 @@ import net.minecraftforge.client.event.RenderGameOverlayEvent;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import com.brandon3055.draconicevolution.client.ClientProxy;
|
||||
import com.brandon3055.draconicevolution.client.gui.GuiHudConfig;
|
||||
import com.brandon3055.draconicevolution.client.utils.GuiHelper;
|
||||
import com.brandon3055.draconicevolution.common.handler.ConfigHandler;
|
||||
@@ -56,7 +57,9 @@ public final class HudHandler {
|
||||
final int height = resolution.getScaledHeight();
|
||||
FontRenderer fontRenderer = mc.fontRenderer;
|
||||
|
||||
if (ConfigHandler.hudSettings[10] == 1 && hudList != null && toolTipFadeOut > 0) {
|
||||
if (ConfigHandler.hudSettings[10] == 1 && hudList != null
|
||||
&& toolTipFadeOut > 0
|
||||
&& (!ClientProxy.dashboardLoaded || DashboardHud.beginInfoBox(resolution))) {
|
||||
int x = (int) (((float) ConfigHandler.hudSettings[0] / 1000F) * (float) width);
|
||||
int y = (int) (((float) ConfigHandler.hudSettings[1] / 1000F) * (float) height);
|
||||
|
||||
@@ -72,13 +75,16 @@ public final class HudHandler {
|
||||
height);
|
||||
GL11.glDisable(GL11.GL_LIGHTING);
|
||||
GL11.glPopMatrix();
|
||||
if (ClientProxy.dashboardLoaded) DashboardHud.endRender();
|
||||
}
|
||||
|
||||
if (ConfigHandler.hudSettings[11] == 1 && showShieldHud) {
|
||||
if (ConfigHandler.hudSettings[11] == 1 && showShieldHud
|
||||
&& (!ClientProxy.dashboardLoaded || DashboardHud.beginArmorHud(resolution))) {
|
||||
int x = (int) (((float) ConfigHandler.hudSettings[2] / 1000F) * (float) width);
|
||||
int y = (int) (((float) ConfigHandler.hudSettings[3] / 1000F) * (float) height);
|
||||
|
||||
drawArmorHUD(x, y, ConfigHandler.hudSettings[8] == 1, ConfigHandler.hudSettings[5] / 100D);
|
||||
if (ClientProxy.dashboardLoaded) DashboardHud.endRender();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+6
-1
@@ -11,6 +11,8 @@ import net.minecraftforge.client.event.RenderGameOverlayEvent;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
import org.lwjgl.opengl.GL12;
|
||||
|
||||
import com.brandon3055.draconicevolution.client.ClientProxy;
|
||||
|
||||
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
|
||||
import cpw.mods.fml.common.gameevent.TickEvent;
|
||||
|
||||
@@ -45,7 +47,9 @@ public final class ItemDisplayManager {
|
||||
@SubscribeEvent
|
||||
public void renderGameOverlayEvent(RenderGameOverlayEvent.Post event) {
|
||||
if (event.type == RenderGameOverlayEvent.ElementType.ALL) {
|
||||
if (ticksCounter > 0 && itemStack != null && itemStack.getItem() != null) {
|
||||
if (ticksCounter > 0 && itemStack != null
|
||||
&& itemStack.getItem() != null
|
||||
&& (!ClientProxy.dashboardLoaded || DashboardHud.beginMagnetIcon(event.resolution))) {
|
||||
GL11.glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
|
||||
GL11.glEnable(GL12.GL_RESCALE_NORMAL);
|
||||
RenderHelper.enableGUIStandardItemLighting();
|
||||
@@ -59,6 +63,7 @@ public final class ItemDisplayManager {
|
||||
RenderHelper.disableStandardItemLighting();
|
||||
GL11.glDisable(GL12.GL_RESCALE_NORMAL);
|
||||
GL11.glDisable(GL11.GL_BLEND);
|
||||
if (ClientProxy.dashboardLoaded) DashboardHud.endRender();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user