diff --git a/resources/assets/enderio/textures/gui/alloySmelter.png b/resources/assets/enderio/textures/gui/alloySmelter.png index 2f98f5d6..e1c6f43c 100644 Binary files a/resources/assets/enderio/textures/gui/alloySmelter.png and b/resources/assets/enderio/textures/gui/alloySmelter.png differ diff --git a/resources/assets/enderio/textures/gui/capacitorBank.png b/resources/assets/enderio/textures/gui/capacitorBank.png index 53657471..0b452754 100644 Binary files a/resources/assets/enderio/textures/gui/capacitorBank.png and b/resources/assets/enderio/textures/gui/capacitorBank.png differ diff --git a/resources/assets/enderio/textures/gui/combustionGen.png b/resources/assets/enderio/textures/gui/combustionGen.png index aec22a71..31a27b6e 100644 Binary files a/resources/assets/enderio/textures/gui/combustionGen.png and b/resources/assets/enderio/textures/gui/combustionGen.png differ diff --git a/resources/assets/enderio/textures/gui/crafter.png b/resources/assets/enderio/textures/gui/crafter.png index a25fd2c0..09564695 100644 Binary files a/resources/assets/enderio/textures/gui/crafter.png and b/resources/assets/enderio/textures/gui/crafter.png differ diff --git a/resources/assets/enderio/textures/gui/enchanter.png b/resources/assets/enderio/textures/gui/enchanter.png index b8065cef..d2933d9b 100644 Binary files a/resources/assets/enderio/textures/gui/enchanter.png and b/resources/assets/enderio/textures/gui/enchanter.png differ diff --git a/resources/assets/enderio/textures/gui/experianceObelisk.png b/resources/assets/enderio/textures/gui/experianceObelisk.png index b0654496..c0f6e075 100644 Binary files a/resources/assets/enderio/textures/gui/experianceObelisk.png and b/resources/assets/enderio/textures/gui/experianceObelisk.png differ diff --git a/resources/assets/enderio/textures/gui/farmStation.png b/resources/assets/enderio/textures/gui/farmStation.png index c40da423..4be9f45f 100644 Binary files a/resources/assets/enderio/textures/gui/farmStation.png and b/resources/assets/enderio/textures/gui/farmStation.png differ diff --git a/resources/assets/enderio/textures/gui/hyperCube.png b/resources/assets/enderio/textures/gui/hyperCube.png index 36f30e76..7c0f2796 100644 Binary files a/resources/assets/enderio/textures/gui/hyperCube.png and b/resources/assets/enderio/textures/gui/hyperCube.png differ diff --git a/resources/assets/enderio/textures/gui/itemFilter.png b/resources/assets/enderio/textures/gui/itemFilter.png index abcca33b..b69a1e90 100644 Binary files a/resources/assets/enderio/textures/gui/itemFilter.png and b/resources/assets/enderio/textures/gui/itemFilter.png differ diff --git a/resources/assets/enderio/textures/gui/powerMonitor.png b/resources/assets/enderio/textures/gui/powerMonitor.png index dab934d5..ae2cd7aa 100644 Binary files a/resources/assets/enderio/textures/gui/powerMonitor.png and b/resources/assets/enderio/textures/gui/powerMonitor.png differ diff --git a/resources/assets/enderio/textures/gui/sliceAndSplice.png b/resources/assets/enderio/textures/gui/sliceAndSplice.png index 29408390..8559f204 100644 Binary files a/resources/assets/enderio/textures/gui/sliceAndSplice.png and b/resources/assets/enderio/textures/gui/sliceAndSplice.png differ diff --git a/resources/assets/enderio/textures/gui/tank.png b/resources/assets/enderio/textures/gui/tank.png index 44f18f10..0c333d82 100644 Binary files a/resources/assets/enderio/textures/gui/tank.png and b/resources/assets/enderio/textures/gui/tank.png differ diff --git a/resources/assets/enderio/textures/gui/transceiver.png b/resources/assets/enderio/textures/gui/transceiver.png index 34a0a5c5..5ea33e5f 100644 Binary files a/resources/assets/enderio/textures/gui/transceiver.png and b/resources/assets/enderio/textures/gui/transceiver.png differ diff --git a/resources/assets/enderio/textures/gui/vacumChest.png b/resources/assets/enderio/textures/gui/vacumChest.png index 4b203b2b..71d73ed4 100644 Binary files a/resources/assets/enderio/textures/gui/vacumChest.png and b/resources/assets/enderio/textures/gui/vacumChest.png differ diff --git a/resources/assets/enderio/textures/gui/vat.png b/resources/assets/enderio/textures/gui/vat.png index fdafa1d0..614d0340 100644 Binary files a/resources/assets/enderio/textures/gui/vat.png and b/resources/assets/enderio/textures/gui/vat.png differ diff --git a/resources/assets/enderio/textures/gui/widgets.png b/resources/assets/enderio/textures/gui/widgets.png index ae71b608..468d2152 100644 Binary files a/resources/assets/enderio/textures/gui/widgets.png and b/resources/assets/enderio/textures/gui/widgets.png differ diff --git a/src/main/java/crazypants/enderio/gui/IconEIO.java b/src/main/java/crazypants/enderio/gui/IconEIO.java index 9a82c4d5..a12f9864 100644 --- a/src/main/java/crazypants/enderio/gui/IconEIO.java +++ b/src/main/java/crazypants/enderio/gui/IconEIO.java @@ -2,6 +2,9 @@ package crazypants.enderio.gui; import net.minecraft.client.renderer.Tessellator; import net.minecraft.util.ResourceLocation; + +import org.lwjgl.opengl.GL11; + import crazypants.render.RenderUtil; public final class IconEIO { @@ -35,7 +38,7 @@ public final class IconEIO { public static final IconEIO WRENCH_OVERLAY_GAS = new IconEIO(64, 148, 32, 32); public static final IconEIO WRENCH_OVERLAY_GAS_OFF = new IconEIO(64 + 96, 148, 32, 32); - + public static final IconEIO WRENCH_OVERLAY_ME = new IconEIO(64, 180, 32, 32); public static final IconEIO WRENCH_OVERLAY_ME_OFF = new IconEIO(64 + 96, 180, 32, 32); @@ -100,15 +103,15 @@ public final class IconEIO { public static final IconEIO XP = new IconEIO(235, 60, 22, 22); public static final IconEIO XP_PLUS = new IconEIO(235, 82, 22, 22); - + public static final IconEIO SINGLE_PLUS = new IconEIO(234, 100); public static final IconEIO DOUBLE_PLUS = new IconEIO(218, 100); public static final IconEIO TRIPLE_PLUS = new IconEIO(202, 100); public static final IconEIO SINGLE_MINUS = new IconEIO(206, 116); public static final IconEIO DOUBLE_MINUS = new IconEIO(190, 116); public static final IconEIO TRIPLE_MINUS = new IconEIO(174, 116); - - public static final IconEIO ENDER_RAIL = new IconEIO(235,175); + + public static final IconEIO ENDER_RAIL = new IconEIO(235, 175); private static final int TEX_SIZE = 256; private static final double PIX_SIZE = 1d / TEX_SIZE; @@ -152,6 +155,7 @@ public final class IconEIO { } public void renderIcon(double x, double y, double width, double height, double zLevel, boolean doDraw, boolean flipY) { + GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); Tessellator tessellator = Tessellator.instance; if(doDraw) { diff --git a/src/main/java/crazypants/enderio/machine/alloy/GuiAlloySmelter.java b/src/main/java/crazypants/enderio/machine/alloy/GuiAlloySmelter.java index 0fd663f0..261184e9 100644 --- a/src/main/java/crazypants/enderio/machine/alloy/GuiAlloySmelter.java +++ b/src/main/java/crazypants/enderio/machine/alloy/GuiAlloySmelter.java @@ -70,7 +70,7 @@ public class GuiAlloySmelter extends GuiMachineBase { @Override protected void renderSlotHighlight(int slot, Vector4f col) { if(tileEntity.getSlotDefinition().isOutputSlot(slot)) { - renderSlotHighlight(col, 75,54,24,24); + renderSlotHighlight(col, 75, 54, 24, 24); } else { super.renderSlotHighlight(slot, col); } @@ -113,9 +113,9 @@ public class GuiAlloySmelter extends GuiMachineBase { int scaled; if(tileEntity.getProgress() < 1 && tileEntity.getProgress() > 0) { - scaled = tileEntity.getProgressScaled(12); - drawTexturedModalRect(sx + 55, sy + 48 - scaled, 176, 12 - scaled, 14, scaled + 2); - drawTexturedModalRect(sx + 103, sy + 48 - scaled, 176, 12 - scaled, 14, scaled + 2); + scaled = tileEntity.getProgressScaled(14) + 1; + drawTexturedModalRect(sx + 55, sy + 49 - scaled, 176, 14 - scaled, 14, scaled); + drawTexturedModalRect(sx + 103, sy + 49 - scaled, 176, 14 - scaled, 14, scaled); } super.drawGuiContainerBackgroundLayer(par1, par2, par3); diff --git a/src/main/java/crazypants/enderio/machine/generator/combustion/GuiCombustionGenerator.java b/src/main/java/crazypants/enderio/machine/generator/combustion/GuiCombustionGenerator.java index 4a92d3c2..7a1b072c 100644 --- a/src/main/java/crazypants/enderio/machine/generator/combustion/GuiCombustionGenerator.java +++ b/src/main/java/crazypants/enderio/machine/generator/combustion/GuiCombustionGenerator.java @@ -71,9 +71,9 @@ public class GuiCombustionGenerator extends GuiMachineBase { int y = 21 - 2; int w = 15 + 4; int h = 47 + 4; - renderSlotHighlight(PULL_COLOR,x,y,w,h); + renderSlotHighlight(PULL_COLOR, x, y, w, h); x = 114 - 2; - renderSlotHighlight(PULL_COLOR,x,y,w,h); + renderSlotHighlight(PULL_COLOR, x, y, w, h); } } @@ -89,10 +89,11 @@ public class GuiCombustionGenerator extends GuiMachineBase { FontRenderer fr = getFontRenderer(); int output = 0; - if(gen.isActive()) { + if(gen.isActive()) { output = gen.getGeneratedLastTick(); } - String txt = Lang.localize("combustionGenerator.output") + " " + PowerDisplayUtil.formatPower(output) + " " + PowerDisplayUtil.abrevation() + PowerDisplayUtil.perTickStr(); + String txt = Lang.localize("combustionGenerator.output") + " " + PowerDisplayUtil.formatPower(output) + " " + PowerDisplayUtil.abrevation() + + PowerDisplayUtil.perTickStr(); int sw = fr.getStringWidth(txt); fr.drawStringWithShadow(txt, guiLeft + xSize / 2 - sw / 2, guiTop + fr.FONT_HEIGHT / 2 + 3, ColorUtil.getRGB(Color.WHITE)); @@ -112,7 +113,7 @@ public class GuiCombustionGenerator extends GuiMachineBase { x = guiLeft + 72; y = guiTop + 14; //center coolant chamber - RenderUtil.renderGuiTank(gen.getCoolantTank().getFluid(), 1000, Math.min(gen.getCoolantTank().getFluidAmount(), 1000), x, y, zLevel, 33, 33); + RenderUtil.renderGuiTank(gen.getCoolantTank().getFluid(), 1000, Math.min(gen.getCoolantTank().getFluidAmount(), 1000), x, y + 14, zLevel, 33, 33); //draw some gui over the top again to make the center shape RenderUtil.bindTexture("enderio:textures/gui/combustionGen.png"); drawTexturedModalRect(x, y + 14, 0, 223, 33, 33); @@ -123,7 +124,6 @@ public class GuiCombustionGenerator extends GuiMachineBase { //left tank x = guiLeft + 48; - //RenderUtil.renderGuiTank(gen.fuelTank.getFluid(), 4000, gen.fuelTank.getFluidAmount() - 1000, x, y, zLevel, 15, 47); RenderUtil.renderGuiTank(gen.getFuelTank().getFluid(), 4000, gen.getFuelTank().getFluidAmount() - 1000, x, y, zLevel, 15, 47); if(gen.isActive()) { @@ -133,8 +133,8 @@ public class GuiCombustionGenerator extends GuiMachineBase { } //center tank - //RenderUtil.renderGuiTank(gen.fuelTank.getFluid(), 1000, Math.min(gen.fuelTank.getFluidAmount(), 1000), guiLeft + 81, guiTop + 5, zLevel, 14, 14); - RenderUtil.renderGuiTank(gen.getFuelTank().getFluid(), 1000, Math.min(gen.getFuelTank().getFluidAmount(), 1000), guiLeft + 81, guiTop + 5, zLevel, 14, 14); + RenderUtil + .renderGuiTank(gen.getFuelTank().getFluid(), 1000, Math.min(gen.getFuelTank().getFluidAmount(), 1000), guiLeft + 81, guiTop + 38, zLevel, 14, 14); } RenderUtil.bindTexture("enderio:textures/gui/combustionGen.png"); diff --git a/src/main/java/crazypants/enderio/machine/generator/stirling/GuiStirlingGenerator.java b/src/main/java/crazypants/enderio/machine/generator/stirling/GuiStirlingGenerator.java index a2e5b95c..e8f4387c 100644 --- a/src/main/java/crazypants/enderio/machine/generator/stirling/GuiStirlingGenerator.java +++ b/src/main/java/crazypants/enderio/machine/generator/stirling/GuiStirlingGenerator.java @@ -42,7 +42,7 @@ public class GuiStirlingGenerator extends GuiMachineBase { if(entity.getProgress() < 1 && entity.getProgress() > 0) { scaled = entity.getProgressScaled(12); - drawTexturedModalRect(sx + 80, sy + 65 - scaled, 176, 12 - scaled, 14, scaled + 2); + drawTexturedModalRect(sx + 80, sy + 64 - scaled, 176, 12 - scaled, 14, scaled + 2); } super.drawGuiContainerBackgroundLayer(par1, par2, par3); @@ -54,11 +54,12 @@ public class GuiStirlingGenerator extends GuiMachineBase { if(entity.isActive()) { output = entity.getPowerUsePerTick(); } - String txt = Lang.localize("stirlingGenerator.output") + " " + PowerDisplayUtil.formatPower(output) + " " + PowerDisplayUtil.abrevation() + PowerDisplayUtil.perTickStr(); + String txt = Lang.localize("stirlingGenerator.output") + " " + PowerDisplayUtil.formatPower(output) + " " + PowerDisplayUtil.abrevation() + + PowerDisplayUtil.perTickStr(); int sw = fr.getStringWidth(txt); fr.drawStringWithShadow(txt, guiLeft + xSize / 2 - sw / 2, y, ColorUtil.getRGB(Color.WHITE)); - txt = Lang.localize("stirlingGenerator.burnRate") + " " + (entity.getBurnTimeMultiplier()) + "x"; + txt = Lang.localize("stirlingGenerator.burnRate") + " " + (entity.getBurnTimeMultiplier()) + "x"; sw = fr.getStringWidth(txt); y += fr.FONT_HEIGHT + 3; fr.drawStringWithShadow(txt, guiLeft + xSize / 2 - sw / 2, y, ColorUtil.getRGB(Color.WHITE)); diff --git a/src/main/java/crazypants/enderio/machine/generator/zombie/GuiZombieGenerator.java b/src/main/java/crazypants/enderio/machine/generator/zombie/GuiZombieGenerator.java index 42825807..0a99c8e4 100644 --- a/src/main/java/crazypants/enderio/machine/generator/zombie/GuiZombieGenerator.java +++ b/src/main/java/crazypants/enderio/machine/generator/zombie/GuiZombieGenerator.java @@ -21,25 +21,24 @@ public class GuiZombieGenerator extends GuiMachineBase { private TileZombieGenerator gen; - public GuiZombieGenerator(InventoryPlayer inventory, TileZombieGenerator tileEntity) { super(tileEntity, new ContainerZombieGenerator(inventory, tileEntity)); gen = tileEntity; - + addToolTip(new GuiToolTip(new Rectangle(80, 21, 15, 47), "") { @Override protected void updateText() { text.clear(); - String heading = Lang.localize("zombieGenerator.fuelTank"); + String heading = Lang.localize("zombieGenerator.fuelTank"); text.add(heading); text.add(Fluids.toCapactityString(gen.fuelTank)); } }); - + } - + @Override protected boolean showRecipeButton() { return false; @@ -54,7 +53,7 @@ public class GuiZombieGenerator extends GuiMachineBase { int y = 19; int w = 15 + 4; int h = 47 + 4; - renderSlotHighlight(PULL_COLOR,x,y,w,h); + renderSlotHighlight(PULL_COLOR, x, y, w, h); } } @@ -73,21 +72,22 @@ public class GuiZombieGenerator extends GuiMachineBase { if(gen.isActive()) { output = gen.outputPerTick; } - String txt = Lang.localize("combustionGenerator.output") + " " + PowerDisplayUtil.formatPower(output) + " " + PowerDisplayUtil.abrevation() + PowerDisplayUtil.perTickStr(); + String txt = Lang.localize("combustionGenerator.output") + " " + PowerDisplayUtil.formatPower(output) + " " + PowerDisplayUtil.abrevation() + + PowerDisplayUtil.perTickStr(); int sw = fr.getStringWidth(txt); fr.drawStringWithShadow(txt, guiLeft + xSize / 2 - sw / 2, guiTop + fr.FONT_HEIGHT / 2 + 3, ColorUtil.getRGB(Color.WHITE)); int x = guiLeft + 80; - int y = guiTop + 21; + int y = guiTop + 21; if(gen.fuelTank.getFluidAmount() > 0) { - - RenderUtil.renderGuiTank(gen.fuelTank.getFluid(), gen.fuelTank.getCapacity(), gen.fuelTank.getFluidAmount(), x, y, zLevel, 15, 47); + + RenderUtil.renderGuiTank(gen.fuelTank.getFluid(), gen.fuelTank.getCapacity(), gen.fuelTank.getFluidAmount(), x, y, zLevel, 16, 47); if(gen.isActive()) { txt = gen.tickPerBucketOfFuel / 1000 + " t/Mb"; sw = fr.getStringWidth(txt); fr.drawStringWithShadow(txt, x - sw / 2 + 7, y + fr.FONT_HEIGHT / 2 + 46, ColorUtil.getRGB(Color.WHITE)); - } + } } RenderUtil.bindTexture("enderio:textures/gui/zombieGenerator.png"); diff --git a/src/main/java/crazypants/enderio/machine/killera/GuiKillerJoe.java b/src/main/java/crazypants/enderio/machine/killera/GuiKillerJoe.java index b1168a37..faae248a 100644 --- a/src/main/java/crazypants/enderio/machine/killera/GuiKillerJoe.java +++ b/src/main/java/crazypants/enderio/machine/killera/GuiKillerJoe.java @@ -35,41 +35,41 @@ public class GuiKillerJoe extends GuiMachineBase { private static final int XP10_ID = 34892; private TileKillerJoe joe; - + private IconButtonEIO xpB; private IconButtonEIO xp10B; public GuiKillerJoe(InventoryPlayer inventory, TileKillerJoe tileEntity) { super(tileEntity, new ContainerKillerJoe(inventory, tileEntity)); joe = tileEntity; - + addToolTip(new GuiToolTip(new Rectangle(18, 11, 15, 47), "") { @Override protected void updateText() { text.clear(); - String heading = Lang.localize("killerJoe.fuelTank"); + String heading = Lang.localize("killerJoe.fuelTank"); text.add(heading); text.add(Fluids.toCapactityString(joe.fuelTank)); } }); - - xpB = new IconButtonEIO(this, XP_ID, 128, 56, IconEIO.XP); + + xpB = new IconButtonEIO(this, XP_ID, 128, 56, IconEIO.XP); xpB.setToolTip(Lang.localize("killerJoe.giveXp.tooltip")); - - xp10B = new IconButtonEIO(this, XP10_ID, 148, 56, IconEIO.XP_PLUS); + + xp10B = new IconButtonEIO(this, XP10_ID, 148, 56, IconEIO.XP_PLUS); xp10B.setToolTip(Lang.localize("killerJoe.giveXp10.tooltip")); - + } - + @Override public void initGui() { - super.initGui(); + super.initGui(); xpB.onGuiInit(); xp10B.onGuiInit(); } - + @Override protected void actionPerformed(GuiButton b) { super.actionPerformed(b); @@ -81,14 +81,14 @@ public class GuiKillerJoe extends GuiMachineBase { SoundUtil.playClientSoundFX("random.orb", joe); } } - + @Override protected boolean showRecipeButton() { return false; } @Override - protected boolean renderPowerBar() { + protected boolean renderPowerBar() { return false; } @@ -101,7 +101,7 @@ public class GuiKillerJoe extends GuiMachineBase { int y = 9; int w = 15 + 4; int h = 47 + 4; - renderSlotHighlight(PULL_COLOR,x,y,w,h); + renderSlotHighlight(PULL_COLOR, x, y, w, h); } } @@ -115,13 +115,12 @@ public class GuiKillerJoe extends GuiMachineBase { drawTexturedModalRect(sx, sy, 0, 0, xSize, ySize); int x = guiLeft + 18; - int y = guiTop + 11; - if(joe.fuelTank.getFluidAmount() > 0) { - RenderUtil.renderGuiTank(joe.fuelTank.getFluid(), joe.fuelTank.getCapacity(), joe.fuelTank.getFluidAmount(), x, y, zLevel, 15, 47); - } - ExperienceBarRenderer.render(this, sx + 56, sy + 62, 65, joe.getContainer()); + int y = guiTop + 11; + if(joe.fuelTank.getFluidAmount() > 0) { + RenderUtil.renderGuiTank(joe.fuelTank.getFluid(), joe.fuelTank.getCapacity(), joe.fuelTank.getFluidAmount(), x, y, zLevel, 16, 47); + } + ExperienceBarRenderer.render(this, sx + 56, sy + 62, 65, joe.getContainer()); super.drawGuiContainerBackgroundLayer(par1, par2, par3); } - } diff --git a/src/main/java/crazypants/enderio/machine/power/BlockItemCapacitorBank.java b/src/main/java/crazypants/enderio/machine/power/BlockItemCapacitorBank.java index 4960e1d5..981ed93a 100644 --- a/src/main/java/crazypants/enderio/machine/power/BlockItemCapacitorBank.java +++ b/src/main/java/crazypants/enderio/machine/power/BlockItemCapacitorBank.java @@ -63,7 +63,7 @@ public class BlockItemCapacitorBank extends ItemBlock implements IEnergyContaine @Override public boolean showDurabilityBar(ItemStack itemStack) { - return true; + return itemStack.getItemDamage() != 1; } @Override @@ -79,7 +79,7 @@ public class BlockItemCapacitorBank extends ItemBlock implements IEnergyContaine int maxInput = TileCapacitorBank.BASE_CAP.getMaxEnergyReceived(); int energyReceived = Math.min(this.getMaxEnergyStored(container) - energy, Math.min(maxReceive, maxInput)); - if(!simulate) { + if(!simulate && container.getItemDamage() != 1) { energy += energyReceived; PowerHandlerUtil.setStoredEnergyForItem(container, energy); } @@ -92,7 +92,7 @@ public class BlockItemCapacitorBank extends ItemBlock implements IEnergyContaine int maxOutput = TileCapacitorBank.BASE_CAP.getMaxEnergyExtracted(); int energyExtracted = Math.min(energy, Math.min(maxExtract, maxOutput)); - if(!simulate) { + if(!simulate && container.getItemDamage() != 1) { energy -= energyExtracted; PowerHandlerUtil.setStoredEnergyForItem(container, energy); } diff --git a/src/main/java/crazypants/enderio/machine/power/GuiCapacitorBank.java b/src/main/java/crazypants/enderio/machine/power/GuiCapacitorBank.java index 72474d54..a62bdd22 100644 --- a/src/main/java/crazypants/enderio/machine/power/GuiCapacitorBank.java +++ b/src/main/java/crazypants/enderio/machine/power/GuiCapacitorBank.java @@ -36,7 +36,7 @@ public class GuiCapacitorBank extends GuiContainerBase { protected static final int CONFIG_ID = 377996104; - private static final int POWER_X = 8 + 21; + private static final int POWER_X = 11 + 18; private static final int POWER_Y = 9; private static final int POWER_WIDTH = 10; private static final int POWER_HEIGHT = 68; @@ -66,8 +66,8 @@ public class GuiCapacitorBank extends GuiContainerBase { this.capBank = te; xSize = 176 + 42; - - addToolTip(new GuiToolTip(new Rectangle(POWER_X - 21, POWER_Y, POWER_WIDTH, POWER_HEIGHT), "") { + + addToolTip(new GuiToolTip(new Rectangle(5, POWER_Y, POWER_WIDTH, POWER_HEIGHT), "") { @Override protected void updateText() { @@ -111,7 +111,6 @@ public class GuiCapacitorBank extends GuiContainerBase { }); outputRsButton.setTooltipKey("enderio.gui.capBank.outputRs"); - y += 20; configB = new IconButtonEIO(this, CONFIG_ID, x, y, IconEIO.IO_CONFIG_UP); configB.setToolTip(Lang.localize("gui.machine.ioMode.overlay.tooltip")); @@ -176,7 +175,7 @@ public class GuiCapacitorBank extends GuiContainerBase { x = guiLeft + inputX; y = guiTop + inputY; - maxInputTF = new GuiTextField(fontRenderer, x, y, 72, 16); + maxInputTF = new GuiTextField(fontRenderer, x, y, 68, 16); maxInputTF.setCanLoseFocus(true); maxInputTF.setMaxStringLength(10); maxInputTF.setFocused(false); @@ -184,7 +183,7 @@ public class GuiCapacitorBank extends GuiContainerBase { x = guiLeft + outputX; y = guiTop + outputY; - maxOutputTF = new GuiTextField(fontRenderer, x, y, 72, 16); + maxOutputTF = new GuiTextField(fontRenderer, x, y, 68, 16); maxOutputTF.setCanLoseFocus(true); maxOutputTF.setMaxStringLength(10); maxOutputTF.setFocused(true); @@ -265,11 +264,6 @@ public class GuiCapacitorBank extends GuiContainerBase { drawTexturedModalRect(sx, sy, 0, 0, this.xSize - 21, this.ySize); - //armor slots - //drawTexturedModalRect(sx - 21, sy + 24, 232, 0, 24, 81); - - - int i1 = capBank.getEnergyStoredScaled(POWER_HEIGHT); drawTexturedModalRect(sx + POWER_X, sy + BOTTOM_POWER_Y - i1, 176 + 21, 0, POWER_WIDTH, i1); @@ -310,7 +304,7 @@ public class GuiCapacitorBank extends GuiContainerBase { public void drawHoveringText(List par1List, int par2, int par3, FontRenderer font) { GL11.glPushAttrib(GL11.GL_ENABLE_BIT); GL11.glPushAttrib(GL11.GL_LIGHTING_BIT); - super.drawHoveringText(par1List, par2, par3, font); + super.drawHoveringText(par1List, par2 + 24, par3, font); GL11.glPopAttrib(); GL11.glPopAttrib(); } diff --git a/src/main/java/crazypants/enderio/machine/slicensplice/GuiSliceAndSplice.java b/src/main/java/crazypants/enderio/machine/slicensplice/GuiSliceAndSplice.java index 2e4f9000..b7724f79 100644 --- a/src/main/java/crazypants/enderio/machine/slicensplice/GuiSliceAndSplice.java +++ b/src/main/java/crazypants/enderio/machine/slicensplice/GuiSliceAndSplice.java @@ -6,7 +6,6 @@ import org.lwjgl.opengl.GL11; import crazypants.enderio.machine.AbstractMachineEntity; import crazypants.enderio.machine.GuiMachineBase; -import crazypants.enderio.machine.soul.ContainerSoulBinder; import crazypants.render.RenderUtil; public class GuiSliceAndSplice extends GuiMachineBase { @@ -33,7 +32,7 @@ public class GuiSliceAndSplice extends GuiMachineBase { int i1; i1 = tileEntity.getProgressScaled(24); - drawTexturedModalRect(k + 101, l + 47, 176, 14, i1 + 1, 16); + drawTexturedModalRect(k + 101, l + 46, 176, 14, i1 + 1, 16); super.drawGuiContainerBackgroundLayer(par1, par2, par3); } diff --git a/src/main/java/crazypants/enderio/machine/still/GuiVat.java b/src/main/java/crazypants/enderio/machine/still/GuiVat.java index 5968298a..9ba91c49 100644 --- a/src/main/java/crazypants/enderio/machine/still/GuiVat.java +++ b/src/main/java/crazypants/enderio/machine/still/GuiVat.java @@ -106,8 +106,8 @@ public class GuiVat extends GuiMachineBase { drawTexturedModalRect(guiLeft, guiTop, 0, 0, xSize, ySize); if(vat.getProgress() < 1 && vat.getProgress() > 0) { - int scaled = vat.getProgressScaled(12); - drawTexturedModalRect(guiLeft + 81, guiTop + 76 - scaled, 176, 12 - scaled, 14, scaled + 2); + int scaled = vat.getProgressScaled(14) + 1; + drawTexturedModalRect(guiLeft + 81, guiTop + 77 - scaled, 176, 14 - scaled, 14, scaled); IIcon inputIcon = null; if(vat.currentTaskInputFluid != null) { @@ -135,7 +135,7 @@ public class GuiVat extends GuiMachineBase { Fluid outputFluid; if(vat.outputTank.getFluidAmount() > 0) { outputFluid = vat.outputTank.getFluid().getFluid(); - } else { + } else { outputFluid = vat.currentTaskOutputFluid; } diff --git a/src/main/java/crazypants/enderio/machine/transceiver/gui/GeneralTab.java b/src/main/java/crazypants/enderio/machine/transceiver/gui/GeneralTab.java index 57fd02ba..7cd235cb 100644 --- a/src/main/java/crazypants/enderio/machine/transceiver/gui/GeneralTab.java +++ b/src/main/java/crazypants/enderio/machine/transceiver/gui/GeneralTab.java @@ -75,10 +75,10 @@ public class GeneralTab implements ITabPanel { String sendTxt = "Send"; int x = left + invRoot.x + 36 - fr.getStringWidth(sendTxt)/2; int y = top + invRoot.y - fr.FONT_HEIGHT - 3; - fr.drawString(sendTxt, x, y, ColorUtil.getRGB(Color.BLACK)); + fr.drawStringWithShadow(sendTxt, x, y, ColorUtil.getRGB(Color.WHITE)); String recText = "Receive"; x = left + invRoot.x + 72 + container.getItemBufferSpacing() + 36 - fr.getStringWidth(recText)/2; - fr.drawString(recText, x, y, ColorUtil.getRGB(Color.BLACK)); + fr.drawStringWithShadow(recText, x, y, ColorUtil.getRGB(Color.WHITE)); //Highlights parent.renderSlotHighlights(); diff --git a/src/main/java/crazypants/enderio/nei/AlloySmelterRecipeHandler.java b/src/main/java/crazypants/enderio/nei/AlloySmelterRecipeHandler.java index 12c4586f..16ad94da 100644 --- a/src/main/java/crazypants/enderio/nei/AlloySmelterRecipeHandler.java +++ b/src/main/java/crazypants/enderio/nei/AlloySmelterRecipeHandler.java @@ -12,6 +12,7 @@ import org.lwjgl.opengl.GL11; import codechicken.lib.gui.GuiDraw; import codechicken.nei.PositionedStack; import codechicken.nei.recipe.TemplateRecipeHandler; +import crazypants.enderio.gui.IconEIO; import crazypants.enderio.machine.alloy.AlloyRecipeManager; import crazypants.enderio.machine.alloy.GuiAlloySmelter; import crazypants.enderio.machine.power.PowerDisplayUtil; @@ -107,6 +108,8 @@ public class AlloySmelterRecipeHandler extends TemplateRecipeHandler { AlloySmelterRecipe recipe = (AlloySmelterRecipe) arecipes.get(recipeIndex); String energyString = PowerDisplayUtil.formatPower(recipe.getEnergy()) + " " + PowerDisplayUtil.abrevation(); GuiDraw.drawString(energyString, 100, 52, 0x808080, false); + + IconEIO.RECIPE.renderIcon(149, 32, 16, 16, 0, true); } public List getInputs(RecipeInput input) { diff --git a/src/main/java/crazypants/enderio/nei/EnchanterRecipeHandler.java b/src/main/java/crazypants/enderio/nei/EnchanterRecipeHandler.java index 4b6b9182..06fe0231 100644 --- a/src/main/java/crazypants/enderio/nei/EnchanterRecipeHandler.java +++ b/src/main/java/crazypants/enderio/nei/EnchanterRecipeHandler.java @@ -17,6 +17,7 @@ import net.minecraft.util.StatCollector; import codechicken.lib.gui.GuiDraw; import codechicken.nei.PositionedStack; import codechicken.nei.recipe.TemplateRecipeHandler; +import crazypants.enderio.gui.IconEIO; import crazypants.enderio.machine.enchanter.EnchanterRecipe; import crazypants.enderio.machine.enchanter.EnchanterRecipeManager; import crazypants.enderio.machine.enchanter.GuiEnchanter; @@ -125,6 +126,8 @@ public class EnchanterRecipeHandler extends TemplateRecipeHandler { String s = I18n.format("container.repair.cost", new Object[] { Integer.valueOf(cost) }); GuiDraw.drawStringC(s, 83, 46, 0x80FF20); } + + IconEIO.RECIPE.renderIcon(149, -3, 16, 16, 0, true); } public List getInputs(RecipeInput input) { diff --git a/src/main/java/crazypants/enderio/nei/SagMillRecipeHandler.java b/src/main/java/crazypants/enderio/nei/SagMillRecipeHandler.java index fe745ae8..08af8c2c 100644 --- a/src/main/java/crazypants/enderio/nei/SagMillRecipeHandler.java +++ b/src/main/java/crazypants/enderio/nei/SagMillRecipeHandler.java @@ -16,6 +16,7 @@ import codechicken.lib.gui.GuiDraw; import codechicken.nei.PositionedStack; import codechicken.nei.recipe.GuiRecipe; import codechicken.nei.recipe.TemplateRecipeHandler; +import crazypants.enderio.gui.IconEIO; import crazypants.enderio.machine.crusher.CrusherRecipeManager; import crazypants.enderio.machine.crusher.GrindingBall; import crazypants.enderio.machine.crusher.GuiCrusher; @@ -114,6 +115,8 @@ public class SagMillRecipeHandler extends TemplateRecipeHandler { MillRecipe recipe = (MillRecipe) arecipes.get(recipeIndex); String energyString = PowerDisplayUtil.formatPower(recipe.getEnergy()) + " " + PowerDisplayUtil.abrevation(); GuiDraw.drawString(energyString, 96, 33, 0x808080, false); + + IconEIO.RECIPE.renderIcon(149, 32, 16, 16, 0, true); } @Override diff --git a/src/main/java/crazypants/enderio/nei/SliceAndSpliceRecipeHandler.java b/src/main/java/crazypants/enderio/nei/SliceAndSpliceRecipeHandler.java index 0a401d2b..2f6fce59 100644 --- a/src/main/java/crazypants/enderio/nei/SliceAndSpliceRecipeHandler.java +++ b/src/main/java/crazypants/enderio/nei/SliceAndSpliceRecipeHandler.java @@ -14,6 +14,7 @@ import org.lwjgl.opengl.GL11; import codechicken.lib.gui.GuiDraw; import codechicken.nei.PositionedStack; import codechicken.nei.recipe.TemplateRecipeHandler; +import crazypants.enderio.gui.IconEIO; import crazypants.enderio.machine.power.PowerDisplayUtil; import crazypants.enderio.machine.recipe.IRecipe; import crazypants.enderio.machine.recipe.RecipeInput; @@ -105,6 +106,8 @@ public class SliceAndSpliceRecipeHandler extends TemplateRecipeHandler { SliceAndSpliceRecipe recipe = (SliceAndSpliceRecipe) arecipes.get(recipeIndex); String energyString = PowerDisplayUtil.formatPower(recipe.getEnergy()) + " " + PowerDisplayUtil.abrevation(); GuiDraw.drawString(energyString, 100, 57, 0x808080, false); + + IconEIO.RECIPE.renderIcon(149, 32, 16, 16, 0, true); } public List getInputs(RecipeInput input) { diff --git a/src/main/java/crazypants/enderio/nei/SoulBinderRecipeHandler.java b/src/main/java/crazypants/enderio/nei/SoulBinderRecipeHandler.java index 356e0b84..66beb3cb 100644 --- a/src/main/java/crazypants/enderio/nei/SoulBinderRecipeHandler.java +++ b/src/main/java/crazypants/enderio/nei/SoulBinderRecipeHandler.java @@ -17,6 +17,7 @@ import codechicken.nei.PositionedStack; import codechicken.nei.recipe.TemplateRecipeHandler; import crazypants.enderio.EnderIO; import crazypants.enderio.ModObject; +import crazypants.enderio.gui.IconEIO; import crazypants.enderio.machine.IMachineRecipe; import crazypants.enderio.machine.MachineRecipeRegistry; import crazypants.enderio.machine.power.PowerDisplayUtil; @@ -131,6 +132,8 @@ public class SoulBinderRecipeHandler extends TemplateRecipeHandler { String s = I18n.format("container.repair.cost", new Object[] { Integer.valueOf(cost) }); GuiDraw.drawStringC(s, 83, 55, 0x80FF20); } + + IconEIO.RECIPE.renderIcon(149, 32, 16, 16, 0, true); } private static final ArrayList EMPTY_VIAL_OUTPUT = new ArrayList(); diff --git a/src/main/java/crazypants/enderio/nei/VatRecipeHandler.java b/src/main/java/crazypants/enderio/nei/VatRecipeHandler.java index eb08c39d..02901310 100644 --- a/src/main/java/crazypants/enderio/nei/VatRecipeHandler.java +++ b/src/main/java/crazypants/enderio/nei/VatRecipeHandler.java @@ -8,29 +8,29 @@ import java.util.List; import net.minecraft.client.gui.inventory.GuiContainer; import net.minecraft.item.ItemStack; import net.minecraftforge.fluids.Fluid; -import net.minecraftforge.fluids.FluidContainerRegistry; import net.minecraftforge.fluids.FluidStack; import org.lwjgl.opengl.GL11; import codechicken.lib.gui.GuiDraw; import codechicken.nei.PositionedStack; +import codechicken.nei.recipe.GuiCraftingRecipe; import codechicken.nei.recipe.GuiRecipe; -import codechicken.nei.recipe.RecipeInfo; +import codechicken.nei.recipe.GuiUsageRecipe; import codechicken.nei.recipe.TemplateRecipeHandler; +import crazypants.enderio.gui.IconEIO; import crazypants.enderio.machine.power.PowerDisplayUtil; import crazypants.enderio.machine.recipe.IRecipe; import crazypants.enderio.machine.recipe.RecipeInput; import crazypants.enderio.machine.still.GuiVat; import crazypants.enderio.machine.still.VatRecipeManager; import crazypants.render.RenderUtil; +import crazypants.util.FluidUtil; public class VatRecipeHandler extends TemplateRecipeHandler { private Rectangle inTankBounds = new Rectangle(25, 1, 15, 47); private Rectangle outTankBounds = new Rectangle(127, 1, 15, 47); - private Rectangle inTankBoundsLower = new Rectangle(25, 70, 15, 47); - private Rectangle outTankBoundsLower = new Rectangle(127, 70, 15, 47); public VatRecipeHandler() { } @@ -64,65 +64,77 @@ public class VatRecipeHandler extends TemplateRecipeHandler { transferRects.add(new TemplateRecipeHandler.RecipeTransferRect(new Rectangle(149, 32, 16, 16), "EnderIOVat", new Object[0])); } - @Override - public void loadCraftingRecipes(final ItemStack result) { - - if(result == null) { - return; - } - if(FluidContainerRegistry.isFilledContainer(result)) { - FluidStack fluid = FluidContainerRegistry.getFluidForFilledItem(result); - if(fluid != null) { - List recipes = VatRecipeManager.getInstance().getRecipes(); - for (IRecipe recipe : recipes) { - FluidStack output = recipe.getOutputs()[0].getFluidOutput(); - if(output.isFluidEqual(fluid)) { - InnerVatRecipe res = new InnerVatRecipe(recipe.getEnergyRequired(), recipe.getInputs(), output); - arecipes.add(res); - } - } - } - } - } - @Override public void loadCraftingRecipes(String outputId, Object... results) { - if(outputId.equals("EnderIOVat") && getClass() == VatRecipeHandler.class) { + if(outputId.equals("liquid")) { + loadCraftingRecipes((FluidStack) results[0]); + } else if(outputId.equals("EnderIOVat") && getClass() == VatRecipeHandler.class) { List recipes = VatRecipeManager.getInstance().getRecipes(); for (IRecipe recipe : recipes) { FluidStack output = recipe.getOutputs()[0].getFluidOutput(); InnerVatRecipe res = new InnerVatRecipe(recipe.getEnergyRequired(), recipe.getInputs(), output); arecipes.add(res); } - } else { super.loadCraftingRecipes(outputId, results); } } @Override - public void loadUsageRecipes(ItemStack ingredient) { + public void loadCraftingRecipes(ItemStack result) { + FluidStack fluid = FluidUtil.getFluidFromItem(result); + if(fluid != null) { + loadCraftingRecipes(fluid); + } + } + + public void loadCraftingRecipes(FluidStack result) { List recipes = VatRecipeManager.getInstance().getRecipes(); for (IRecipe recipe : recipes) { - boolean addRecipe = false; - if(recipe.isValidInput(0, ingredient) || recipe.isValidInput(1, ingredient)) { - addRecipe = true; - } else if(FluidContainerRegistry.isFilledContainer(ingredient)) { - FluidStack fluid = FluidContainerRegistry.getFluidForFilledItem(ingredient); - if(fluid != null) { - if(recipe.isValidInput(fluid)) { - addRecipe = true; - } - } + FluidStack output = recipe.getOutputs()[0].getFluidOutput(); + if(output.isFluidEqual(result)) { + InnerVatRecipe res = new InnerVatRecipe(recipe.getEnergyRequired(), recipe.getInputs(), output); + arecipes.add(res); } - if(addRecipe) { + } + } + + @Override + public void loadUsageRecipes(String inputId, Object... ingredients) { + if(inputId.equals("liquid")) { + loadUsageRecipes((FluidStack) ingredients[0]); + } else { + super.loadUsageRecipes(inputId, ingredients); + } + } + + @Override + public void loadUsageRecipes(ItemStack ingredient) { + FluidStack fluid = FluidUtil.getFluidFromItem(ingredient); + if(fluid != null) { + loadUsageRecipes(fluid); + } + + List recipes = VatRecipeManager.getInstance().getRecipes(); + for (IRecipe recipe : recipes) { + if(recipe.isValidInput(0, ingredient) || recipe.isValidInput(1, ingredient)) { FluidStack output = recipe.getOutputs()[0].getFluidOutput(); InnerVatRecipe res = new InnerVatRecipe(recipe.getEnergyRequired(), recipe.getInputs(), output); res.setIngredientPermutation(res.inputs, ingredient); arecipes.add(res); } } + } + public void loadUsageRecipes(FluidStack ingredient) { + List recipes = VatRecipeManager.getInstance().getRecipes(); + for (IRecipe recipe : recipes) { + if(recipe.isValidInput(ingredient)) { + FluidStack output = recipe.getOutputs()[0].getFluidOutput(); + InnerVatRecipe res = new InnerVatRecipe(recipe.getEnergyRequired(), recipe.getInputs(), output); + arecipes.add(res); + } + } } @Override @@ -136,7 +148,8 @@ public class VatRecipeHandler extends TemplateRecipeHandler { public void drawExtras(int recipeIndex) { InnerVatRecipe rec = (InnerVatRecipe) arecipes.get(recipeIndex); if(rec.inFluid != null && rec.inFluid.getFluid() != null) { - RenderUtil.renderGuiTank(rec.inFluid, rec.inFluid.amount, rec.inFluid.amount, inTankBounds.x, inTankBounds.y, 0, inTankBounds.width, inTankBounds.height); + RenderUtil.renderGuiTank(rec.inFluid, rec.inFluid.amount, rec.inFluid.amount, inTankBounds.x, inTankBounds.y, 0, inTankBounds.width, + inTankBounds.height); } if(rec.result != null && rec.result.getFluid() != null) { @@ -154,6 +167,8 @@ public class VatRecipeHandler extends TemplateRecipeHandler { String str = "x" + mult; GuiDraw.drawStringC(str, ps.relx + 8, ps.rely + 19, 0x808080, false); } + + IconEIO.RECIPE.renderIcon(149, 32, 16, 16, 0, true); } @Override @@ -162,40 +177,69 @@ public class VatRecipeHandler extends TemplateRecipeHandler { } @Override - public List handleTooltip(GuiRecipe gui, List arg1, int recipeIndex) { - + public List handleTooltip(GuiRecipe gui, List currenttip, int recipeIndex) { + InnerVatRecipe rec = (InnerVatRecipe) arecipes.get(recipeIndex); Point pos = GuiDraw.getMousePosition(); + Point offset = gui.getRecipePosition(recipeIndex); + Point relMouse = new Point(pos.x - ((gui.width - 176) / 2) - offset.x, pos.y - ((gui.height - 166) / 2) - offset.y); - int[] offset = RecipeInfo.getGuiOffset(gui); - Point relMouse = new Point(pos.x - ((gui.width - 176) / 2) - offset[0], pos.y - ((gui.height - 166) / 2) - offset[1]); - - if(mouseInBounds(relMouse)) { - if(recipeIndex % 2 == 0 && inTankBounds.union(outTankBounds).contains(relMouse)) { - return getVatFluid(recipeIndex, arg1, inTankBounds.contains(relMouse)); - } - else if(recipeIndex % 2 == 1 && inTankBoundsLower.union(outTankBoundsLower).contains(relMouse)) { - return getVatFluid(recipeIndex, arg1, inTankBoundsLower.contains(relMouse)); + if(inTankBounds.contains(relMouse) || outTankBounds.contains(relMouse)) { + if(inTankBounds.contains(relMouse)) { + if(rec.inFluid != null && rec.inFluid.getFluid() != null) { + currenttip.add(rec.inFluid.getFluid().getLocalizedName(rec.inFluid)); + } + } else { + if(rec.result != null && rec.result.getFluid() != null) { + currenttip.add(rec.result.getFluid().getLocalizedName(rec.result)); + } } } - return super.handleTooltip(gui, arg1, recipeIndex); + return super.handleTooltip(gui, currenttip, recipeIndex); } - private boolean mouseInBounds(Point mouse) { - return inTankBounds.contains(mouse) || outTankBounds.contains(mouse) || inTankBoundsLower.contains(mouse) || outTankBoundsLower.contains(mouse); - } - - private List getVatFluid(int index, List list, boolean in) { - InnerVatRecipe rec = (InnerVatRecipe) arecipes.get(index); - if(in) { - if(rec.inFluid != null && rec.inFluid.getFluid() != null) { - list.add(rec.inFluid.getFluid().getLocalizedName(rec.inFluid)); + @Override + public boolean mouseClicked(GuiRecipe gui, int button, int recipeIndex) { + if(button == 0) { + if(this.transferFluidTanks(gui, recipeIndex, false)) { + return true; } - } else { - if(rec.result != null && rec.result.getFluid() != null) { - list.add(rec.result.getFluid().getLocalizedName(rec.result)); + } else if(button == 1) { + if(this.transferFluidTanks(gui, recipeIndex, true)) { + return true; } } - return list; + return super.mouseClicked(gui, button, recipeIndex); + } + + private boolean transferFluidTanks(GuiRecipe gui, int recipeIndex, boolean usage) { + InnerVatRecipe rec = (InnerVatRecipe) arecipes.get(recipeIndex); + Point pos = GuiDraw.getMousePosition(); + Point offset = gui.getRecipePosition(recipeIndex); + Point relMouse = new Point(pos.x - ((gui.width - 176) / 2) - offset.x, pos.y - ((gui.height - 166) / 2) - offset.y); + + if(inTankBounds.contains(relMouse)) { + transferFluidTank(rec.inFluid, usage); + } + else if(outTankBounds.contains(relMouse)) { + transferFluidTank(rec.result, usage); + } + return false; + } + + private boolean transferFluidTank(FluidStack tank, boolean usage) { + if(tank != null && tank.amount > 0) { + if(usage) { + if(!GuiUsageRecipe.openRecipeGui("liquid", new Object[] { tank.copy() })) { + return false; + } + } else { + if(!GuiCraftingRecipe.openRecipeGui("liquid", new Object[] { tank.copy() })) { + return false; + } + } + return true; + } + return false; } public List getInputs(RecipeInput input) { @@ -248,11 +292,11 @@ public class VatRecipeHandler extends TemplateRecipeHandler { } inputs = new ArrayList(); - - if (inputsOne != null) { + + if(inputsOne != null) { inputs.add(new PositionedStack(inputsOne, 51, 1)); } - if (inputsTwo != null) { + if(inputsTwo != null) { inputs.add(new PositionedStack(inputsTwo, 100, 1)); } diff --git a/src/main/java/crazypants/render/RenderUtil.java b/src/main/java/crazypants/render/RenderUtil.java index 0c890850..0528b0d3 100644 --- a/src/main/java/crazypants/render/RenderUtil.java +++ b/src/main/java/crazypants/render/RenderUtil.java @@ -43,11 +43,11 @@ import crazypants.vecmath.Vertex; public class RenderUtil { - public static final Vector4f DEFAULT_TEXT_SHADOW_COL = new Vector4f(0.33f,0.33f,0.33f,0.33f); + public static final Vector4f DEFAULT_TEXT_SHADOW_COL = new Vector4f(0.33f, 0.33f, 0.33f, 0.33f); - public static final Vector4f DEFAULT_TXT_COL = new Vector4f(1,1,1,1); + public static final Vector4f DEFAULT_TXT_COL = new Vector4f(1, 1, 1, 1); - public static final Vector4f DEFAULT_TEXT_BG_COL = new Vector4f(0.275f,0.08f,0.4f, 0.75f); + public static final Vector4f DEFAULT_TEXT_BG_COL = new Vector4f(0.275f, 0.08f, 0.4f, 0.75f); public static final Vector3d UP_V = new Vector3d(0, 1, 0); @@ -122,7 +122,7 @@ public class RenderUtil { } return brightnessPerSide; } - + public static IIcon[] getBlockTextures(Block block, int meta) { IIcon[] icons = new IIcon[6]; int i = 0; @@ -132,13 +132,13 @@ public class RenderUtil { } return icons; } - + public static IIcon[] getBlockTextures(IBlockAccess world, int x, int y, int z) { Block block = world.getBlock(x, y, z); IIcon[] icons = new IIcon[6]; int i = 0; for (ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS) { - icons[i] = block.getIcon(world,x,y,z,dir.ordinal()); + icons[i] = block.getIcon(world, x, y, z, dir.ordinal()); i++; } return icons; @@ -520,48 +520,61 @@ public class RenderUtil { } } - double fullness = (double) amount / (double) capacity; - int fluidHeight = (int) Math.round(height * fullness); + int renderAmount = (int) Math.max(Math.min(height, amount * height / capacity), 1); + int posY = (int) (y + height - renderAmount); RenderUtil.bindBlockTexture(); - y = y + (47 - fluidHeight); - GL11.glColor4f(1, 1, 1, 0.75f); + int color = fluid.getFluid().getColor(fluid); + GL11.glColor3ub((byte) (color >> 16 & 0xFF), (byte) (color >> 8 & 0xFF), (byte) (color & 0xFF)); + GL11.glEnable(GL11.GL_BLEND); - drawTexturedModelRectFromIcon(x, y, zLevel, icon, width, fluidHeight); + for (int i = 0; i < width; i += 16) { + for (int j = 0; j < renderAmount; j += 16) { + int drawWidth = (int) Math.min(width - i, 16); + int drawHeight = Math.min(renderAmount - j, 16); + + int drawX = (int) (x + i); + int drawY = posY + j; + + double minU = icon.getMinU(); + double maxU = icon.getMaxU(); + double minV = icon.getMinV(); + double maxV = icon.getMaxV(); + + Tessellator tessellator = Tessellator.instance; + tessellator.startDrawingQuads(); + tessellator.addVertexWithUV(drawX, drawY + drawHeight, 0, minU, minV + (maxV - minV) * drawHeight / 16F); + tessellator.addVertexWithUV(drawX + drawWidth, drawY + drawHeight, 0, minU + (maxU - minU) * drawWidth / 16F, minV + (maxV - minV) * drawHeight / 16F); + tessellator.addVertexWithUV(drawX + drawWidth, drawY, 0, minU + (maxU - minU) * drawWidth / 16F, minV); + tessellator.addVertexWithUV(drawX, drawY, 0, minU, minV); + tessellator.draw(); + } + } GL11.glDisable(GL11.GL_BLEND); } - public static void drawTexturedModelRectFromIcon(double x, double y, double z, IIcon icon, double width, double height) { - Tessellator tessellator = Tessellator.instance; - tessellator.startDrawingQuads(); - tessellator.addVertexWithUV(x, y + height, z, icon.getMinU(), icon.getMaxV()); - tessellator.addVertexWithUV(x + width, y + height, z, icon.getMaxU(), icon.getMaxV()); - tessellator.addVertexWithUV(x + width, y, z, icon.getMaxU(), icon.getMinV()); - tessellator.addVertexWithUV(x, y, z, icon.getMinU(), icon.getMinV()); - tessellator.draw(); - } - public static void drawBillboardedText(Vector3f pos, String text, float size) { drawBillboardedText(pos, text, size, DEFAULT_TXT_COL, true, DEFAULT_TEXT_SHADOW_COL, true, DEFAULT_TEXT_BG_COL); } - + public static void drawBillboardedText(Vector3f pos, String text, float size, Vector4f bgCol) { drawBillboardedText(pos, text, size, DEFAULT_TXT_COL, true, DEFAULT_TEXT_SHADOW_COL, true, bgCol); } - - public static void drawBillboardedText(Vector3f pos, String text, float size, Vector4f txtCol, boolean drawShadow, Vector4f shadowCol, boolean drawBackground, Vector4f bgCol) { + + public static void drawBillboardedText(Vector3f pos, String text, float size, Vector4f txtCol, boolean drawShadow, Vector4f shadowCol, + boolean drawBackground, Vector4f bgCol) { GL11.glPushMatrix(); - GL11.glTranslatef(pos.x, pos.y,pos.z); + GL11.glTranslatef(pos.x, pos.y, pos.z); glRotatef(180, 1, 0, 0); - FontRenderer fnt = Minecraft.getMinecraft().fontRenderer; - float scale = size / fnt.FONT_HEIGHT; + FontRenderer fnt = Minecraft.getMinecraft().fontRenderer; + float scale = size / fnt.FONT_HEIGHT; GL11.glScalef(scale, scale, scale); glRotatef(RenderManager.instance.playerViewY + 180, 0.0F, 1.0F, 0.0F); glRotatef(-RenderManager.instance.playerViewX, 1.0F, 0.0F, 0.0F); glTranslatef(-fnt.getStringWidth(text) / 2, 0, 0); - if(drawBackground) { + if(drawBackground) { renderBackground(fnt, text, bgCol); } fnt.drawString(text, 0, 0, ColorUtil.getRGBA(txtCol)); @@ -573,7 +586,7 @@ public class RenderUtil { RenderUtil.bindBlockTexture(); } - + public static void renderBackground(FontRenderer fnt, String toRender, Vector4f color) { glPushAttrib(GL_ALL_ATTRIB_BITS); glDisable(GL_TEXTURE_2D); @@ -584,7 +597,7 @@ public class RenderUtil { glDepthMask(false); RenderHelper.disableStandardItemLighting(); OpenGlHelper.glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_ONE, GL_ZERO); // stop random disappearing - + float width = (float) fnt.getStringWidth(toRender); float height = (float) fnt.FONT_HEIGHT; float padding = 2f; @@ -596,7 +609,7 @@ public class RenderUtil { tessellator.addVertex(width + padding, height + padding, 0); tessellator.addVertex(width + padding, -padding, 0); tessellator.draw(); - + glPopAttrib(); } diff --git a/src/main/java/crazypants/util/FluidUtil.java b/src/main/java/crazypants/util/FluidUtil.java index 507692ce..2a540c69 100644 --- a/src/main/java/crazypants/util/FluidUtil.java +++ b/src/main/java/crazypants/util/FluidUtil.java @@ -5,16 +5,19 @@ import java.util.HashMap; import java.util.List; import java.util.Map; +import net.minecraft.block.Block; import net.minecraft.init.Items; import net.minecraft.item.ItemPotion; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; import net.minecraft.world.IBlockAccess; import net.minecraftforge.common.util.ForgeDirection; +import net.minecraftforge.fluids.Fluid; import net.minecraftforge.fluids.FluidContainerRegistry; -import net.minecraftforge.fluids.FluidRegistry; import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.fluids.FluidTankInfo; +import net.minecraftforge.fluids.IFluidBlock; +import net.minecraftforge.fluids.IFluidContainerItem; import net.minecraftforge.fluids.IFluidHandler; import cpw.mods.fml.common.Loader; import crazypants.enderio.Log; @@ -72,16 +75,24 @@ public class FluidUtil { return null; } - public static FluidStack getFluidFromItem(ItemStack item) { - FluidStack fluid = FluidContainerRegistry.getFluidForFilledItem(item); - if(fluid == null) { - if(item.getItem() == Items.water_bucket) { - fluid = new FluidStack(FluidRegistry.WATER, 1000); - } else if(item.getItem() == Items.lava_bucket) { - fluid = new FluidStack(FluidRegistry.LAVA, 1000); + public static FluidStack getFluidFromItem(ItemStack stack) { + if(stack != null) { + FluidStack fluidStack = null; + if(stack.getItem() instanceof IFluidContainerItem) { + fluidStack = ((IFluidContainerItem) stack.getItem()).getFluid(stack); } + if(fluidStack == null) { + fluidStack = FluidContainerRegistry.getFluidForFilledItem(stack); + } + if(fluidStack == null && Block.getBlockFromItem(stack.getItem()) instanceof IFluidBlock) { + Fluid fluid = ((IFluidBlock) Block.getBlockFromItem(stack.getItem())).getFluid(); + if(fluid != null) { + return new FluidStack(fluid, 1000); + } + } + return fluidStack; } - return fluid; + return null; } public static ItemStack getEmptyContainer(ItemStack stack) { @@ -132,13 +143,13 @@ public class FluidUtil { IFluidHandler target = getFluidHandler(te.getWorldObj(), loc); if(target == null) { return false; - } + } FluidTankInfo[] infos = from.getTankInfo(fromDir); boolean res = false; - if(infos != null) { + if(infos != null) { for (FluidTankInfo info : infos) { if(info.fluid != null && info.fluid.amount > 0 && from.canDrain(fromDir, info.fluid.getFluid())) { - FluidStack maxDrain = new FluidStack(info.fluid.getFluid(), maxVolume); + FluidStack maxDrain = new FluidStack(info.fluid.getFluid(), maxVolume); FluidStack canDrain = from.drain(fromDir, maxDrain, false); if(canDrain != null && canDrain.amount > 0) { int filled = target.fill(fromDir.getOpposite(), canDrain, true); @@ -148,7 +159,7 @@ public class FluidUtil { } } } - return res; + return res; } }