diff options
3 files changed, 130 insertions, 16 deletions
diff --git a/src/Java/miscutil/xmod/gregtech/api/gui/CONTAINER_MatterFab.java b/src/Java/miscutil/xmod/gregtech/api/gui/CONTAINER_MatterFab.java new file mode 100644 index 0000000000..3c3bd3bfb8 --- /dev/null +++ b/src/Java/miscutil/xmod/gregtech/api/gui/CONTAINER_MatterFab.java @@ -0,0 +1,41 @@ +package miscutil.xmod.gregtech.api.gui; + +import gregtech.api.gui.GT_ContainerMetaTile_Machine; +import gregtech.api.interfaces.tileentity.IGregTechTileEntity; +import miscutil.xmod.gregtech.common.tileentities.machines.multi.GregtechMetaTileEntityMassFabricator; +import net.minecraft.entity.player.InventoryPlayer; + +/** + * NEVER INCLUDE THIS FILE IN YOUR MOD!!! + * <p/> + * The Container I use for all my Basic Machines + */ +public class CONTAINER_MatterFab extends GT_ContainerMetaTile_Machine { + + public int mUUA_USED = ((GregtechMetaTileEntityMassFabricator)this.mTileEntity.getMetaTileEntity()).getAmplifierUsed(); + public int mUUM_MADE = ((GregtechMetaTileEntityMassFabricator)this.mTileEntity.getMetaTileEntity()).getMatterProduced(); + + public CONTAINER_MatterFab(InventoryPlayer aInventoryPlayer, IGregTechTileEntity aTileEntity) { + super(aInventoryPlayer, aTileEntity); + } + + public CONTAINER_MatterFab(InventoryPlayer aInventoryPlayer, IGregTechTileEntity aTileEntity, boolean bindInventory) { + super(aInventoryPlayer, aTileEntity, bindInventory); + } +} + + /*@Override + public void addSlots(InventoryPlayer aInventoryPlayer) { + addSlotToContainer(new Slot(mTileEntity, 1, 152, 5)); + } + + @Override + public int getSlotCount() { + return 1; + } + + @Override + public int getShiftClickSlotCount() { + return 0; + } +}*/ diff --git a/src/Java/miscutil/xmod/gregtech/api/gui/GUI_MatterFab.java b/src/Java/miscutil/xmod/gregtech/api/gui/GUI_MatterFab.java new file mode 100644 index 0000000000..d28182c1f8 --- /dev/null +++ b/src/Java/miscutil/xmod/gregtech/api/gui/GUI_MatterFab.java @@ -0,0 +1,72 @@ +package miscutil.xmod.gregtech.api.gui; + + +import gregtech.api.gui.GT_GUIContainerMetaTile_Machine; +import gregtech.api.interfaces.tileentity.IGregTechTileEntity; +import miscutil.core.lib.CORE; +import net.minecraft.entity.player.InventoryPlayer; + +/** + * NEVER INCLUDE THIS FILE IN YOUR MOD!!! + * <p/> + * The GUI-Container I use for all my Basic Machines + * <p/> + * As the NEI-RecipeTransferRect Handler can't handle one GUI-Class for all GUIs I needed to produce some dummy-classes which extend this class + */ +public class GUI_MatterFab extends GT_GUIContainerMetaTile_Machine { + + String mName = ""; + int uuaUsed = 0; + int uumMade = 0; + + public GUI_MatterFab(InventoryPlayer aInventoryPlayer, IGregTechTileEntity aTileEntity, String aName, String aTextureFile) { + super(new CONTAINER_MatterFab(aInventoryPlayer, aTileEntity), CORE.RES_PATH_GUI + (aTextureFile == null ? "MultiblockDisplay" : aTextureFile)); + mName = aName; + } + + @Override + protected void drawGuiContainerForegroundLayer(int par1, int par2) { + fontRendererObj.drawString(mName, 10, 8, 16448255); + + + + if (mContainer != null) { + if ((((CONTAINER_MatterFab) mContainer).mDisplayErrorCode & 1) != 0) + fontRendererObj.drawString("Pipe is loose.", 10, 16, 16448255); + if ((((CONTAINER_MatterFab) mContainer).mDisplayErrorCode & 2) != 0) + fontRendererObj.drawString("Screws are missing.", 10, 24, 16448255); + if ((((CONTAINER_MatterFab) mContainer).mDisplayErrorCode & 4) != 0) + fontRendererObj.drawString("Something is stuck.", 10, 32, 16448255); + if ((((CONTAINER_MatterFab) mContainer).mDisplayErrorCode & 8) != 0) + fontRendererObj.drawString("Platings are dented.", 10, 40, 16448255); + if ((((CONTAINER_MatterFab) mContainer).mDisplayErrorCode & 16) != 0) + fontRendererObj.drawString("Circuitry burned out.", 10, 48, 16448255); + if ((((CONTAINER_MatterFab) mContainer).mDisplayErrorCode & 32) != 0) + fontRendererObj.drawString("That doesn't belong there.", 10, 56, 16448255); + if ((((CONTAINER_MatterFab) mContainer).mDisplayErrorCode & 64) != 0) + fontRendererObj.drawString("Incomplete Structure.", 10, 64, 16448255); + + if (((CONTAINER_MatterFab) mContainer).mDisplayErrorCode == 0) { + if (((CONTAINER_MatterFab) mContainer).mActive == 0) { + fontRendererObj.drawString("Hit with Soft Hammer", 10, 16, 16448255); + fontRendererObj.drawString("to (re-)start the Machine", 10, 24, 16448255); + fontRendererObj.drawString("if it doesn't start.", 10, 32, 16448255); + } else { + uuaUsed = ((CONTAINER_MatterFab) mContainer).mUUA_USED; + uumMade = ((CONTAINER_MatterFab) mContainer).mUUM_MADE; + fontRendererObj.drawString("Running perfectly.", 10, 16, 16448255); + fontRendererObj.drawString("UU-Amplifier Used: "+uuaUsed, 10, 24, 16448255); + fontRendererObj.drawString("UU_Matter Fabricated: "+uumMade, 10, 32, 16448255); + } + } + } + } + + @Override + protected void drawGuiContainerBackgroundLayer(float par1, int par2, int par3) { + super.drawGuiContainerBackgroundLayer(par1, par2, par3); + int x = (width - xSize) / 2; + int y = (height - ySize) / 2; + drawTexturedModalRect(x, y, 0, 0, xSize, ySize); + } +} diff --git a/src/Java/miscutil/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntityMassFabricator.java b/src/Java/miscutil/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntityMassFabricator.java index 45948cefbb..3195c884df 100644 --- a/src/Java/miscutil/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntityMassFabricator.java +++ b/src/Java/miscutil/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntityMassFabricator.java @@ -21,7 +21,7 @@ import miscutil.core.lib.CORE; import miscutil.core.util.Utils; import miscutil.core.util.fluid.FluidUtils; import miscutil.core.util.item.UtilsItems; -import miscutil.xmod.gregtech.api.gui.GUI_MultiMachine; +import miscutil.xmod.gregtech.api.gui.GUI_MatterFab; import net.minecraft.block.Block; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.item.ItemStack; @@ -36,10 +36,20 @@ public class GregtechMetaTileEntityMassFabricator extends GT_MetaTileEntity_Mult public static int sUUASpeedBonus = 4; public static int sDurationMultiplier = 3215; public static boolean sRequiresUUA = false; - private int recipeCounter = 0; + private int mAmplifierUsed = 0; + private int mMatterProduced = 0; private static Block IC2Glass = Block.getBlockFromItem(UtilsItems.getItem("IC2:blockAlloyGlass")); FluidStack tempFake = FluidUtils.getFluidStack("uuamplifier", 1); GT_Recipe fakeRecipe; + + public int getAmplifierUsed(){ + return mAmplifierUsed; + } + + public int getMatterProduced(){ + return mMatterProduced; + } + //public FluidStack mFluidOut = Materials.UUMatter.getFluid(1L); public GregtechMetaTileEntityMassFabricator(int aID, String aName, String aNameRegional) { @@ -79,7 +89,7 @@ public class GregtechMetaTileEntityMassFabricator extends GT_MetaTileEntity_Mult @Override public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { - return new GUI_MultiMachine(aPlayerInventory, aBaseMetaTileEntity, getLocalName(), "MatterFabricator.png"); + return new GUI_MatterFab(aPlayerInventory, aBaseMetaTileEntity, getLocalName(), "MatterFabricator.png"); } @Override @@ -137,7 +147,8 @@ public class GregtechMetaTileEntityMassFabricator extends GT_MetaTileEntity_Mult this.mOutputItems = new ItemStack[]{tRecipe.getOutput(0)}; this.mOutputFluids = tRecipe.mFluidOutputs.clone(); ArrayUtils.reverse(mOutputFluids); - recipeCounter++; + mMatterProduced++; + mAmplifierUsed++; updateSlots(); //Utils.LOG_INFO("Recipes Finished: "+recipeCounter); return true; @@ -172,24 +183,14 @@ public class GregtechMetaTileEntityMassFabricator extends GT_MetaTileEntity_Mult this.mOutputItems = new ItemStack[]{fakeRecipe.getOutput(0)}; this.mOutputFluids = fakeRecipe.mFluidOutputs.clone(); ArrayUtils.reverse(mOutputFluids); - recipeCounter++; + mMatterProduced++; updateSlots(); //Utils.LOG_INFO("Recipes Finished: "+recipeCounter); return true; } - Utils.LOG_INFO("fakeRecipe was Null"); - - this.mMaxProgresstime = Math.max(1, this.mMaxProgresstime); - this.mOutputItems = new ItemStack[]{null}; - this.mOutputFluids = new FluidStack[] {FluidUtils.getFluidStack("uumatter", 1)}; - ArrayUtils.reverse(mOutputFluids); - recipeCounter++; - updateSlots(); - Utils.LOG_INFO("Recipes Finished: "+recipeCounter); - return true; } else { - Utils.LOG_INFO("Invalid no input Recipe"); + //Utils.LOG_INFO("Invalid no input Recipe"); } return false; } |