From 46186569d5cb462f90e59a37dc17a9fad51cfa4a Mon Sep 17 00:00:00 2001 From: OnyxDarkKnight Date: Wed, 1 Jul 2015 16:11:31 +0100 Subject: Added a curse tab, added a config to enable/disable extra jewelry info, plus more! --- .../jewelrycraft/events/ScreenHandler.java | 116 +++++++-------------- 1 file changed, 36 insertions(+), 80 deletions(-) (limited to 'src/main/java/darkknight/jewelrycraft/events/ScreenHandler.java') diff --git a/src/main/java/darkknight/jewelrycraft/events/ScreenHandler.java b/src/main/java/darkknight/jewelrycraft/events/ScreenHandler.java index b8df767..c86597e 100644 --- a/src/main/java/darkknight/jewelrycraft/events/ScreenHandler.java +++ b/src/main/java/darkknight/jewelrycraft/events/ScreenHandler.java @@ -15,84 +15,40 @@ import darkknight.jewelrycraft.api.Curse; import darkknight.jewelrycraft.config.ConfigHandler; import darkknight.jewelrycraft.util.Variables; -public class ScreenHandler extends Gui -{ - private Minecraft mc; - public static NBTTagCompound tagCache = null; - public static int cooldown; - - public ScreenHandler(Minecraft mc) - { - super(); - this.mc = mc; - } - - @SubscribeEvent - public void renderScreen(RenderGameOverlayEvent event) - { - if (event.isCancelable() || event.type != ElementType.ALL || tagCache == null) return; - if (!mc.gameSettings.showDebugInfo && !(mc.currentScreen instanceof GuiChat)){ - int count = 0; - int size = 32; - ScaledResolution resolution = new ScaledResolution(mc, mc.displayWidth, mc.displayHeight); - if (tagCache.hasKey("cursePoints") && tagCache.getInteger("cursePoints") > 0){ - mc.renderEngine.bindTexture(Variables.MISC_TEXTURE); - if (ConfigHandler.CURSES_ENABLED) for(Curse curse: Curse.getCurseList()){ - if (curse.canCurseBeActivated(mc.theWorld) && tagCache.hasKey(curse.getName()) && tagCache.getInteger(curse.getName()) > 0){ - drawTexturedModalRect(-16, -16 + (size - 6) * count, 0, 32, 144, 60); - count++; - } - } - count = 0; - if (ConfigHandler.CURSES_ENABLED) for(Curse curse: Curse.getCurseList()) - if (curse.canCurseBeActivated(mc.theWorld) && tagCache.hasKey(curse.getName()) && tagCache.getInteger(curse.getName()) > 0){ - mc.renderEngine.bindTexture(new ResourceLocation(Variables.MODID, "textures/gui/" + curse.getTexturePack() + ".png")); - int tag = curse.getTextureID(); - GL11.glPushMatrix(); - GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); - GL11.glDisable(GL11.GL_LIGHTING); - GL11.glScalef(0.45f, 0.45f, 0.0f); - drawTexturedModalRect(28, 18 + (size + 26) * count, tag % 8 * size, tag / 8 * size, size, size); - GL11.glPopMatrix(); - count++; - } - count = 0; - size = 16; - if (ConfigHandler.CURSES_ENABLED) for(Curse curse: Curse.getCurseList()) - if (curse.canCurseBeActivated(mc.theWorld) && tagCache.hasKey(curse.getName()) && tagCache.getInteger(curse.getName()) > 0){ - mc.fontRenderer.drawStringWithShadow(curse.getName().split(":")[1], 30, 11 + (size + 10) * count, 16777215); - if (tagCache.getInteger(curse.getName()) == 2){ - mc.renderEngine.bindTexture(Variables.MISC_TEXTURE); - GL11.glPushMatrix(); - GL11.glEnable(GL11.GL_BLEND); - GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); - GL11.glColor4f(1f, 1f, 1f, 0.5f); - drawTexturedModalRect(95, 7 + (size + 10) * count, 3 * size, 0, size, size); - GL11.glPopMatrix(); - } - count++; - } - } - GL11.glPushMatrix(); - GL11.glColor4f(1f, 1f, 1f, 1.0f); - mc.renderEngine.bindTexture(Variables.MISC_TEXTURE); - count = 0; - size = 16; - if (tagCache.getFloat("BlueHeart") > 0){ - drawTexturedModalRect(resolution.getScaledWidth()/2 + 90 + 35*count, resolution.getScaledHeight() - 20, 0 * size, 0 * size, size, size); - mc.fontRenderer.drawStringWithShadow("x" + (MathHelper.ceiling_float_int(tagCache.getFloat("BlueHeart")) / 2.0F), resolution.getScaledWidth()/2 + 105 + 35*count, resolution.getScaledHeight() - 16, 16777215); - } - count++; - mc.renderEngine.bindTexture(Variables.MISC_TEXTURE); - if (tagCache.getFloat("BlackHeart") > 0){ - drawTexturedModalRect(resolution.getScaledWidth()/2 + 90 + (mc.fontRenderer.getStringWidth(String.valueOf((MathHelper.ceiling_float_int(tagCache.getFloat("BlueHeart")) / 2.0F))) - 14) + 35*count, resolution.getScaledHeight() - 20, 1 * size, 0 * size, size, size); - mc.fontRenderer.drawStringWithShadow("x" + (MathHelper.ceiling_float_int(tagCache.getFloat("BlackHeart")) / 2.0F), resolution.getScaledWidth()/2 + 105 + (mc.fontRenderer.getStringWidth(String.valueOf((MathHelper.ceiling_float_int(tagCache.getFloat("BlueHeart")) / 2.0F))) - 14) + 35*count, resolution.getScaledHeight() - 16, 16777215); - } - count++; - mc.renderEngine.bindTexture(Variables.MISC_TEXTURE); - if (tagCache.getFloat("WhiteHeart") > 0) - drawTexturedModalRect(resolution.getScaledWidth()/2 + 90 + (mc.fontRenderer.getStringWidth(String.valueOf((MathHelper.ceiling_float_int(tagCache.getFloat("BlueHeart")) / 2.0F))) - 14) + (mc.fontRenderer.getStringWidth(String.valueOf((MathHelper.ceiling_float_int(tagCache.getFloat("BlackHeart")) / 2.0F))) - 14) + 35*count, resolution.getScaledHeight() - 20, 2 * size, 1 * size, size, size); - GL11.glPopMatrix(); - } - } +public class ScreenHandler extends Gui { + private Minecraft mc; + public static NBTTagCompound tagCache = null; + public static int cooldown; + + public ScreenHandler(Minecraft mc) { + super(); + this.mc = mc; + } + + @SubscribeEvent + public void renderScreen(RenderGameOverlayEvent event) { + if (event.isCancelable() || event.type != ElementType.ALL || tagCache == null) return; + int count = 0; + int size = 32; + ScaledResolution resolution = new ScaledResolution(mc, mc.displayWidth, mc.displayHeight); + GL11.glPushMatrix(); + GL11.glColor4f(1f, 1f, 1f, 1.0f); + mc.renderEngine.bindTexture(Variables.MISC_TEXTURE); + count = 0; + size = 16; + if (tagCache.getFloat("BlueHeart") > 0) { + drawTexturedModalRect(resolution.getScaledWidth() / 2 + 90 + 35 * count, resolution.getScaledHeight() - 20, 0 * size, 0 * size, size, size); + mc.fontRenderer.drawStringWithShadow("x" + (MathHelper.ceiling_float_int(tagCache.getFloat("BlueHeart")) / 2.0F), resolution.getScaledWidth() / 2 + 105 + 35 * count, resolution.getScaledHeight() - 16, 16777215); + } + count++; + mc.renderEngine.bindTexture(Variables.MISC_TEXTURE); + if (tagCache.getFloat("BlackHeart") > 0) { + drawTexturedModalRect(resolution.getScaledWidth() / 2 + 90 + (mc.fontRenderer.getStringWidth(String.valueOf((MathHelper.ceiling_float_int(tagCache.getFloat("BlueHeart")) / 2.0F))) - 14) + 35 * count, resolution.getScaledHeight() - 20, 1 * size, 0 * size, size, size); + mc.fontRenderer.drawStringWithShadow("x" + (MathHelper.ceiling_float_int(tagCache.getFloat("BlackHeart")) / 2.0F), resolution.getScaledWidth() / 2 + 105 + (mc.fontRenderer.getStringWidth(String.valueOf((MathHelper.ceiling_float_int(tagCache.getFloat("BlueHeart")) / 2.0F))) - 14) + 35 * count, resolution.getScaledHeight() - 16, 16777215); + } + count++; + mc.renderEngine.bindTexture(Variables.MISC_TEXTURE); + if (tagCache.getFloat("WhiteHeart") > 0) drawTexturedModalRect(resolution.getScaledWidth() / 2 + 90 + (mc.fontRenderer.getStringWidth(String.valueOf((MathHelper.ceiling_float_int(tagCache.getFloat("BlueHeart")) / 2.0F))) - 14) + (mc.fontRenderer.getStringWidth(String.valueOf((MathHelper.ceiling_float_int(tagCache.getFloat("BlackHeart")) / 2.0F))) - 14) + 35 * count, resolution.getScaledHeight() - 20, 2 * size, 1 * size, size, size); + GL11.glPopMatrix(); + } } \ No newline at end of file -- cgit v1.2.3