diff options
Diffstat (limited to 'src')
6 files changed, 239 insertions, 5 deletions
diff --git a/src/Java/gtPlusPlus/core/item/tool/misc/FakeGregtechTool.java b/src/Java/gtPlusPlus/core/item/tool/misc/FakeGregtechTool.java new file mode 100644 index 0000000000..47856b44c0 --- /dev/null +++ b/src/Java/gtPlusPlus/core/item/tool/misc/FakeGregtechTool.java @@ -0,0 +1,74 @@ +package gtPlusPlus.core.item.tool.misc; + +import java.util.List; + +import net.minecraft.client.renderer.texture.IIconRegister; +import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.util.IIcon; + +import gregtech.api.enums.Materials; + +import gtPlusPlus.core.creative.AddToCreativeTab; +import gtPlusPlus.core.item.base.CoreItem; +import gtPlusPlus.core.lib.CORE; +import gtPlusPlus.core.util.Utils; + +public class FakeGregtechTool extends CoreItem{ + + public final int componentColour; + public Object extraData; + + protected IIcon base[] = new IIcon[6]; + protected IIcon overlay[] = new IIcon[6]; + + public FakeGregtechTool() { + super("GregeriousT's Display Tool", AddToCreativeTab.tabTools, 1); + short[] tempCol = Materials.TungstenSteel.getRGBA(); + this.componentColour = Utils.rgbtoHexValue(tempCol[0], tempCol[1], tempCol[2]); + } + + @Override + public void registerIcons(final IIconRegister i) { + //ScrewDriver + this.base[0] = i.registerIcon("gregtech" + ":" + "materialicons/METALLIC/" + "toolHeadScrewdriver"); + this.overlay[0] = i.registerIcon("gregtech" + ":" + "iconsets/" + "HANDLE_SCREWDRIVER"); + //Soldering iron + this.base[1] = i.registerIcon("gregtech" + ":" + "materialicons/METALLIC/" + "toolHeadSoldering"); + this.overlay[1] = i.registerIcon("gregtech" + ":" + "iconsets/" + "HANDLE_SOLDERING"); + //Mallet + this.base[2] = i.registerIcon("gregtech" + ":" + "materialicons/METALLIC/" + "handleMallet"); + this.overlay[2] = i.registerIcon("gregtech" + ":" + "materialicons/METALLIC/" + "toolHeadMallet"); + //Hammer + this.base[3] = i.registerIcon("gregtech" + ":" + "materialicons/METALLIC/" + "stick"); + this.overlay[3] = i.registerIcon("gregtech" + ":" + "materialicons/METALLIC/" + "toolHeadHammer"); + //Wrench + this.base[4] = i.registerIcon("gregtech" + ":" + "iconsets/" + "WRENCH"); + this.overlay[4] = i.registerIcon("gregtech" + ":" + "iconsets/" + "WRENCH_OVERLAY"); + //Crowbar + this.base[5] = i.registerIcon("gregtech" + ":" + "iconsets/" + "CROWBAR"); + this.overlay[5] = i.registerIcon("gregtech" + ":" + "iconsets/" + "CROWBAR_OVERLAY"); + } + + @Override + public int getColorFromItemStack(final ItemStack stack, final int renderPass) { + if (renderPass == 1){ + return Utils.rgbtoHexValue(230, 230, 230); + } + return this.componentColour; + } + + @Override + public boolean requiresMultipleRenderPasses() { + return true; + } + + @Override + public void getSubItems(Item item, CreativeTabs tab, List list) { + for (int i = 0; i < 6; i ++) { + list.add(new ItemStack(item, 1, i)); + } + } + +} diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/gui/CONTAINER_PowerSubStation.java b/src/Java/gtPlusPlus/xmod/gregtech/api/gui/CONTAINER_PowerSubStation.java new file mode 100644 index 0000000000..feef884867 --- /dev/null +++ b/src/Java/gtPlusPlus/xmod/gregtech/api/gui/CONTAINER_PowerSubStation.java @@ -0,0 +1,35 @@ +package gtPlusPlus.xmod.gregtech.api.gui; + +import net.minecraft.inventory.IInventory; +import net.minecraft.inventory.Slot; + +import gregtech.api.gui.GT_Container_MultiMachine; +import gregtech.api.interfaces.tileentity.IGregTechTileEntity; + +import gtPlusPlus.core.slots.SlotNoInput; + +import net.minecraft.entity.player.InventoryPlayer; + +public class CONTAINER_PowerSubStation extends GT_Container_MultiMachine { + public CONTAINER_PowerSubStation(final InventoryPlayer aInventoryPlayer, final IGregTechTileEntity aTileEntity) { + super(aInventoryPlayer, aTileEntity); + } + + public CONTAINER_PowerSubStation(final InventoryPlayer aInventoryPlayer, final IGregTechTileEntity aTileEntity, + final boolean bindInventory) { + super(aInventoryPlayer, aTileEntity, bindInventory); + } + + public void addSlots(final InventoryPlayer aInventoryPlayer) { + this.addSlotToContainer(new Slot((IInventory) this.mTileEntity, 1, 155, 5)); + this.addSlotToContainer(new SlotNoInput((IInventory) this.mTileEntity, 2, 155, 23)); + } + + public int getSlotCount() { + return 2; + } + + public int getShiftClickSlotCount() { + return 1; + } +}
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/gui/GUI_PowerSubStation.java b/src/Java/gtPlusPlus/xmod/gregtech/api/gui/GUI_PowerSubStation.java new file mode 100644 index 0000000000..c69391025c --- /dev/null +++ b/src/Java/gtPlusPlus/xmod/gregtech/api/gui/GUI_PowerSubStation.java @@ -0,0 +1,119 @@ +package gtPlusPlus.xmod.gregtech.api.gui; + +import gregtech.api.util.GT_Utility; + +import gtPlusPlus.api.objects.Logger; +import gtPlusPlus.core.lib.CORE; +import gtPlusPlus.core.util.minecraft.ItemUtils; + +import gregtech.api.interfaces.tileentity.IGregTechTileEntity; +import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.item.ItemStack; +import net.minecraft.util.IIcon; + +import gregtech.api.gui.GT_GUIContainerMetaTile_Machine; + +public class GUI_PowerSubStation extends GT_GUIContainerMetaTile_Machine { + public String mNEI; + String mName; + + public GUI_PowerSubStation(final InventoryPlayer aInventoryPlayer, final IGregTechTileEntity aTileEntity, final String aName, final String aNEI) { + super(new CONTAINER_PowerSubStation(aInventoryPlayer, aTileEntity, false), + CORE.RES_PATH_GUI + "PowerSubStation.png"); + this.mName = aName; + this.mNEI = aNEI; + /** The X size of the inventory window in pixels. */ + this.xSize = 196; + /** The Y size of the inventory window in pixels. */ + this.ySize = 191; + } + + protected void drawGuiContainerForegroundLayer(final int par1, final int par2) { + this.fontRendererObj.drawString(this.mName, 8, -10, 16448255); + if (this.mContainer != null) { + + this.fontRendererObj.drawString("Error Code: "+((CONTAINER_PowerSubStation) this.mContainer).mDisplayErrorCode, 10, 142, 16448255); + + if (((this.mContainer).mDisplayErrorCode & 1) != 0) { + this.fontRendererObj.drawString("Pipe is loose.", 10, 8, 16448255); + } + if ((((CONTAINER_PowerSubStation) this.mContainer).mDisplayErrorCode & 2) != 0) { + this.fontRendererObj.drawString("Screws are missing.", 10, 16, 16448255); + } + if ((((CONTAINER_PowerSubStation) this.mContainer).mDisplayErrorCode & 4) != 0) { + this.fontRendererObj.drawString("Something is stuck.", 10, 24, 16448255); + } + if ((((CONTAINER_PowerSubStation) this.mContainer).mDisplayErrorCode & 8) != 0) { + this.fontRendererObj.drawString("Platings are dented.", 10, 32, 16448255); + } + if ((((CONTAINER_PowerSubStation) this.mContainer).mDisplayErrorCode & 16) != 0) { + this.fontRendererObj.drawString("Circuitry burned out.", 10, 40, 16448255); + } + if ((((CONTAINER_PowerSubStation) this.mContainer).mDisplayErrorCode & 32) != 0) { + this.fontRendererObj.drawString("That doesn't belong there.", 10, 48, 16448255); + } + if (((CONTAINER_PowerSubStation) this.mContainer).mDisplayErrorCode == 0) { + if (((CONTAINER_PowerSubStation) this.mContainer).mActive == 0) { + this.fontRendererObj.drawString( + "Hit with Soft Hammer to (re-)start the Machine if it doesn't start.", -70, 8, 16448255); + } else { + this.fontRendererObj.drawString("Running perfectly.", 10, 8, 16448255); + } + } + if (this.mContainer.mEnergy > 160000000 && this.mContainer.mEnergy < 160010000) { + this.fontRendererObj.drawString("160,000,000 EU", 50, 155, 16711680); + } else if (this.mContainer.mEnergy > 320000000 && this.mContainer.mEnergy < 320010000) { + this.fontRendererObj.drawString("320,000,000 EU", 50, 155, 16711680); + } else if (this.mContainer.mEnergy > 640000000 && this.mContainer.mEnergy < 640010000) { + this.fontRendererObj.drawString("640,000,000 EU", 50, 155, 16711680); + } else { + this.fontRendererObj.drawString(GT_Utility.formatNumbers((long) this.mContainer.mEnergy) + " EU", 50, + 155, 16711680); + } + } + else { + Logger.INFO("Bad Container"); + this.fontRendererObj.drawString("Bad Container", 8, 30, 16448255); + } + } + + protected void drawGuiContainerBackgroundLayer(final float par1, final int par2, final int par3) { + /** The X size of the inventory window in pixels. */ + if (this.xSize != 196) + this.xSize = 196; + /** The Y size of the inventory window in pixels. */ + if (this.ySize != 191) + this.ySize = 191; + super.drawGuiContainerBackgroundLayer(par1, par2, par3); + final int x = (this.width - this.xSize) / 2; + final int y = (this.height - this.ySize) / 2; + this.drawTexturedModalRect(x, y, 0, 0, this.xSize, this.ySize); + if (this.mContainer != null) { + final double tScale = this.mContainer.mEnergy / this.mContainer.mStorage; + this.drawTexturedModalRect(x + 5, y + 156, 0, 251, Math.min(147, (int) (tScale * 148.0)), 5); + + IIcon texture = null; + ItemStack tempStack = null; + + + tempStack = ItemUtils.getItemStackOfAmountFromOreDict("toolWrench", 1); + if (tempStack != null) { + texture = tempStack.getItem().getIcon(tempStack, 0); + if (texture != null) { + this.drawTexturedModelRectFromIcon(x + 154, y + 76, texture, 9, 9); + texture = tempStack.getItem().getIcon(tempStack, 1); + this.drawTexturedModelRectFromIcon(x + 154, y + 76, texture, 9, 9); + } + else { + this.drawTexturedModalRect(x + 154, y + 76, 0, 251, 18, 5); + } + } + + //Maint Done + //this.drawTexturedModalRect(x + 154, y + 76, 238, 0, 18, 18); + //Maint Required + //this.drawTexturedModalRect(x + 154, y + 76, 238, 18, 18, 18); + + } + } +}
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_AirIntake.java b/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_AirIntake.java index 81b9e90ef4..85387590e6 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_AirIntake.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_AirIntake.java @@ -4,7 +4,7 @@ import net.minecraftforge.common.util.ForgeDirection; import net.minecraft.world.World; import net.minecraft.item.ItemStack; -import gtPlusPlus.api.objects.Logger; +import gtPlusPlus.api.objects.random.XSTR; import gtPlusPlus.core.lib.CORE; import gtPlusPlus.core.util.minecraft.FluidUtils; @@ -16,7 +16,6 @@ import gregtech.api.interfaces.IIconContainer; import gregtech.api.objects.GT_RenderedTexture; import gregtech.api.enums.Textures; import gregtech.api.interfaces.ITexture; -import gregtech.api.objects.XSTR; public class GT_MetaTileEntity_Hatch_AirIntake extends GT_MetaTileEntity_Hatch_Input { private static XSTR floatGen; diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/storage/GregtechMetaTileEntity_PowerSubStationController.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/storage/GregtechMetaTileEntity_PowerSubStationController.java index d15820514f..f8b42bc629 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/storage/GregtechMetaTileEntity_PowerSubStationController.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/storage/GregtechMetaTileEntity_PowerSubStationController.java @@ -27,7 +27,8 @@ import gtPlusPlus.core.lib.LoadedMods; import gtPlusPlus.core.util.Utils; import gtPlusPlus.core.util.math.MathUtils; import gtPlusPlus.core.util.minecraft.PlayerUtils; -import gtPlusPlus.xmod.gregtech.api.gui.GUI_MultiMachine; +import gtPlusPlus.xmod.gregtech.api.gui.CONTAINER_PowerSubStation; +import gtPlusPlus.xmod.gregtech.api.gui.GUI_PowerSubStation; import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_InputBattery; import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_OutputBattery; import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base.GregtechMeta_MultiBlockBase; @@ -63,6 +64,7 @@ public class GregtechMetaTileEntity_PowerSubStationController extends GregtechMe "Consumes " + this.ENERGY_TAX + "% of the average voltage of all energy type hatches", "Power can be Input/Extracted from the rear face at any time, change with screwdriver", "Can be built with variable height between " + (CELL_HEIGHT_MIN + 2) + "-" + (CELL_HEIGHT_MAX + 2) + "", + "Redox Cells can be upgraded via the GUI without having to deconstruct the multiblock", "Size(WxHxD): External 5xHx5, Sub-Station Casings, Controller (Bottom, Centre)", "Size(WxHxD): Internal 3x(H-2)x3, Energy Storage Cells", "Number and quality of cells determines power storage", @@ -89,12 +91,17 @@ public class GregtechMetaTileEntity_PowerSubStationController extends GregtechMe @Override public boolean hasSlotInGUI() { - return false; + return true; } @Override public Object getClientGUI(final int aID, final InventoryPlayer aPlayerInventory, final IGregTechTileEntity aBaseMetaTileEntity) { - return new GUI_MultiMachine(aPlayerInventory, aBaseMetaTileEntity, this.getLocalName(), "MatterFabricator.png"); + return new GUI_PowerSubStation(aPlayerInventory, aBaseMetaTileEntity, this.getLocalName(), "Ergon Energy - Sub Station"); + } + + @Override + public Object getServerGUI(final int aID, final InventoryPlayer aPlayerInventory, final IGregTechTileEntity aBaseMetaTileEntity) { + return new CONTAINER_PowerSubStation(aPlayerInventory, aBaseMetaTileEntity); } private void checkMachineProblem(String msg, int xOff, int yOff, int zOff) { diff --git a/src/resources/assets/miscutils/textures/gui/PowerSubStation.png b/src/resources/assets/miscutils/textures/gui/PowerSubStation.png Binary files differnew file mode 100644 index 0000000000..9c441e1967 --- /dev/null +++ b/src/resources/assets/miscutils/textures/gui/PowerSubStation.png |