Added a new, better HUD config screen

This commit is contained in:
brandon3055 committed 2016-02-11 23:18:15 +11:00
1 parent 8ce912a690
commit fdff8aeac7
18 files changed
+385 -205

No files matched your search

+1 -1
View File
@@ -1,5 +1,5 @@
minecraft_version=1.7.10
mod_version=1.0.2-Snapshot_9
mod_version=1.0.2-Snapshot_10-privateBuild1
forge_version=10.13.4.1492-1.7.10
CCLIB_version=1.1.3.140
NEI_version=1.0.3.74
@@ -1,10 +1,9 @@
package com.brandon3055.draconicevolution.client.gui;
import com.brandon3055.draconicevolution.DraconicEvolution;
import com.brandon3055.draconicevolution.client.gui.manual.GuiButtonAHeight;
import com.brandon3055.draconicevolution.common.container.ContainerDissEnchanter;
import com.brandon3055.draconicevolution.common.network.ButtonPacket;
import com.brandon3055.draconicevolution.common.lib.References;
import com.brandon3055.draconicevolution.common.network.ButtonPacket;
import com.brandon3055.draconicevolution.common.tileentities.TileDissEnchanter;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
@@ -3,14 +3,13 @@ package com.brandon3055.draconicevolution.client.gui;
import codechicken.nei.VisiblityData;
import codechicken.nei.api.INEIGuiHandler;
import codechicken.nei.api.TaggedInventoryArea;
import com.brandon3055.brandonscore.client.utills.GuiHelper;
import com.brandon3055.draconicevolution.DraconicEvolution;
import com.brandon3055.draconicevolution.client.gui.manual.GuiButtonAHeight;
import com.brandon3055.draconicevolution.client.handler.ResourceHandler;
import com.brandon3055.draconicevolution.common.container.ContainerDraconiumChest;
import com.brandon3055.draconicevolution.common.lib.References;
import com.brandon3055.draconicevolution.common.network.ButtonPacket;
import com.brandon3055.draconicevolution.common.tileentities.TileDraconiumChest;
import com.brandon3055.brandonscore.client.utills.GuiHelper;
import cpw.mods.fml.common.Optional;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
@@ -1,14 +1,13 @@
package com.brandon3055.draconicevolution.client.gui;
import com.brandon3055.brandonscore.client.utills.GuiHelper;
import com.brandon3055.brandonscore.common.utills.ItemNBTHelper;
import com.brandon3055.brandonscore.common.utills.Teleporter.TeleportLocation;
import com.brandon3055.draconicevolution.DraconicEvolution;
import com.brandon3055.draconicevolution.client.gui.manual.GuiButtonAHeight;
import com.brandon3055.draconicevolution.common.ModItems;
import com.brandon3055.draconicevolution.common.handler.ConfigHandler;
import com.brandon3055.draconicevolution.common.lib.References;
import com.brandon3055.draconicevolution.common.network.TeleporterPacket;
import com.brandon3055.brandonscore.client.utills.GuiHelper;
import com.brandon3055.brandonscore.common.utills.ItemNBTHelper;
import com.brandon3055.brandonscore.common.utills.Teleporter.TeleportLocation;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.client.Minecraft;
@@ -241,6 +241,7 @@ public class GUIUpgradeModifier extends GuiContainer {
public void drawScreen(int x, int y, float f) {
super.drawScreen(x, y, f);
if (!inUse) return;
//Second Draw
for (EnumUpgrade upgrade : itemUpgrades)
{
@@ -1,4 +1,4 @@
package com.brandon3055.draconicevolution.client.gui.manual;
package com.brandon3055.draconicevolution.client.gui;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.FontRenderer;
@@ -27,12 +27,12 @@ public class GuiButtonAHeight extends GuiButton{
GL11.glEnable(GL11.GL_BLEND);
OpenGlHelper.glBlendFunc(770, 771, 1, 0);
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
this.drawTexturedModalRect(this.xPosition, this.yPosition, 0, 46 + k * 20, this.width / 2, this.height);
this.drawTexturedModalRect(this.xPosition + this.width / 2, this.yPosition, 200 - this.width / 2, 46 + k * 20, this.width / 2, this.height);
this.drawTexturedModalRect(this.xPosition, this.yPosition, 0, 46 + k * 20, width % 2 + this.width / 2, this.height);
this.drawTexturedModalRect(width % 2 + this.xPosition + this.width / 2, this.yPosition, 200 - this.width / 2, 46 + k * 20, this.width / 2, this.height);
if (this.height < 20){
this.drawTexturedModalRect(xPosition, yPosition+3, 0, (46 + k * 20)+20-height+3, width / 2, height-3);
this.drawTexturedModalRect(xPosition + width / 2, yPosition+3, 200 - width / 2, (46 + k * 20)+20-height+3, width / 2, height-3);
this.drawTexturedModalRect(xPosition, yPosition+3, 0, (46 + k * 20)+20-height+3, width % 2 + width / 2, height-3);
this.drawTexturedModalRect(width % 2 + xPosition + width / 2, yPosition+3, 200 - width / 2, (46 + k * 20)+20-height+3, width / 2, height-3);
}
this.mouseDragged(minecraft, mouseX, mouseY);
int l = 14737632;
@@ -1,4 +1,4 @@
package com.brandon3055.draconicevolution.client.gui.manual;
package com.brandon3055.draconicevolution.client.gui;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.FontRenderer;
@@ -0,0 +1,211 @@
package com.brandon3055.draconicevolution.client.gui;
import com.brandon3055.brandonscore.client.gui.guicomponents.GUIBase;
import com.brandon3055.brandonscore.client.utills.GuiHelper;
import com.brandon3055.draconicevolution.common.handler.ConfigHandler;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.client.gui.GuiScreen;
import net.minecraft.client.renderer.RenderHelper;
import net.minecraft.util.StatCollector;
import org.lwjgl.opengl.GL11;
import org.lwjgl.opengl.GL12;
import java.util.ArrayList;
/**
* Created by brandon3055 on 11/2/2016.
*/
public class GuiHudConfig extends GuiScreen {
private GUIBase parent;
private GuiButton buttonHudFade;
private GuiButton buttonArmorFade;
private GuiButton buttonArmorNumeric;
private boolean draggingArmor = false;
private boolean draggingHud = false;
private int dragOffsetX = 0;
private int dragOffsetY = 0;
public GuiHudConfig(GUIBase parent){
this.parent = parent;
}
@SuppressWarnings("unchecked")
@Override
public void initGui() {
super.initGui();
buttonList.clear();
int x = width/2;
int y = height/2 - 30;
buttonList.add(new GuiButtonAHeight(0, x-35, y+95, 70, 15, StatCollector.translateToLocal("gui.back")));
buttonList.add(new GuiButtonAHeight(1, x+2, y-37, 80, 15, StatCollector.translateToLocal("button.de.scaleUp.txt")));
buttonList.add(new GuiButtonAHeight(2, x-81, y-37, 80, 15, StatCollector.translateToLocal("button.de.scaleDown.txt")));
buttonList.add(buttonHudFade = new GuiButtonAHeight(3, x-81, y-20, 163, 15, ""));
buttonList.add(new GuiButtonAHeight(9, x-81, y-3, 163, 15, StatCollector.translateToLocal("button.de.toggleHidden.txt")));
buttonList.add(new GuiButtonAHeight(4, x+2, y+25, 80, 15, StatCollector.translateToLocal("button.de.scaleUp.txt")));
buttonList.add(new GuiButtonAHeight(5, x-81, y+25, 80, 15, StatCollector.translateToLocal("button.de.scaleDown.txt")));
buttonList.add(buttonArmorFade = new GuiButtonAHeight(6, x-81, y+42, 163, 15, ""));
buttonList.add(buttonArmorNumeric = new GuiButtonAHeight(7, x+2, y+59, 80, 15, ""));
buttonList.add(new GuiButtonAHeight(8, x-81, y+59, 80, 15, StatCollector.translateToLocal("button.de.rotate.txt")));
buttonList.add(new GuiButtonAHeight(10, x-81, y+76, 163, 15, StatCollector.translateToLocal("button.de.toggleHidden.txt")));
}
@Override
public void updateScreen() {
buttonHudFade.displayString = StatCollector.translateToLocal("button.de.fadeMode"+ ConfigHandler.hudSettings[6]+".txt");
buttonArmorFade.displayString = StatCollector.translateToLocal("button.de.fadeMode"+ ConfigHandler.hudSettings[7]+".txt");
buttonArmorNumeric.displayString = StatCollector.translateToLocal("button.de.numeric.txt")+" "+(ConfigHandler.hudSettings[9] == 0 ? StatCollector.translateToLocal("gui.de.off.txt") : StatCollector.translateToLocal("gui.de.on.txt"));
}
@Override
protected void actionPerformed(GuiButton button) {
if (button.id == 0) {
Minecraft.getMinecraft().displayGuiScreen(parent);
return;
}
else if (button.id == 1 && ConfigHandler.hudSettings[4] < 300){
ConfigHandler.hudSettings[4] += 10;
}
else if (button.id == 2 && ConfigHandler.hudSettings[4] > 30){
ConfigHandler.hudSettings[4] -= 10;
}
else if (button.id == 3){
if (ConfigHandler.hudSettings[6] < 4) ConfigHandler.hudSettings[6]++;
else ConfigHandler.hudSettings[6] = 0;
}
else if (button.id == 4 && ConfigHandler.hudSettings[5] < 300){
ConfigHandler.hudSettings[5] += 10;
}
else if (button.id == 5 && ConfigHandler.hudSettings[5] > 30){
ConfigHandler.hudSettings[5] -= 10;
}
else if (button.id == 6){
if (ConfigHandler.hudSettings[7] < 4) ConfigHandler.hudSettings[7]++;
else ConfigHandler.hudSettings[7] = 0;
}
else if (button.id == 7){
if (ConfigHandler.hudSettings[9] == 0) ConfigHandler.hudSettings[9] = 1;
else ConfigHandler.hudSettings[9] = 0;
}
else if (button.id == 8){
if (ConfigHandler.hudSettings[8] == 0) ConfigHandler.hudSettings[8] = 1;
else ConfigHandler.hudSettings[8] = 0;
}
else if (button.id == 9){
if (ConfigHandler.hudSettings[10] == 0) ConfigHandler.hudSettings[10] = 1;
else ConfigHandler.hudSettings[10] = 0;
}
else if (button.id == 10){
if (ConfigHandler.hudSettings[11] == 0) ConfigHandler.hudSettings[11] = 1;
else ConfigHandler.hudSettings[11] = 0;
}
ConfigHandler.config.get("Gui Stuff", "HUD Settings", new int[]{7, 874, 100, 100, 100, 100, 0, 0, 0, 0, 1, 1}, "Used to store the position of the armor ant tool HUD's. This should not be modified", Integer.MIN_VALUE, Integer.MAX_VALUE, true, 12).set(ConfigHandler.hudSettings);
ConfigHandler.config.save();
}
@Override
public void drawScreen(int x, int y, float partial) {
int[] pos = ConfigHandler.hudSettings;
int hudX = (int)((pos[0] / 1000D) * width);
int hudY = (int)((pos[1] / 1000D) * height);
int armorX = (int)((pos[2] / 1000D) * width);
int armorY = (int)((pos[3] / 1000D) * height);
drawCenteredString(fontRendererObj, StatCollector.translateToLocal("gui.de.configureGuiElements.txt"), width/2, height/2-90, 0x00FFFF);
drawCenteredString(fontRendererObj, StatCollector.translateToLocal("gui.de.hudDisplaySettings.txt"), width/2, height/2-77, 0xFFFFFF);
drawCenteredString(fontRendererObj, StatCollector.translateToLocal("gui.de.shieldDisplaySettings.txt"), width/2, height/2-15, 0xFFFFFF);
drawCenteredString(fontRendererObj, ConfigHandler.hudSettings[4]+"%", width/2 + 97, height/2-63, 0xFFFFFF);
drawCenteredString(fontRendererObj, ConfigHandler.hudSettings[5]+"%", width/2 + 97, height/2-1, 0xFFFFFF);
super.drawScreen(x, y, partial);
GL11.glDisable(GL12.GL_RESCALE_NORMAL);
RenderHelper.disableStandardItemLighting();
GL11.glDisable(GL11.GL_LIGHTING);
GL11.glDisable(GL11.GL_DEPTH_TEST);
GuiHelper.drawGradientRect(hudX-19, hudY-19, hudX+20, hudY+20, 0x20FF00FF, 0x20FF00FF, 1F, 1D);
GuiHelper.drawGradientRect(hudX-4, hudY, hudX+5, hudY+1, 0xFFFFFFFF, 0xFFFFFFFF, 1F, 1D);
GuiHelper.drawGradientRect(hudX, hudY-4, hudX+1, hudY+5, 0xFFFFFFFF, 0xFFFFFFFF, 1F, 1D);
GuiHelper.drawGradientRect(hudX-19, hudY-19, hudX+20, hudY-18, 0xFFFFFFFF, 0xFFFFFFFF, 1F, 1D);
GuiHelper.drawGradientRect(hudX-19, hudY+19, hudX+20, hudY+20, 0xFFFFFFFF, 0xFFFFFFFF, 1F, 1D);
GuiHelper.drawGradientRect(hudX-19, hudY-19, hudX-18, hudY+20, 0xFFFFFFFF, 0xFFFFFFFF, 1F, 1D);
GuiHelper.drawGradientRect(hudX+19, hudY-19, hudX+20, hudY+20, 0xFFFFFFFF, 0xFFFFFFFF, 1F, 1D);
GuiHelper.drawGradientRect(armorX-19, armorY-19, armorX+20, armorY+20, 0x20FF00FF, 0x20FF00FF, 1F, 1D);
GuiHelper.drawGradientRect(armorX-4, armorY, armorX+5, armorY+1, 0xFFFFFFFF, 0xFFFFFFFF, 1F, 1D);
GuiHelper.drawGradientRect(armorX, armorY-4, armorX+1, armorY+5, 0xFFFFFFFF, 0xFFFFFFFF, 1F, 1D);
GuiHelper.drawGradientRect(armorX-19, armorY-19, armorX+20, armorY-18, 0xFFFFFFFF, 0xFFFFFFFF, 1F, 1D);
GuiHelper.drawGradientRect(armorX-19, armorY+19, armorX+20, armorY+20, 0xFFFFFFFF, 0xFFFFFFFF, 1F, 1D);
GuiHelper.drawGradientRect(armorX-19, armorY-19, armorX-18, armorY+20, 0xFFFFFFFF, 0xFFFFFFFF, 1F, 1D);
GuiHelper.drawGradientRect(armorX+19, armorY-19, armorX+20, armorY+20, 0xFFFFFFFF, 0xFFFFFFFF, 1F, 1D);
GL11.glEnable(GL11.GL_LIGHTING);
GL11.glEnable(GL11.GL_DEPTH_TEST);
RenderHelper.enableStandardItemLighting();
GL11.glEnable(GL12.GL_RESCALE_NORMAL);
if (GuiHelper.isInRect(armorX-19, armorY-19, 39, 39, x, y) || GuiHelper.isInRect(hudX-19, hudY-19, 39, 39, x, y)){
drawHoveringText(new ArrayList<String>(){{add(StatCollector.translateToLocal("info.de.hudDisplayConfigTxt2.txt"));}}, x, y, fontRendererObj);
}
}
@Override
protected void mouseClicked(int x, int y, int button) {
int[] pos = ConfigHandler.hudSettings;
int hudX = (int)((pos[0] / 1000D) * width);
int hudY = (int)((pos[1] / 1000D) * height);
int armorX = (int)((pos[2] / 1000D) * width);
int armorY = (int)((pos[3] / 1000D) * height);
if (GuiHelper.isInRect(hudX-19, hudY-19, 39, 39, x, y)){
draggingHud = true;
dragOffsetX = hudX-x;
dragOffsetY = hudY-y;
return;
}
else if (GuiHelper.isInRect(armorX-19, armorY-19, 39, 39, x, y)){
draggingArmor = true;
dragOffsetX = armorX-x;
dragOffsetY = armorY-y;
return;
}
super.mouseClicked(x, y, button);
}
@Override
protected void mouseMovedOrUp(int x, int y, int action) {
super.mouseMovedOrUp(x, y, action);
draggingHud = draggingArmor = false;
ConfigHandler.config.get("Gui Stuff", "HUD Settings", new int[] {7, 874, 100, 100, 100, 100, 0, 0, 0, 0, 1, 1}, "Used to store the position of the armor ant tool HUD's. This should not be modified", Integer.MIN_VALUE, Integer.MAX_VALUE, true, 12).set(ConfigHandler.hudSettings);
ConfigHandler.config.save();
}
@Override
protected void mouseClickMove(int x, int y, int action, long time) {
super.mouseClickMove(x, y, action, time);
int x1 = (int) (((float) (x+dragOffsetX) / (float) width) * 1000f);
int y1 = (int) (((float) (y+dragOffsetY) / (float) height) * 1000f);
if (draggingHud){
ConfigHandler.hudSettings[0] = x1;
ConfigHandler.hudSettings[1] = y1;
}
else if (draggingArmor){
ConfigHandler.hudSettings[2] = x1;
ConfigHandler.hudSettings[3] = y1;
}
}
@Override
public boolean doesGuiPauseGame() {
return false;
}
}
@@ -1,21 +1,21 @@
package com.brandon3055.draconicevolution.client.gui.componentguis;
import com.brandon3055.brandonscore.client.gui.guicomponents.*;
import com.brandon3055.draconicevolution.client.gui.guicomponents.*;
import com.brandon3055.draconicevolution.client.gui.GuiHudConfig;
import com.brandon3055.draconicevolution.client.gui.guicomponents.ComponentConfigItemButton;
import com.brandon3055.draconicevolution.client.gui.guicomponents.ComponentFieldAdjuster;
import com.brandon3055.draconicevolution.client.gui.guicomponents.ComponentFieldButton;
import com.brandon3055.draconicevolution.common.container.ContainerAdvTool;
import com.brandon3055.draconicevolution.common.handler.ConfigHandler;
import com.brandon3055.draconicevolution.common.lib.References;
import com.brandon3055.draconicevolution.common.utills.IConfigurableItem;
import com.brandon3055.draconicevolution.common.utills.IInventoryTool;
import com.brandon3055.draconicevolution.common.utills.ItemConfigField;
import com.brandon3055.draconicevolution.common.utills.LogHelper;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.StatCollector;
import net.minecraftforge.common.config.Configuration;
/**
* Created by Brandon on 26/12/2014.
@@ -27,7 +27,6 @@ public class GUIToolConfig extends GUIBase {
private int screenLevel = 0;
private ItemStack editingItem;
private ContainerAdvTool container;
private boolean draggingHud = false;
public GUIToolConfig(EntityPlayer player, ContainerAdvTool container) {
super(container, 198, 89);
@@ -50,11 +49,12 @@ public class GUIToolConfig extends GUIBase {
@Override
protected ComponentCollection assembleComponents() {
ComponentCollection c = new ComponentCollection(0, 0, xSize, ySize, this);
ComponentCollection c = new ComponentCollection(0, 0, xSize, ySize+14, this);
c.addComponent(new ComponentTexturedRect(0, 0, 198, 89, inventoryTexture)).setGroup("BACKGROUND");
c.addComponent(new ComponentButton(3, 26, 20, 12, 0, this, "<=", "Back")).setGroup("BUTTONS").setName("BACK_BUTTON");
c.addComponent(new ComponentButton(3, 39, 20, 12, 1, this, "Inv", "Item Inventory")).setGroup("BUTTONS").setName("INVENTORY_BUTTON");
c.addComponent(new ComponentButton(3, 26, 20, 12, 0, this, "<=", StatCollector.translateToLocal("gui.back"))).setGroup("BUTTONS").setName("BACK_BUTTON");
c.addComponent(new ComponentButton(3, 39, 20, 12, 1, this, "Inv", StatCollector.translateToLocal("gui.de.itemInventory.txt"))).setGroup("BUTTONS").setName("INVENTORY_BUTTON");
c.addComponent(new ComponentFieldAdjuster(4, 34, null, this)).setGroup("FIELD_BUTTONS").setName("FIELD_CONFIG_BUTTON_ARRAY");
c.addComponent(new ComponentButton(0, ySize, xSize, 14, 2, this, StatCollector.translateToLocal("gui.de.configureGuiElements.txt")).setGroup("INV_SCREEN"));
return c;
}
@@ -78,7 +78,6 @@ public class GUIToolConfig extends GUIBase {
public void updateItemButtons()
{
LogHelper.info("Update Buttons");
for (ComponentBase component : collection.getComponents())
{
if (component instanceof ComponentConfigItemButton)
@@ -92,15 +91,6 @@ public class GUIToolConfig extends GUIBase {
protected void mouseClicked(int x, int y, int button) {
super.mouseClicked(x, y, button);
if (!collection.isMouseOver(x - guiLeft, y - guiTop)) {
draggingHud = true;
int x1 = (int) (((float) x / (float) width) * 1000f);
int y1 = (int) (((float) y / (float) height) * 1000f);
ConfigHandler.hudX = x1;
ConfigHandler.hudY = y1;
}
if (buttonPressed) return;
@@ -127,29 +117,6 @@ public class GUIToolConfig extends GUIBase {
}
}
@Override
protected void mouseClickMove(int x, int y, int button, long time) {
super.mouseClickMove(x, y, button, time);
if (draggingHud)
{
int x1 = (int) (((float) x / (float) width) * 1000f);
int y1 = (int) (((float) y / (float) height) * 1000f);
ConfigHandler.hudX = x1;
ConfigHandler.hudY = y1;
}
}
@Override
protected void mouseMovedOrUp(int x, int y, int button) {
super.mouseMovedOrUp(x, y, button);
if (draggingHud) {
draggingHud = false;
ConfigHandler.config.get(Configuration.CATEGORY_GENERAL, "Hud Display X pos", 7).set(ConfigHandler.hudX);
ConfigHandler.config.get(Configuration.CATEGORY_GENERAL, "Hud Display Y pos", 874).set(ConfigHandler.hudY);
ConfigHandler.config.save();
}
}
@Override
public void buttonClicked(int id, int button) {
@@ -164,12 +131,9 @@ public class GUIToolConfig extends GUIBase {
// LogHelper.info("Pre send container " + Minecraft.getMinecraft().thePlayer.openContainer);
// DraconicEvolution.network.sendToServer(new ButtonPacket(ButtonPacket.ID_TOOLINVENTORY, false));
}
}
@Override
protected void drawGuiContainerForegroundLayer(int mouseX, int mouseY) {
super.drawGuiContainerForegroundLayer(mouseX, mouseY);
fontRendererObj.drawString(StatCollector.translateToLocal("info.de.hudDisplayConfigInfo1.txt") + " " + StatCollector.translateToLocal("info.de.hudDisplayConfigInfo2.txt"), 0, 91, 0xffffff);
else if (id == 2) {
Minecraft.getMinecraft().displayGuiScreen(new GuiHudConfig(this));
}
}
public void setLevel(int level){
@@ -1,7 +1,10 @@
package com.brandon3055.draconicevolution.client.handler;
import com.brandon3055.draconicevolution.client.gui.componentguis.GUIToolConfig;
import com.brandon3055.brandonscore.client.utills.GuiHelper;
import com.brandon3055.brandonscore.common.utills.ItemNBTHelper;
import com.brandon3055.draconicevolution.client.gui.GuiHudConfig;
import com.brandon3055.draconicevolution.common.handler.ConfigHandler;
import com.brandon3055.draconicevolution.common.items.armor.IShieldedArmor;
import com.brandon3055.draconicevolution.common.utills.IHudDisplayBlock;
import com.brandon3055.draconicevolution.common.utills.IHudDisplayItem;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
@@ -10,16 +13,13 @@ import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.FontRenderer;
import net.minecraft.client.gui.ScaledResolution;
import net.minecraft.client.renderer.OpenGlHelper;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.item.ItemStack;
import net.minecraft.util.MovingObjectPosition;
import net.minecraft.util.StatCollector;
import net.minecraftforge.client.event.RenderGameOverlayEvent;
import org.lwjgl.opengl.GL11;
import org.lwjgl.opengl.GL12;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
/**
@@ -28,51 +28,73 @@ import java.util.List;
public class HudHandler {
private static List<String> hudList = null;
private static List<String> ltHudList = null;
private static float toolTipFadeOut = 0F;
private static float armorStatsFadeOut = 0F;
public static boolean fadeHud = false;
public static boolean fadeArmorStats = false;
private static boolean showArmorHud = false;
private static int armorPoints = 0;
private static int maxArmorPoints = 0;
private static int armorFatigue = 0;
private static int ltProtPoints = 0;
private static int ltFatigue = 0;
int width;
int height;
@SubscribeEvent
@SideOnly(Side.CLIENT)
public void drawHUD(RenderGameOverlayEvent.Post event) {
if (ConfigHandler.enableHudDisplay && event.type == RenderGameOverlayEvent.ElementType.ALL) {
if (hudList == null) return;
Minecraft mc = Minecraft.getMinecraft();
if (event.type != RenderGameOverlayEvent.ElementType.ALL || mc.gameSettings.showDebugInfo) return;
ScaledResolution resolution = event.resolution;
width = resolution.getScaledWidth();
height = resolution.getScaledHeight();
FontRenderer fontRenderer = mc.fontRenderer;
Minecraft mc = Minecraft.getMinecraft();
if (mc.gameSettings.showDebugInfo) return;
ScaledResolution resolution = event.resolution;
width = resolution.getScaledWidth();
height = resolution.getScaledHeight();
FontRenderer fontRenderer = mc.fontRenderer;
int x = (int) (((float)ConfigHandler.hudX / 1000F) * (float) width);
int y = (int) (((float)ConfigHandler.hudY / 1000F) * (float) height);
if (ConfigHandler.hudSettings[10] == 1 && hudList != null) {
int x = (int) (((float)ConfigHandler.hudSettings[0] / 1000F) * (float) width);
int y = (int) (((float)ConfigHandler.hudSettings[1] / 1000F) * (float) height);
GL11.glPushMatrix();
GL11.glPushAttrib(GL11.GL_ALL_ATTRIB_BITS);
drawHoveringText(hudList, x, y, fontRenderer);
GuiHelper.drawHoveringText(hudList, x, y, fontRenderer, toolTipFadeOut > 1 ? 1 : toolTipFadeOut, ConfigHandler.hudSettings[4] / 100D, width, height);
GL11.glPopAttrib();
GL11.glPopMatrix();
}
}
if (ConfigHandler.hudSettings[11] == 1 && showArmorHud) {
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);
}
}
//x, y, x, y, scale, scale, fademode, fademode, rotateArmor, armorText
@SideOnly(Side.CLIENT)
public static void clientTick() {
if (toolTipFadeOut > 0 && fadeHud) toolTipFadeOut-=0.1F;
if (hudList != null && (ltHudList == null || !hudList.equals(ltHudList))) toolTipFadeOut = 10F;
if (armorStatsFadeOut > 0 && fadeArmorStats) armorStatsFadeOut-=0.1F;
//if (hudList != null && (ltHudList == null || !hudList.equals(ltHudList))) armorStatsFadeOut = 10F;todo armor refresh condition
ltHudList = hudList;
Minecraft mc = Minecraft.getMinecraft();
if (mc == null || mc.thePlayer == null) return;
ItemStack[] armorSlots = mc.thePlayer.inventory.armorInventory;
hudList = null;
if (mc.currentScreen != null)
{
if (mc.currentScreen instanceof GUIToolConfig)
if (mc.currentScreen instanceof GuiHudConfig)
{
hudList = new ArrayList<String>();
hudList.add(StatCollector.translateToLocal("info.de.hudDisplayConfigTxt1.txt"));
hudList.add("");
hudList.add(StatCollector.translateToLocal("info.de.hudDisplayConfigTxt2.txt"));
hudList.add("");
hudList.add("");
hudList.add(StatCollector.translateToLocal("info.de.hudDisplayConfigTxt3.txt"));
}
@@ -86,109 +108,62 @@ public class HudHandler {
{
hudList = ((IHudDisplayBlock)mc.theWorld.getBlock(mop.blockX, mop.blockY, mop.blockZ)).getDisplayData(mc.theWorld, mop.blockX, mop.blockY, mop.blockZ);
}
}
protected void drawHoveringText(List list, int x, int y, FontRenderer font)
{
if (!list.isEmpty())
{
GL11.glDisable(GL12.GL_RESCALE_NORMAL);
// RenderHelper.disableStandardItemLighting();
GL11.glDisable(GL11.GL_LIGHTING);
GL11.glDisable(GL11.GL_DEPTH_TEST);
int k = 0;
Iterator iterator = list.iterator();
while (iterator.hasNext())
{
String s = (String)iterator.next();
int l = font.getStringWidth(s);
if (l > k)
{
k = l;
}
}
int adjX = x + 12;
int adjY = y - 12;
int i1 = 8;
if (list.size() > 1)
{
i1 += 2 + (list.size() - 1) * 10;
}
if (adjX + k > width)
{
adjX -= 28 + k;
}
if (adjY + i1 + 6 > height)
{
adjY = height - i1 - 6;
}
int j1 = -267386864;
this.drawGradientRect(adjX - 3, adjY - 4, adjX + k + 3, adjY - 3, j1, j1);
this.drawGradientRect(adjX - 3, adjY + i1 + 3, adjX + k + 3, adjY + i1 + 4, j1, j1);
this.drawGradientRect(adjX - 3, adjY - 3, adjX + k + 3, adjY + i1 + 3, j1, j1);
this.drawGradientRect(adjX - 4, adjY - 3, adjX - 3, adjY + i1 + 3, j1, j1);
this.drawGradientRect(adjX + k + 3, adjY - 3, adjX + k + 4, adjY + i1 + 3, j1, j1);
int k1 = 1347420415;
int l1 = (k1 & 16711422) >> 1 | k1 & -16777216;
this.drawGradientRect(adjX - 3, adjY - 3 + 1, adjX - 3 + 1, adjY + i1 + 3 - 1, k1, l1);
this.drawGradientRect(adjX + k + 2, adjY - 3 + 1, adjX + k + 3, adjY + i1 + 3 - 1, k1, l1);
this.drawGradientRect(adjX - 3, adjY - 3, adjX + k + 3, adjY - 3 + 1, k1, k1);
this.drawGradientRect(adjX - 3, adjY + i1 + 2, adjX + k + 3, adjY + i1 + 3, l1, l1);
for (int i2 = 0; i2 < list.size(); ++i2)
{
String s1 = (String)list.get(i2);
font.drawStringWithShadow(s1, adjX, adjY, -1);
if (i2 == 0)
{
adjY += 2;
}
adjY += 10;
}
GL11.glEnable(GL11.GL_LIGHTING);
GL11.glEnable(GL11.GL_DEPTH_TEST);
// RenderHelper.enableStandardItemLighting();
GL11.glEnable(GL12.GL_RESCALE_NORMAL);
showArmorHud = false;
maxArmorPoints = 0;
armorPoints = 0;
armorFatigue = 0;
int peaces = 0;
for (ItemStack stack : armorSlots){
if (stack == null || !(stack.getItem() instanceof IShieldedArmor)) continue;
peaces++;
showArmorHud = true;
IShieldedArmor armor = (IShieldedArmor) stack.getItem();
maxArmorPoints += armor.getProtectionPoints(stack);
armorPoints += ItemNBTHelper.getInteger(stack, "ProtectionPoints", 0);
armorFatigue += ItemNBTHelper.getInteger(stack, "ArmorFatigue", 0);
}
if (armorPoints > 0 && maxArmorPoints > 0) armorPoints = (int)((armorPoints / (double)maxArmorPoints) * 100D);
if (armorFatigue > 0 && peaces > 0) armorFatigue /= peaces;
}
protected void drawGradientRect(int x1, int y1, int x2, int y2, int colour1, int colour2)
{
float f = (float)(colour1 >> 24 & 255) / 255.0F;
float f1 = (float)(colour1 >> 16 & 255) / 255.0F;
float f2 = (float)(colour1 >> 8 & 255) / 255.0F;
float f3 = (float)(colour1 & 255) / 255.0F;
float f4 = (float)(colour2 >> 24 & 255) / 255.0F;
float f5 = (float)(colour2 >> 16 & 255) / 255.0F;
float f6 = (float)(colour2 >> 8 & 255) / 255.0F;
float f7 = (float)(colour2 & 255) / 255.0F;
GL11.glDisable(GL11.GL_TEXTURE_2D);
GL11.glEnable(GL11.GL_BLEND);
GL11.glDisable(GL11.GL_ALPHA_TEST);
OpenGlHelper.glBlendFunc(770, 771, 1, 0);
GL11.glShadeModel(GL11.GL_SMOOTH);
Tessellator tessellator = Tessellator.instance;
tessellator.startDrawingQuads();
tessellator.setColorRGBA_F(f1, f2, f3, f);
tessellator.addVertex((double)x2, (double)y1, 300D);
tessellator.addVertex((double)x1, (double)y1, 300D);
tessellator.setColorRGBA_F(f5, f6, f7, f4);
tessellator.addVertex((double)x1, (double)y2, 300D);
tessellator.addVertex((double)x2, (double)y2, 300D);
tessellator.draw();
GL11.glShadeModel(GL11.GL_FLAT);
GL11.glDisable(GL11.GL_BLEND);
private void drawArmorHUD(int x, int y, boolean rotated, double scale){
GL11.glPushMatrix();
GL11.glEnable(GL11.GL_ALPHA_TEST);
GL11.glEnable(GL11.GL_TEXTURE_2D);
ResourceHandler.bindResource("textures/gui/HUD.png");
if (rotated){
GuiHelper.drawTexturedRect(x-(12*scale), y+scale, (int)(11*scale), (int)(13*scale), 2, 0, 11, 13, 0, GuiHelper.PXL128);
x+=(104*scale);
GL11.glTranslated(x, y, 0);
GL11.glRotated(-90, 0, 0, -1);
GL11.glTranslated(-x, -y, 0);
}
else GuiHelper.drawTexturedRect(x+(1*scale), y+(104*scale)+1, (int)(13*scale), (int)(15*scale), 2, 0, 11, 13, 0, GuiHelper.PXL128);
GuiHelper.drawTexturedRect(x, y, (int)(15*scale), (int)(104*scale), 0, 14, 15, 104, 0, GuiHelper.PXL128);
GuiHelper.drawTexturedRect(x+2, y+2+(100- armorPoints), (int)(8*scale), (int)(armorPoints *scale), 15, 100- armorPoints, 8, armorPoints, 0, GuiHelper.PXL128);
GuiHelper.drawTexturedRect(x+11, y+2+(100- armorFatigue), (int)(2*scale), (int)(armorFatigue *scale), 24, 100- armorFatigue, 2, armorFatigue, 0, GuiHelper.PXL128);
if (ConfigHandler.hudSettings[9] == 1) {
FontRenderer fontRenderer = Minecraft.getMinecraft().fontRenderer;
GL11.glTranslated(x, y, 0);
GL11.glScaled(scale, scale, 1);
if (rotated) GL11.glRotated(90, 0, 0, -1);
GL11.glTranslated(-x, -y, 0);
if (!rotated) {
fontRenderer.drawStringWithShadow(armorPoints + "/" + maxArmorPoints, x + 16, y + 84, 0xFFFFFF);
fontRenderer.drawStringWithShadow(armorFatigue + "%", x + 16, y + 94, 0xFFFFFF);
}else {
fontRenderer.drawStringWithShadow(armorPoints + "/" + maxArmorPoints, x - 102, y + 16, 0xFFFFFF);
fontRenderer.drawStringWithShadow(armorFatigue + "%", x - fontRenderer.getStringWidth(armorFatigue + "%"), y + 16, 0xFFFFFF);
}
}
ResourceHandler.bindTexture(ResourceHandler.getResourceWOP("minecraft:textures/gui/icons.png"));
GL11.glDisable(GL11.GL_ALPHA_TEST);
GL11.glPopMatrix();
}
}
@@ -77,19 +77,19 @@ public class RenderTileEnergyStorageCore extends TileEntitySpecialRenderer {
iner_model.renderAll();
GL11.glPopMatrix();
GL11.glPushMatrix();
GL11.glScalef(0.8F, 0.8F, 0.8F);
GL11.glColor4d(1F, 1f, 0.2f, 1F);
GL11.glRotatef(rotation, 0F, 1F, 0.5F);
iner_model.renderAll();
GL11.glPopMatrix();
GL11.glPushMatrix();
GL11.glScalef(0.9F, 0.9F, 0.9F);
GL11.glColor4d(1F, 0f, 0.2f, 1F);
GL11.glRotatef(rotation, 0F, 1F, 0.5F);
iner_model.renderAll();
GL11.glPopMatrix();
// GL11.glPushMatrix();
// GL11.glScalef(0.8F, 0.8F, 0.8F);
// GL11.glColor4d(1F, 1f, 0.2f, 1F);
// GL11.glRotatef(rotation, 0F, 1F, 0.5F);
// //iner_model.renderAll();
// GL11.glPopMatrix();
//
// GL11.glPushMatrix();
// GL11.glScalef(0.9F, 0.9F, 0.9F);
// GL11.glColor4d(1F, 0f, 0.2f, 1F);
// GL11.glRotatef(rotation, 0F, 1F, 0.5F);
// //iner_model.renderAll();
// GL11.glPopMatrix();
GL11.glScalef(1.1F, 1.1F, 1.1F);
GL11.glDepthMask(false);
@@ -16,8 +16,6 @@ public class ConfigHandler {
public static int soulDropChance;
public static int passiveSoulDropChance;
public static int cometRarity;
public static int hudX;
public static int hudY;
public static int chaosIslandSeparation;
public static boolean generateEnderComets;
public static boolean generateChaosIslands;
@@ -29,12 +27,12 @@ public class ConfigHandler {
public static boolean disableOreSpawnEnd;
public static boolean disableOreSpawnOverworld;
public static boolean disableOreSpawnNether;
public static boolean enableHudDisplay;
public static boolean enableVersionChecker;
public static boolean dragonBreaksBlocks;
public static boolean sumonRitualAccelerated;
public static int[] dragonEggSpawnLocation;
public static int[] oreGenDimentionBlacklist;
public static int[] hudSettings;
private static String[] disabledBlocksItems;
public static List<String> disabledNamesList = new ArrayList<String>();
public static double maxPlayerSpeed;
@@ -95,12 +93,12 @@ public class ConfigHandler {
pigmenBloodRage = config.get(Configuration.CATEGORY_GENERAL, "Pigmen Blood Rage", true, "Is Pigmen blood rage active").getBoolean(true);
disableLore = config.get(Configuration.CATEGORY_GENERAL, "Disable Item Lore", false, "Set to true to disable all item lore").getBoolean(false);
invertDPDSB = config.get(Configuration.CATEGORY_GENERAL, "InvertDPDSB", false, "Invert Dislocator Pedestal display name shift behavior").getBoolean(false);
hudX = config.get(Configuration.CATEGORY_GENERAL, "Hud Display X pos", 7).getInt(7);
hudY = config.get(Configuration.CATEGORY_GENERAL, "Hud Display Y pos", 874).getInt(874);
//First is tool hud second is armor hud
//x, y, x, y, scale, scale, fademode, fademode, rotateArmor, armorText, hudEnabled, shieldEnabled
hudSettings = config.get("Gui Stuff", "HUD Settings", new int[] {7, 874, 100, 100, 100, 100, 0, 0, 0, 0, 1, 1}, "Used to store the position of the armor ant tool HUD's. This should not be modified", Integer.MIN_VALUE, Integer.MAX_VALUE, true, 12).getIntList();
disableOreSpawnEnd = config.get(Configuration.CATEGORY_GENERAL, "Disable Ore Spawn (End)", false, "Set to true to prevent draconium ore from spawning in the end").getBoolean(false);
disableOreSpawnNether = config.get(Configuration.CATEGORY_GENERAL, "Disable Ore Spawn (Nether)", false, "Set to true to prevent draconium ore from spawning in the nether").getBoolean(false);
disableOreSpawnOverworld = config.get(Configuration.CATEGORY_GENERAL, "Disable Ore Spawn (Overworld)", false, "Set to true to prevent draconium ore from spawning in the overworld").getBoolean(false);
enableHudDisplay = config.get(Configuration.CATEGORY_GENERAL, "Enable HUD info", true, "Set to false to disable the HUD info for tools and blocks").getBoolean(true);
enableVersionChecker = config.get(Configuration.CATEGORY_GENERAL, "Enable version checker", true, "Set to false to disable the version checker").getBoolean(true);
dragonBreaksBlocks = config.get(Configuration.CATEGORY_GENERAL, "Can dragon break blocks", true, "Set to false to disable the DE dragons ability to break blocks (dose not effect vanilla dragon)").getBoolean(true);
dragonEggSpawnLocation = config.get(Configuration.CATEGORY_GENERAL, "Dragon egg spawn location", new int[] {0, 0, 0}, "Sets the exact location to spawn the dragon egg and disables the portal spawn (dose not effect vanilla dragon)").getIntList();
@@ -87,7 +87,7 @@ public class FMLEventHandler {
player.moveFlying(0F, 1F, percentIncrease / 2F);
}
player.jumpMovementFactor = 0.02F + (percentIncrease * 0.2F);
if (!player.onGround && player.ridingEntity == null) player.jumpMovementFactor = 0.02F + (percentIncrease * 0.2F);
if (walkSpeed != null) {
try {
@@ -52,7 +52,7 @@ import java.util.List;
@Optional.Interface(iface = "thaumcraft.api.IGoggles", modid = "Thaumcraft"),
@Optional.Interface(iface = "thaumcraft.api.nodes.IRevealer", modid = "Thaumcraft")
})
public class DraconicArmor extends ItemArmor implements ISpecialArmor, IEnergyContainerItem, IConfigurableItem, IInventoryTool, IGoggles, IRevealer, IUpgradableItem {//TODO Wings
public class DraconicArmor extends ItemArmor implements ISpecialArmor, IEnergyContainerItem, IConfigurableItem, IInventoryTool, IGoggles, IRevealer, IUpgradableItem, IShieldedArmor {//TODO Wings
@SideOnly(Side.CLIENT)
private IIcon helmIcon;
@SideOnly(Side.CLIENT)
@@ -446,4 +446,14 @@ public class DraconicArmor extends ItemArmor implements ISpecialArmor, IEnergyCo
if (upgradeIndex == EnumUpgrade.RF_CAPACITY.index) return 2;
return 0;
}
@Override
public int getProtectionPoints(ItemStack stack) {
return 10;
}
@Override
public int getRecoveryPoints(ItemStack stack) {
return 10;
}
}
@@ -39,7 +39,7 @@ import java.util.List;
/**
* Created by Brandon on 3/07/2014.
*/
public class WyvernArmor extends ItemArmor implements ISpecialArmor, IEnergyContainerItem, IConfigurableItem, IInventoryTool, IUpgradableItem {
public class WyvernArmor extends ItemArmor implements ISpecialArmor, IEnergyContainerItem, IConfigurableItem, IInventoryTool, IUpgradableItem, IShieldedArmor {
private IIcon helmIcon;
private IIcon chestIcon;
private IIcon leggsIcon;
@@ -372,4 +372,14 @@ public class WyvernArmor extends ItemArmor implements ISpecialArmor, IEnergyCont
if (upgradeIndex == EnumUpgrade.RF_CAPACITY.index) return 2;
return 0;
}
@Override
public int getProtectionPoints(ItemStack stack) {
return 10;
}
@Override
public int getRecoveryPoints(ItemStack stack) {
return 10;
}
}
@@ -448,6 +448,7 @@ button.de.addFuel.txt=Add Fuel
button.de.cancel.txt=Cancel
button.de.UP.txt=UP
button.de.DOWN.txt=DOWN
button.de.toggleHidden.txt=Toggle Hidden
//Item Config Buttons
button.de.ArmorNVActive.name=Night Vision
@@ -473,6 +474,15 @@ button.de.reactorStop.txt=Initiate Shutdown
button.de.stats.txt=Stats
button.de.statsShow.txt=Show
button.de.statsHide.txt=Hide
button.de.scaleUp.txt=Scale +
button.de.scaleDown.txt=Scale -
button.de.fadeMode0.txt=Fade Out: Off
button.de.fadeMode1.txt=Fade Out: 25%
button.de.fadeMode2.txt=Fade Out: 50%
button.de.fadeMode3.txt=Fade Out: 75%
button.de.fadeMode4.txt=Fade Out: Full
button.de.rotate.txt=Rotate
button.de.numeric.txt=Numeric:
//Gui ----------------------------------------------------------------------------------------------------------------------------------------
gui.de.flowGate.name=Flow Control
@@ -532,6 +542,10 @@ gui.de.pointCost.txt=Point Cost
gui.de.value.txt=Value
gui.de.points.txt=Points
gui.de.point.txt=Point
gui.de.itemInventory.txt=Item Inventory
gui.de.configureGuiElements.txt=Configure HUD Elements
gui.de.hudDisplaySettings.txt=HUD Display Settings
gui.de.shieldDisplaySettings.txt=Shield Display Settings
gui.de.RFCapacity.txt=RF Capacity
gui.de.DigSpeed.txt=Dig Speed
Binary file not shown.

After

Width:  |  Height:  |  Size: 6.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 33 KiB

After

Width:  |  Height:  |  Size: 34 KiB