summaryrefslogtreecommitdiff
path: root/java/darkknight/jewelrycraft/events/ScreenHandler.java
diff options
context:
space:
mode:
authorOnyxDarkKnight <sor1n.iliutza16@gmail.com>2015-02-21 21:31:16 +0000
committerOnyxDarkKnight <sor1n.iliutza16@gmail.com>2015-02-21 21:31:16 +0000
commit420faddca46e70e3a70def168fb4e452ef193b0d (patch)
tree247e334012e4bf9e4fa6d42718bf601ce6bd42d9 /java/darkknight/jewelrycraft/events/ScreenHandler.java
parent3f4c717de5ebc9b942d65ae45ac87c43bdf8a31b (diff)
Added just a butt ton of stuff, also thanks to pau101 for helping me with the Hand Pedestal animation :)
Diffstat (limited to 'java/darkknight/jewelrycraft/events/ScreenHandler.java')
-rw-r--r--java/darkknight/jewelrycraft/events/ScreenHandler.java112
1 files changed, 66 insertions, 46 deletions
diff --git a/java/darkknight/jewelrycraft/events/ScreenHandler.java b/java/darkknight/jewelrycraft/events/ScreenHandler.java
index 237a452..4d8013d 100644
--- a/java/darkknight/jewelrycraft/events/ScreenHandler.java
+++ b/java/darkknight/jewelrycraft/events/ScreenHandler.java
@@ -1,76 +1,96 @@
package darkknight.jewelrycraft.events;
-import java.awt.Color;
-
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.Gui;
import net.minecraft.client.gui.GuiChat;
import net.minecraft.client.gui.ScaledResolution;
-import net.minecraft.client.settings.KeyBinding;
-import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.nbt.NBTTagCompound;
+import net.minecraft.util.MathHelper;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.client.event.RenderGameOverlayEvent;
import net.minecraftforge.client.event.RenderGameOverlayEvent.ElementType;
-
-import org.lwjgl.input.Keyboard;
import org.lwjgl.opengl.GL11;
-
-import cpw.mods.fml.client.FMLClientHandler;
-import cpw.mods.fml.client.registry.ClientRegistry;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
-import cpw.mods.fml.common.gameevent.InputEvent.KeyInputEvent;
-import darkknight.jewelrycraft.JewelrycraftMod;
-import darkknight.jewelrycraft.config.ConfigHandler;
-import darkknight.jewelrycraft.network.PacketRequestPlayerInfo;
-import darkknight.jewelrycraft.util.JewelrycraftUtil;
-import darkknight.jewelrycraft.util.PlayerUtils;
+import darkknight.jewelrycraft.curses.Curse;
public class ScreenHandler extends Gui
{
private Minecraft mc;
-
public static NBTTagCompound tagCache;
public static int cooldown;
+ static ResourceLocation texture;
+ static ResourceLocation hearts = new ResourceLocation("jewelrycraft", "textures/gui/hearts.png");
- public ScreenHandler(Minecraft mc)
+ public ScreenHandler(Minecraft mc, ResourceLocation tex)
{
super();
this.mc = mc;
+ texture = tex;
}
@SubscribeEvent
public void renderScreen(RenderGameOverlayEvent event)
{
- if (event.isCancelable() || event.type != ElementType.ALL || tagCache == null) return;
- mc.renderEngine.bindTexture(new ResourceLocation("jewelrycraft", "textures/gui/curses.png"));
- int count = 0;
- for (String l : JewelrycraftUtil.curseValues.keySet())
- if (tagCache.getByte(l) > -1){
- int tag = JewelrycraftUtil.curseValues.get(l);
- int size = 16;
- this.drawRect(0, (size + 6) * count, 24 + mc.fontRenderer.getStringWidth(l.split(":")[1]), 4 + (size + 6) * count + 16, 0xaf000000);
- this.drawRect(2, 2 + (size + 6) * count, 22 + mc.fontRenderer.getStringWidth(l.split(":")[1]), 2 + (size + 6) * count + 16, 0x95700064);
- count++;
- }
- count = 0;
- for (String l : JewelrycraftUtil.curseValues.keySet())
- if (tagCache.getByte(l) > -1){
- int tag = JewelrycraftUtil.curseValues.get(l);
- int size = 16;
- GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
- GL11.glDisable(GL11.GL_LIGHTING);
- this.drawTexturedModalRect(2, 2 + (size + 6) * count, tag % size * size, tag / size * size, size, size);
- count++;
+ 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(texture);
+ for(Curse curse: Curse.getCurseList()){
+ if (tagCache.hasKey(curse.getName()) && tagCache.getInteger(curse.getName()) > 0){
+ Gui.drawRect(0, (size / 2 + 6) * count, 24 + mc.fontRenderer.getStringWidth(curse.getName().split(":")[1]), 4 + (size / 2 + 6) * count + 16, 0xaf000000);
+ Gui.drawRect(2, 2 + (size / 2 + 6) * count, 22 + mc.fontRenderer.getStringWidth(curse.getName().split(":")[1]), 2 + (size / 2 + 6) * count + 16, 0x95700064);
+ count++;
+ }
+ }
+ count = 0;
+ for(Curse curse: Curse.getCurseList())
+ if (tagCache.hasKey(curse.getName()) && tagCache.getInteger(curse.getName()) > 0){
+ int tag = curse.getID();
+ GL11.glPushMatrix();
+ GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
+ GL11.glDisable(GL11.GL_LIGHTING);
+ GL11.glScalef(0.5f, 0.5f, 0.0f);
+ drawTexturedModalRect(4, 4 + (size + 12) * count, tag % size * size, tag / size * size, size, size);
+ GL11.glPopMatrix();
+ count++;
+ }
+ count = 0;
+ size = 16;
+ for(Curse curse: Curse.getCurseList())
+ if (tagCache.hasKey(curse.getName()) && tagCache.getInteger(curse.getName()) > 0){
+ int tag = curse.getID();
+ mc.fontRenderer.drawStringWithShadow(curse.getName().split(":")[1], 20, 7 + (size + 6) * count, 16777215);
+ if (tagCache.getInteger(curse.getName()) == 2){
+ mc.renderEngine.bindTexture(hearts);
+ 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(15 + mc.fontRenderer.getStringWidth(curse.getName().split(":")[1]), 8 + (size + 6) * count, 3 * size, 0, size, size);
+ GL11.glPopMatrix();
+ }
+ count++;
+ }
+ }
+ mc.renderEngine.bindTexture(hearts);
+ count = 0;
+ if (tagCache.getFloat("BlueHeart") > 0){
+ for(int i = 0; i < (int)tagCache.getFloat("BlueHeart") / 2; i++)
+ drawTexturedModalRect(2 + 13 * i, resolution.getScaledHeight() / 2 - 25 + 16 * count, 0 * size, 0 * size, size, size);
+ if (tagCache.getFloat("BlueHeart") % 2 != 0) drawTexturedModalRect(2 + 13 * ((int)tagCache.getFloat("BlueHeart") / 2), resolution.getScaledHeight() / 2 - 25 + 16 * count, 0 * size, 1 * size, size, size);
+ }
+ count++;
+ if (tagCache.getFloat("BlackHeart") > 0){
+ for(int i = 0; i < MathHelper.ceiling_float_int((tagCache.getFloat("BlackHeart")) / 2.0F); i++)
+ drawTexturedModalRect(2 + 13 * i, resolution.getScaledHeight() / 2 - 25 + 16 * count, 1 * size, 0 * size, size, size);
+ if (tagCache.getFloat("BlackHeart") % 2 != 0) drawTexturedModalRect(2 + 13 * ((int)tagCache.getFloat("BlackHeart") / 2), resolution.getScaledHeight() / 2 - 25 + 16 * count, 1 * size, 1 * size, size, size);
}
- count = 0;
- for (String l : JewelrycraftUtil.curseValues.keySet())
- if (tagCache.getByte(l) > -1){
- int tag = JewelrycraftUtil.curseValues.get(l);
- int size = 16;
- mc.fontRenderer.drawStringWithShadow(l.split(":")[1], 20, 7 + (size + 6) * count, 16777215);
- if(tagCache.getByte(l) == 1) mc.fontRenderer.drawStringWithShadow("Leech", mc.fontRenderer.getStringWidth(l.split(":")[1]) + 25, 7 + (size + 6) * count, 16777215);
- count++;
- }
+ count++;
+ if (tagCache.getFloat("WhiteHeart") > 0)
+ drawTexturedModalRect(2, resolution.getScaledHeight() / 2 - 25 + 16 * count, 2 * size, 1 * size, size, size);
+ }
}
} \ No newline at end of file