diff --git a/src/main/java/com/hbm/handler/nei/RefineryRecipeHandler.java b/src/main/java/com/hbm/handler/nei/RefineryRecipeHandler.java index f085e4ebe..8818a3d9d 100644 --- a/src/main/java/com/hbm/handler/nei/RefineryRecipeHandler.java +++ b/src/main/java/com/hbm/handler/nei/RefineryRecipeHandler.java @@ -161,8 +161,8 @@ public class RefineryRecipeHandler extends TemplateRecipeHandler implements ICom transferRectsGui = new LinkedList(); guiGui = new LinkedList>(); - transferRects.add(new RecipeTransferRect(new Rectangle(138 - 1 - 36 - 27, 23, 36, 18), "refinery")); - transferRectsGui.add(new RecipeTransferRect(new Rectangle(18 * 2 + 2 + 36, 89 - 7 - 11 - 11, 18 * 4, 18), "refinery")); + transferRects.add(new RecipeTransferRect(new Rectangle(48, 5, 31, 101), "refinery")); + transferRectsGui.add(new RecipeTransferRect(new Rectangle(48, 5, 31, 101), "refinery")); guiGui.add(GUIMachineRefinery.class); RecipeTransferRectHandler.registerRectsToGuis(getRecipeTransferRectGuis(), transferRects); RecipeTransferRectHandler.registerRectsToGuis(guiGui, transferRectsGui); diff --git a/src/main/java/com/hbm/inventory/container/ContainerMachineRefinery.java b/src/main/java/com/hbm/inventory/container/ContainerMachineRefinery.java index 000a58cf1..b47d2b182 100644 --- a/src/main/java/com/hbm/inventory/container/ContainerMachineRefinery.java +++ b/src/main/java/com/hbm/inventory/container/ContainerMachineRefinery.java @@ -19,40 +19,40 @@ public class ContainerMachineRefinery extends Container { testNuke = tedf; //Battery - this.addSlotToContainer(new Slot(tedf, 0, 8, 90)); + this.addSlotToContainer(new Slot(tedf, 0, 186, 72)); //Canister Input - this.addSlotToContainer(new Slot(tedf, 1, 35, 90)); + this.addSlotToContainer(new Slot(tedf, 1, 8, 99)); //Canister Output - this.addSlotToContainer(new SlotTakeOnly(tedf, 2, 35, 108)); + this.addSlotToContainer(new SlotTakeOnly(tedf, 2, 8, 119)); //Heavy Oil Input - this.addSlotToContainer(new Slot(tedf, 3, 80, 90)); + this.addSlotToContainer(new Slot(tedf, 3, 86, 99)); //Heavy Oil Output - this.addSlotToContainer(new SlotTakeOnly(tedf, 4, 80, 108)); + this.addSlotToContainer(new SlotTakeOnly(tedf, 4, 86, 119)); //Naphtha Input - this.addSlotToContainer(new Slot(tedf, 5, 98, 90)); + this.addSlotToContainer(new Slot(tedf, 5, 106, 99)); //Naphtha Output - this.addSlotToContainer(new SlotTakeOnly(tedf, 6, 98, 108)); + this.addSlotToContainer(new SlotTakeOnly(tedf, 6, 106, 119)); //Light Oil Input - this.addSlotToContainer(new Slot(tedf, 7, 116, 90)); + this.addSlotToContainer(new Slot(tedf, 7, 126, 99)); //Light Oil Output - this.addSlotToContainer(new SlotTakeOnly(tedf, 8, 116, 108)); + this.addSlotToContainer(new SlotTakeOnly(tedf, 8, 126, 119)); //Petroleum Input - this.addSlotToContainer(new Slot(tedf, 9, 134, 90)); + this.addSlotToContainer(new Slot(tedf, 9, 146, 99)); //Petroleum Output - this.addSlotToContainer(new SlotTakeOnly(tedf, 10, 134, 108)); + this.addSlotToContainer(new SlotTakeOnly(tedf, 10, 146, 119)); //Sulfur Output - this.addSlotToContainer(new SlotTakeOnly(tedf, 11, 152, 36)); + this.addSlotToContainer(new SlotTakeOnly(tedf, 11, 58, 119)); //Fluid ID - this.addSlotToContainer(new Slot(tedf, 12, 8, 108)); + this.addSlotToContainer(new Slot(tedf, 12, 186, 106)); for(int i = 0; i < 3; i++) { for(int j = 0; j < 9; j++) { - this.addSlotToContainer(new Slot(invPlayer, j + i * 9 + 9, 8 + j * 18, 84 + i * 18 + 56)); + this.addSlotToContainer(new Slot(invPlayer, j + i * 9 + 9, 8 + j * 18, 150 + i * 18)); } } for(int i = 0; i < 9; i++) { - this.addSlotToContainer(new Slot(invPlayer, i, 8 + i * 18, 142 + 56)); + this.addSlotToContainer(new Slot(invPlayer, i, 8 + i * 18, 208)); } } diff --git a/src/main/java/com/hbm/inventory/gui/GUIMachineRefinery.java b/src/main/java/com/hbm/inventory/gui/GUIMachineRefinery.java index 04b901816..0db5f2f29 100644 --- a/src/main/java/com/hbm/inventory/gui/GUIMachineRefinery.java +++ b/src/main/java/com/hbm/inventory/gui/GUIMachineRefinery.java @@ -1,9 +1,14 @@ package com.hbm.inventory.gui; +import com.hbm.inventory.FluidStack; +import com.hbm.inventory.fluid.tank.FluidTank; +import com.hbm.inventory.recipes.RefineryRecipes; +import com.hbm.util.Tuple; +import net.minecraft.client.renderer.OpenGlHelper; +import net.minecraft.item.ItemStack; import org.lwjgl.opengl.GL11; import com.hbm.inventory.container.ContainerMachineRefinery; -import com.hbm.inventory.fluid.Fluids; import com.hbm.lib.RefStrings; import com.hbm.tileentity.machine.oil.TileEntityMachineRefinery; @@ -12,6 +17,8 @@ import net.minecraft.client.resources.I18n; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.util.ResourceLocation; +import java.awt.Color; + public class GUIMachineRefinery extends GuiInfoContainer { private static ResourceLocation texture = new ResourceLocation(RefStrings.MODID + ":textures/gui/processing/gui_refinery.png"); @@ -21,46 +28,100 @@ public class GUIMachineRefinery extends GuiInfoContainer { super(new ContainerMachineRefinery(invPlayer, tedf)); refinery = tedf; - this.xSize = 176; - this.ySize = 222; + this.xSize = 209; + this.ySize = 231; } @Override public void drawScreen(int mouseX, int mouseY, float f) { super.drawScreen(mouseX, mouseY, f); - refinery.tanks[0].renderTankInfo(this, mouseX, mouseY, guiLeft + 26, guiTop + 70 - 52, 34, 52); - refinery.tanks[1].renderTankInfo(this, mouseX, mouseY, guiLeft + 80, guiTop + 70 - 52, 16, 52); - refinery.tanks[2].renderTankInfo(this, mouseX, mouseY, guiLeft + 98, guiTop + 70 - 52, 16, 52); - refinery.tanks[3].renderTankInfo(this, mouseX, mouseY, guiLeft + 116, guiTop + 70 - 52, 16, 52); - refinery.tanks[4].renderTankInfo(this, mouseX, mouseY, guiLeft + 134, guiTop + 70 - 52, 16, 52); - this.drawElectricityInfo(this, mouseX, mouseY, guiLeft + 8, guiTop + 70 - 52, 16, 52, refinery.power, refinery.maxPower); + refinery.tanks[0].renderTankInfo(this, mouseX, mouseY, guiLeft + 30, guiTop + 27, 21, 104); // Render tooltip for column. + refinery.tanks[1].renderTankInfo(this, mouseX, mouseY, guiLeft + 86, guiTop + 42, 16, 52); + refinery.tanks[2].renderTankInfo(this, mouseX, mouseY, guiLeft + 106, guiTop + 42, 16, 52); + refinery.tanks[3].renderTankInfo(this, mouseX, mouseY, guiLeft + 126, guiTop + 42, 16, 52); + refinery.tanks[4].renderTankInfo(this, mouseX, mouseY, guiLeft + 146, guiTop + 42, 16, 52); + this.drawElectricityInfo(this, mouseX, mouseY, guiLeft + 186, guiTop + 18, 16, 52, refinery.power, refinery.maxPower); } @Override protected void drawGuiContainerForegroundLayer(int i, int j) { String name = this.refinery.hasCustomInventoryName() ? this.refinery.getInventoryName() : I18n.format(this.refinery.getInventoryName()); - this.fontRendererObj.drawString(name, this.xSize / 2 - this.fontRendererObj.getStringWidth(name) / 2, 6, 4210752); - this.fontRendererObj.drawString(I18n.format("container.inventory"), 8, this.ySize - 96 + 2, 4210752); + this.fontRendererObj.drawString(name, this.xSize / 2 - 34/2 - this.fontRendererObj.getStringWidth(name) / 2, 6, 4210752); + this.fontRendererObj.drawString(I18n.format("container.inventory"), 8, this.ySize - 96 + 4, 4210752); } @Override protected void drawGuiContainerBackgroundLayer(float p_146976_1_, int p_146976_2_, int p_146976_3_) { GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); Minecraft.getMinecraft().getTextureManager().bindTexture(texture); - drawTexturedModalRect(guiLeft, guiTop, 0, 0, xSize, ySize); - - if(refinery.tanks[0].getTankType() == Fluids.HOTCRACKOIL) - drawTexturedModalRect(guiLeft + 64, guiTop + 20, 192, 0, 12, 26); + func_146110_a(guiLeft, guiTop, 0, 0, xSize, ySize, 350, 256); - int j = (int)refinery.getPowerScaled(52); - drawTexturedModalRect(guiLeft + 8, guiTop + 70 - j, 176, 52 - j, 16, j); - - refinery.tanks[0].renderTank(guiLeft + 26, guiTop + 70, this.zLevel, 34, 52); - refinery.tanks[1].renderTank(guiLeft + 80, guiTop + 70, this.zLevel, 16, 52); - refinery.tanks[2].renderTank(guiLeft + 98, guiTop + 70, this.zLevel, 16, 52); - refinery.tanks[3].renderTank(guiLeft + 116, guiTop + 70, this.zLevel, 16, 52); - refinery.tanks[4].renderTank(guiLeft + 134, guiTop + 70, this.zLevel, 16, 52); + // power + int j = (int)refinery.getPowerScaled(50); + func_146110_a(guiLeft + 186, guiTop + 69 - j, 210, 52 - j, 16, j, 350, 256); + + OpenGlHelper.glBlendFunc(770, 771, 1, 0); // default + + // input tank + FluidTank inputOil = refinery.tanks[0]; + if (inputOil.getFill() != 0) { + + int targetHeight = inputOil.getFill() * 101 / inputOil.getMaxFill(); + Color color = new Color(inputOil.getTankType().getColor()); + + GL11.glEnable(GL11.GL_BLEND); + GL11.glColor4f(color.getRed() / 255F, color.getGreen() / 255F, color.getBlue() / 255F, 1F); + func_146110_a(guiLeft + 33, guiTop + 130 - targetHeight, 226, 101 - targetHeight, 16, targetHeight, 350, 256); + GL11.glDisable(GL11.GL_BLEND); + } + + // fucking kgjhgdfjgdhjfg + // func_146110_a lets you set the resolution of the source texture !!!! + // 350x256 texture by behated (the pipes wouldn't fit) + + // pipes + + Tuple.Quintet recipe = RefineryRecipes.getRefinery(inputOil.getTankType()); + + // Heavy Oil Products + Color color = new Color(recipe.getV().type.getColor()); + + GL11.glEnable(GL11.GL_BLEND); + GL11.glColor4f(color.getRed() / 255F, color.getGreen() / 255F, color.getBlue() / 255F, 1F); + func_146110_a(guiLeft + 52, guiTop + 63, 247, 1, 33, 48, 350, 256); + GL11.glDisable(GL11.GL_BLEND); + + // Naphtha Oil Products + color = new Color(recipe.getW().type.getColor()); + + GL11.glEnable(GL11.GL_BLEND); + GL11.glColor4f(color.getRed() / 255F, color.getGreen() / 255F, color.getBlue() / 255F, 1F); + func_146110_a(guiLeft + 52, guiTop + 32, 247, 50, 66, 52, 350, 256); + GL11.glDisable(GL11.GL_BLEND); + + // Light Oil Products + color = new Color(recipe.getX().type.getColor()); + + GL11.glEnable(GL11.GL_BLEND); + GL11.glColor4f(color.getRed() / 255F, color.getGreen() / 255F, color.getBlue() / 255F, 1F); + func_146110_a(guiLeft + 52, guiTop + 24, 247, 145, 86, 35, 350, 256); + GL11.glDisable(GL11.GL_BLEND); + + // Gaseous Products + color = new Color(recipe.getY().type.getColor()); + + GL11.glEnable(GL11.GL_BLEND); + GL11.glColor4f(color.getRed() / 255F, color.getGreen() / 255F, color.getBlue() / 255F, 1F); + func_146110_a(guiLeft + 36, guiTop + 16, 211, 119, 122, 25, 350, 256); + GL11.glDisable(GL11.GL_BLEND); + GL11.glColor4f(1F, 1F, 1F, 1F); + + // output tanks + refinery.tanks[1].renderTank(guiLeft + 86, guiTop + 95, this.zLevel, 16, 52); + refinery.tanks[2].renderTank(guiLeft + 106, guiTop + 95, this.zLevel, 16, 52); + refinery.tanks[3].renderTank(guiLeft + 126, guiTop + 95, this.zLevel, 16, 52); + refinery.tanks[4].renderTank(guiLeft + 146, guiTop + 95, this.zLevel, 16, 52); } } diff --git a/src/main/java/com/hbm/tileentity/machine/TileEntityMachineTurbineGas.java b/src/main/java/com/hbm/tileentity/machine/TileEntityMachineTurbineGas.java index 24ad50e60..f7e3349f5 100644 --- a/src/main/java/com/hbm/tileentity/machine/TileEntityMachineTurbineGas.java +++ b/src/main/java/com/hbm/tileentity/machine/TileEntityMachineTurbineGas.java @@ -606,7 +606,7 @@ public class TileEntityMachineTurbineGas extends TileEntityMachineBase implement @Callback(direct = true, limit = 4) @Optional.Method(modid = "OpenComputers") public Object[] setThrottle(Context context, Arguments args) { - throttle = args.checkInteger(0); + powerSliderPos = (int) (args.checkInteger(0) * 60D / 100D); return new Object[] {}; } @@ -620,15 +620,14 @@ public class TileEntityMachineTurbineGas extends TileEntityMachineBase implement @Callback(direct = true, limit = 4) @Optional.Method(modid = "OpenComputers") public Object[] start(Context context, Arguments args) { - stopIfNotReady(); - startup(); + state = -1; return new Object[] {}; } @Callback(direct = true, limit = 4) @Optional.Method(modid = "OpenComputers") public Object[] stop(Context context, Arguments args) { - shutdown(); + state = 0; return new Object[] {}; } @@ -665,41 +664,27 @@ public class TileEntityMachineTurbineGas extends TileEntityMachineBase implement public Object[] invoke(String method, Context context, Arguments args) throws Exception { switch(method) { case ("getFluid"): - return new Object[] { - tanks[0].getFill(), tanks[0].getMaxFill(), - tanks[1].getFill(), tanks[1].getMaxFill(), - tanks[2].getFill(), tanks[2].getMaxFill(), - tanks[3].getFill(), tanks[3].getMaxFill() - }; + return getFluid(context, args); case ("getType"): - return new Object[] {tanks[0].getTankType().getName()}; + return getType(context, args); case ("getPower"): - return new Object[] {power}; + return getPower(context, args); case ("getThrottle"): - return new Object[] {throttle}; + return getThrottle(context, args); case ("getState"): - return new Object[] {state}; + return getState(context, args); case ("getAuto"): - return new Object[] {autoMode}; + return getAuto(context, args); case ("setThrottle"): - throttle = args.checkInteger(0); - return new Object[] {}; + return setThrottle(context, args); case ("setAuto"): - autoMode = args.checkBoolean(0); - return new Object[] {}; + return setAuto(context, args); case ("start"): - stopIfNotReady(); - startup(); - return new Object[] {}; + return start(context, args); case ("stop"): - shutdown(); - return new Object[] {}; + return stop(context, args); case ("getInfo"): - return new Object[] {throttle, state, - tanks[0].getFill(), tanks[0].getMaxFill(), - tanks[1].getFill(), tanks[1].getMaxFill(), - tanks[2].getFill(), tanks[2].getMaxFill(), - tanks[3].getFill(), tanks[3].getMaxFill()}; + return getInfo(context, args); } throw new NoSuchMethodException(); } diff --git a/src/main/java/com/hbm/tileentity/network/TileEntityRadioTelex.java b/src/main/java/com/hbm/tileentity/network/TileEntityRadioTelex.java index 4c6ab43d8..26d6dec14 100644 --- a/src/main/java/com/hbm/tileentity/network/TileEntityRadioTelex.java +++ b/src/main/java/com/hbm/tileentity/network/TileEntityRadioTelex.java @@ -300,7 +300,7 @@ public class TileEntityRadioTelex extends TileEntity implements INBTPacketReceiv // this also checks if it's even a string at all if(args.checkAny(i) == null || args.checkString(i).equals("")) this.txBuffer[i] = ""; - if(args.checkString(i).equals("")) { // if it isn't an empty string + if(!args.checkString(i).equals("")) { // if it isn't an empty string if(args.checkString(i).length() > TileEntityRadioTelex.lineWidth) { // line longer than allowed this.txBuffer[i] = args.checkString(i).substring(0, TileEntityRadioTelex.lineWidth); // truncate it } else diff --git a/src/main/resources/assets/hbm/textures/gui/processing/gui_refinery.png b/src/main/resources/assets/hbm/textures/gui/processing/gui_refinery.png index 75f2072e8..6dbf4ffb1 100644 Binary files a/src/main/resources/assets/hbm/textures/gui/processing/gui_refinery.png and b/src/main/resources/assets/hbm/textures/gui/processing/gui_refinery.png differ