From f3bf4b8332052223d7de89154f757e9bcbb92ef7 Mon Sep 17 00:00:00 2001 From: Technus Date: Wed, 23 Aug 2017 20:03:55 +0200 Subject: Refactor --- .../thing/metaTileEntity/multi/GT_MetaTileEntity_EM_computer.java | 2 +- .../thing/metaTileEntity/multi/GT_MetaTileEntity_EM_junction.java | 2 +- .../thing/metaTileEntity/multi/GT_MetaTileEntity_EM_switch.java | 2 +- .../metaTileEntity/multi/GT_MetaTileEntity_MultiblockBase_EM.java | 4 ++-- .../thing/metaTileEntity/multi/GT_MetaTileEntity_TM_microwave.java | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-) (limited to 'src/main/java/com') diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_computer.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_computer.java index 498ea9387d..91b933a335 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_computer.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_computer.java @@ -121,7 +121,7 @@ public class GT_MetaTileEntity_EM_computer extends GT_MetaTileEntity_MultiblockB } @Override - public void checkParams_EM() { + public void updateParameters_EM() { if (eParamsIn[0] <= 0) eParamsInStatus[0] = PARAM_TOO_LOW; else if (eParamsIn[0] < 1) diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_junction.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_junction.java index 15d5d36ab5..010ac1bdb0 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_junction.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_junction.java @@ -77,7 +77,7 @@ public class GT_MetaTileEntity_EM_junction extends GT_MetaTileEntity_MultiblockB } @Override - public void checkParams_EM() { + public void updateParameters_EM() { for (int i = 0; i < 10; i++) { if ((int) eParamsIn[i] < 0) eParamsInStatus[i] = PARAM_TOO_LOW; else if ((int) eParamsIn[i] == 0) eParamsInStatus[i] = PARAM_UNUSED; diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_switch.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_switch.java index b654fa6958..6127960f03 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_switch.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_switch.java @@ -139,7 +139,7 @@ public class GT_MetaTileEntity_EM_switch extends GT_MetaTileEntity_MultiblockBas } @Override - public void checkParams_EM() { + public void updateParameters_EM() { for (int i = 0; i < 10; i++) { if (eParamsIn[i] < 0) eParamsInStatus[i] = PARAM_TOO_LOW; else if (eParamsIn[i] == 0) eParamsInStatus[i] = PARAM_UNUSED; diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_MultiblockBase_EM.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_MultiblockBase_EM.java index 589752c176..920b2ba33b 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_MultiblockBase_EM.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_MultiblockBase_EM.java @@ -102,7 +102,7 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt // My code handles AMPS, if you want overclocking just modify mEUt and mMaxProgressTime, leave amps as usual! // Set mEUt, Efficiencies, required computation, time, check input etc. - public void checkParams_EM() { + public void updateParameters_EM() { } // update status of parameters in guis and "machine state" // Called before check recipe, before outputting, and every second the machine is active @@ -983,7 +983,7 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt param.input1f = eParamsOut[paramID]; param.input2f = eParamsOut[paramID + 10]; } - checkParams_EM(); + updateParameters_EM(); eAvailableData = getAvailableData_EM(); diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_TM_microwave.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_TM_microwave.java index 40a11e56b3..a63f948bf1 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_TM_microwave.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_TM_microwave.java @@ -219,7 +219,7 @@ public class GT_MetaTileEntity_TM_microwave extends GT_MetaTileEntity_Multiblock } @Override - public void checkParams_EM() { + public void updateParameters_EM() { if (eParamsIn[0] <= 300) eParamsInStatus[0] = PARAM_TOO_LOW; else if (eParamsIn[0] < 1000) -- cgit From b85a7a1adf606a765e5bdc945ca56e1a6fce04bb Mon Sep 17 00:00:00 2001 From: Technus Date: Sat, 26 Aug 2017 23:34:47 +0200 Subject: bugfixes --- .../multi/GT_MetaTileEntity_EM_computer.java | 70 ++++++++++++++-------- .../multi/GT_MetaTileEntity_MultiblockBase_EM.java | 43 +++++++------ .../multi/gui/GT_Container_MultiMachineEM.java | 26 +++++--- .../multi/gui/GT_GUIContainer_MultiMachineEM.java | 27 +++++---- 4 files changed, 103 insertions(+), 63 deletions(-) (limited to 'src/main/java/com') diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_computer.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_computer.java index 91b933a335..df74ff604d 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_computer.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_computer.java @@ -82,31 +82,50 @@ public class GT_MetaTileEntity_EM_computer extends GT_MetaTileEntity_MultiblockB public boolean checkRecipe_EM(ItemStack itemStack) { eAvailableData = 0; maxTemp = 0; - short thingsActive = 0; - int rackComputation; - - for (GT_MetaTileEntity_Hatch_Rack r : eRacks) { - if (!isValidMetaTileEntity(r)) continue; - if (r.heat > maxTemp) maxTemp = r.heat; - rackComputation = r.tickComponents(eParamsIn[0], eParamsIn[10]); - if (rackComputation > 0) { - eAvailableData += rackComputation; - thingsActive += 4; + if(eParamsIn[0]>=0 && eParamsIn[10]>=0){ + float eut=V[8] * eParamsIn[10]; + if(eut maxTemp) maxTemp = r.heat; + rackComputation = r.tickComponents(eParamsIn[0], eParamsIn[10]); + if (rackComputation > 0) { + eAvailableData += rackComputation; + thingsActive += 4; + } + r.getBaseMetaTileEntity().setActive(true); } - r.getBaseMetaTileEntity().setActive(true); - } - for (GT_MetaTileEntity_Hatch_InputData di : eInputData) - if (di.q != null)//ok for power losses - thingsActive++; - - if (thingsActive > 0 && eCertainStatus == 0) { - thingsActive += eOutputData.size(); - mEUt = -(int) (V[8] * eParamsIn[10]); - eAmpereFlow = 1 + (thingsActive >> 2); - mMaxProgresstime = 20; - mEfficiencyIncrease = 10000; - return true; + for (GT_MetaTileEntity_Hatch_InputData di : eInputData) + if (di.q != null)//ok for power losses + thingsActive++; + + if (thingsActive > 0 && eCertainStatus == 0) { + thingsActive += eOutputData.size(); + eAmpereFlow = 1 + (thingsActive >> 2); + mMaxProgresstime = 20; + mEfficiencyIncrease = 10000; + return true; + } else { + eAvailableData=0; + mEUt = -(int)V[8]; + eAmpereFlow = 1; + mMaxProgresstime = 20; + mEfficiencyIncrease = 10000; + return true; + } } mMaxProgresstime = 0; mEfficiencyIncrease = 0; @@ -122,7 +141,7 @@ public class GT_MetaTileEntity_EM_computer extends GT_MetaTileEntity_MultiblockB @Override public void updateParameters_EM() { - if (eParamsIn[0] <= 0) + if (eParamsIn[0] < 0) eParamsInStatus[0] = PARAM_TOO_LOW; else if (eParamsIn[0] < 1) eParamsInStatus[0] = PARAM_LOW; @@ -132,7 +151,7 @@ public class GT_MetaTileEntity_EM_computer extends GT_MetaTileEntity_MultiblockB eParamsInStatus[0] = PARAM_HIGH; else eParamsInStatus[0] = PARAM_TOO_HIGH; - if (eParamsIn[10] <= 0.7f) + if (eParamsIn[10] < 0.7f) eParamsInStatus[10] = PARAM_TOO_LOW; else if (eParamsIn[10] < 0.8f) eParamsInStatus[10] = PARAM_LOW; @@ -184,6 +203,7 @@ public class GT_MetaTileEntity_EM_computer extends GT_MetaTileEntity_MultiblockB @Override public void stopMachine() { super.stopMachine(); + eAvailableData=0; for (GT_MetaTileEntity_Hatch_Rack r : eRacks) r.getBaseMetaTileEntity().setActive(false); } diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_MultiblockBase_EM.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_MultiblockBase_EM.java index 920b2ba33b..90b4fda033 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_MultiblockBase_EM.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_MultiblockBase_EM.java @@ -75,7 +75,12 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt public final float[] eParamsOut = new float[20];//float number O to parametrizers public final byte[] eParamsInStatus = new byte[20];//LED status for I public final byte[] eParamsOutStatus = new byte[20];//LED status for O - public final static byte PARAM_UNUSED = 0, PARAM_OK = 1, PARAM_TOO_LOW = 2, PARAM_LOW = 3, PARAM_TOO_HIGH = 4, PARAM_HIGH = 5, PARAM_WRONG = 6; + public final static byte PARAM_UNUSED = 0, + PARAM_TOO_LOW = 1, PARAM_LOW = 2, + PARAM_WRONG = 3, PARAM_OK = 4, + PARAM_TOO_HIGH = 5, PARAM_HIGH = 6; + // 0,2,4,6 - ok + // 1,3,5 - nok //TO ENABLE this change value in to false and/or other than 0, can also be added in recipe check or whatever public boolean eParameters = true, ePowerPass = false, eSafeVoid = false, eDismatleBoom = false; @@ -148,6 +153,10 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt protected void onFirstTick_EM(){} // callback on first tick + protected void notAllowedToWork_stopMachine_EM(){ + stopMachine(); + } + @Override public int getPollutionPerTick(ItemStack itemStack) { return 0; @@ -175,18 +184,18 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt } float mass = 0; - if (outputEM == null) return; - for (cElementalInstanceStackMap tree : outputEM) - mass += tree.getMass(); - if (mass > 0) { - if (eMufflerHatches.size() < 1) explodeMultiblock(); - mass /= eMufflerHatches.size(); - for (GT_MetaTileEntity_Hatch_MufflerElemental dump : eMufflerHatches) { - if (dump.addOverflowMatter(mass)) explodeMultiblock(); + if (outputEM != null) { + for (cElementalInstanceStackMap tree : outputEM) + mass += tree.getMass(); + if (mass > 0) { + if (eMufflerHatches.size() < 1) explodeMultiblock(); + mass /= eMufflerHatches.size(); + for (GT_MetaTileEntity_Hatch_MufflerElemental dump : eMufflerHatches) { + if (dump.addOverflowMatter(mass)) explodeMultiblock(); + } } + outputEM = null; } - outputEM = null; - hatchesStatusUpdate_EM(); } @@ -618,9 +627,7 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt mEfficiency = Math.max(0, Math.min(mEfficiency + mEfficiencyIncrease, getMaxEfficiency(mInventory[1]) - ((getIdealStatus() - getRepairStatus()) * 1000))); } updateSlots(); - }// else {//not allowed to work - // stopMachine(); - //} + } else notAllowedToWork_stopMachine_EM(); } }// else {//failed to consume power/resources - inside on running tick // stopMachine(); @@ -631,11 +638,10 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt mEfficiency = Math.max(0, Math.min(mEfficiency + mEfficiencyIncrease, getMaxEfficiency(mInventory[1]) - ((getIdealStatus() - getRepairStatus()) * 1000))); } updateSlots(); - }// else {//not allowed to work - // stopMachine(); - //} + } else notAllowedToWork_stopMachine_EM(); } + //region power pass {//DO ONCE long euVar; for (GT_MetaTileEntity_Hatch_Energy tHatch : mEnergyHatches) { @@ -673,10 +679,11 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt } } } + //endregion } else {//not repaired stopMachine(); } - } else {//not machine + } else {//not complete stopMachine(); } } diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/gui/GT_Container_MultiMachineEM.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/gui/GT_Container_MultiMachineEM.java index e104829340..ec359a0a49 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/gui/GT_Container_MultiMachineEM.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/gui/GT_Container_MultiMachineEM.java @@ -15,13 +15,23 @@ public class GT_Container_MultiMachineEM extends GT_ContainerMetaTile_Machine { public byte[] eParamsOutStatus = new byte[20]; public byte eCertainMode = 5, eCertainStatus = 127; public boolean ePowerPass = false, eSafeVoid = false, allowedToWork = false; + public final boolean ePowerPassButton, eSafeVoidButton, allowedToWorkButton; + + public GT_Container_MultiMachineEM(InventoryPlayer aInventoryPlayer, IGregTechTileEntity aTileEntity, boolean enablePowerPass, boolean enableSafeVoid, boolean enablePowerButton) { + super(aInventoryPlayer, aTileEntity); + ePowerPassButton=enablePowerPass; + eSafeVoidButton=enableSafeVoid; + allowedToWorkButton=enablePowerButton; + } public GT_Container_MultiMachineEM(InventoryPlayer aInventoryPlayer, IGregTechTileEntity aTileEntity) { super(aInventoryPlayer, aTileEntity); + ePowerPassButton=eSafeVoidButton=allowedToWorkButton=true; } public GT_Container_MultiMachineEM(InventoryPlayer aInventoryPlayer, IGregTechTileEntity aTileEntity, boolean bindInventory) { super(aInventoryPlayer, aTileEntity, bindInventory); + ePowerPassButton=eSafeVoidButton=allowedToWorkButton=true; } @Override @@ -41,16 +51,18 @@ public class GT_Container_MultiMachineEM extends GT_ContainerMetaTile_Machine { GT_MetaTileEntity_MultiblockBase_EM base = (GT_MetaTileEntity_MultiblockBase_EM) this.mTileEntity.getMetaTileEntity(); switch (aSlotIndex) { case 1: - base.ePowerPass ^= true; + if(ePowerPassButton) base.ePowerPass ^= true; break; case 2: - base.eSafeVoid ^= true; + if(eSafeVoidButton) base.eSafeVoid ^= true; break; case 3: - if (base.getBaseMetaTileEntity().isAllowedToWork()) { - base.getBaseMetaTileEntity().disableWorking(); - } else { - base.getBaseMetaTileEntity().enableWorking(); + if(allowedToWorkButton) { + if (base.getBaseMetaTileEntity().isAllowedToWork()) { + base.getBaseMetaTileEntity().disableWorking(); + } else { + base.getBaseMetaTileEntity().enableWorking(); + } } break; } @@ -62,7 +74,7 @@ public class GT_Container_MultiMachineEM extends GT_ContainerMetaTile_Machine { public void detectAndSendChanges() { super.detectAndSendChanges(); if ((this.mTileEntity.isClientSide()) || (this.mTileEntity.getMetaTileEntity() == null) || (this.eParamsInStatus == null)) - return;//INTELLIJ IS TALKING BULLSHIT HERE IT CAN BE NULL!!! + return; this.eParamsInStatus = ((GT_MetaTileEntity_MultiblockBase_EM) this.mTileEntity.getMetaTileEntity()).eParamsInStatus; this.eParamsOutStatus = ((GT_MetaTileEntity_MultiblockBase_EM) this.mTileEntity.getMetaTileEntity()).eParamsOutStatus; this.eCertainMode = ((GT_MetaTileEntity_MultiblockBase_EM) this.mTileEntity.getMetaTileEntity()).eCertainMode; diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/gui/GT_GUIContainer_MultiMachineEM.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/gui/GT_GUIContainer_MultiMachineEM.java index 08f97832dd..e1b4c2775c 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/gui/GT_GUIContainer_MultiMachineEM.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/gui/GT_GUIContainer_MultiMachineEM.java @@ -5,6 +5,7 @@ import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import net.minecraft.entity.player.InventoryPlayer; import org.lwjgl.opengl.GL11; +import static com.github.technus.tectech.thing.metaTileEntity.multi.GT_MetaTileEntity_MultiblockBase_EM.*; import static gregtech.api.enums.GT_Values.RES_PATH_GUI; /** @@ -13,7 +14,7 @@ import static gregtech.api.enums.GT_Values.RES_PATH_GUI; public class GT_GUIContainer_MultiMachineEM extends GT_GUIContainerMetaTile_Machine { String mName = ""; - private static byte cntr = 0; + private static byte counter = 0; public GT_GUIContainer_MultiMachineEM(InventoryPlayer aInventoryPlayer, IGregTechTileEntity aTileEntity, String aName, String aTextureFile) { super(new GT_Container_MultiMachineEM(aInventoryPlayer, aTileEntity), RES_PATH_GUI + "multimachines/" + (aTextureFile == null ? "MultiblockDisplay" : aTextureFile)); @@ -64,7 +65,7 @@ public class GT_GUIContainer_MultiMachineEM extends GT_GUIContainerMetaTile_Mach y -= 26; drawTexturedModalRect(x, y, 0, 0, xSize, ySize + 26); if (this.mContainer != null && ((GT_Container_MultiMachineEM) this.mContainer).eParamsInStatus != null) { - cntr = (byte) ((1 + cntr) % 6); + counter = (byte) ((1 + counter) % 6); GL11.glColor4f(1f, 1f, 1f, 1f); if (((GT_Container_MultiMachineEM) mContainer).ePowerPass) @@ -132,7 +133,7 @@ public class GT_GUIContainer_MultiMachineEM extends GT_GUIContainerMetaTile_Mach rU + ((state & 8) == 0 ? 44 : 12), Vs + 12, 6, 6); break; - case 5://xox ooo xox + case 5://xox oxo xox drawTexturedModalRect(x, y, rU + ((state & 1) == 0 ? 32 : 0), Vs, 6, 6); @@ -156,31 +157,31 @@ public class GT_GUIContainer_MultiMachineEM extends GT_GUIContainerMetaTile_Mach private void LEDdrawP(int x, int y, int i, int j, byte status) { final int v = 192, su = 8, sv = 6, u = 11; switch (status) { - case 6: - if (cntr < 2) { + case PARAM_WRONG: + if (counter < 2) { drawTexturedModalRect(x + su * i, y + sv * j, u + su * i, v + sv * j, su, sv); break; - } else if (cntr < 4) { + } else if (counter < 4) { drawTexturedModalRect(x + su * i, y + sv * j, u + su * i, v + sv * (8 + j), su, sv); break; } - case 1://ok + case PARAM_OK://ok drawTexturedModalRect(x + su * i, y + sv * j, u + su * i, v + sv * (4 + j), su, sv); break; - case 2://too low blink - if (cntr < 3) { + case PARAM_TOO_LOW://too low blink + if (counter < 3) { drawTexturedModalRect(x + su * i, y + sv * j, u + su * i, v + sv * j, su, sv); break; } - case 3:// too low + case PARAM_LOW:// too low drawTexturedModalRect(x + su * i, y + sv * j, u + su * i, v + sv * (2 + j), su, sv); break; - case 4://too high blink - if (cntr < 3) { + case PARAM_TOO_HIGH://too high blink + if (counter < 3) { drawTexturedModalRect(x + su * i, y + sv * j, u + su * i, v + sv * (8 + j), su, sv); break; } - case 5:// too high + case PARAM_HIGH:// too high drawTexturedModalRect(x + su * i, y + sv * j, u + su * i, v + sv * (6 + j), su, sv); break; } -- cgit From 459d673501591141d158ebae212857dc9c19db1e Mon Sep 17 00:00:00 2001 From: Technus Date: Sun, 27 Aug 2017 22:06:35 +0200 Subject: Texturing, gui rework --- .../technus/tectech/loader/MachineLoader.java | 2 +- .../technus/tectech/recipe/TT_recipeAdder.java | 6 +- .../multi/GT_MetaTileEntity_EM_annihilation.java | 26 +++++ .../multi/GT_MetaTileEntity_EM_computer.java | 14 +++ .../multi/GT_MetaTileEntity_EM_crafter.java | 83 ---------------- .../multi/GT_MetaTileEntity_EM_crafting.java | 109 +++++++++++++++++++++ .../multi/GT_MetaTileEntity_EM_decay.java | 26 +++++ .../multi/GT_MetaTileEntity_EM_research.java | 2 +- .../multi/GT_MetaTileEntity_EM_scanner.java | 4 +- .../multi/GT_MetaTileEntity_EM_transformer.java | 13 +++ .../multi/GT_MetaTileEntity_TM_microwave.java | 13 +++ .../multi/gui/GT_GUIContainer_MultiMachineEM.java | 22 ++++- 12 files changed, 227 insertions(+), 93 deletions(-) delete mode 100644 src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_crafter.java create mode 100644 src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_crafting.java (limited to 'src/main/java/com') diff --git a/src/main/java/com/github/technus/tectech/loader/MachineLoader.java b/src/main/java/com/github/technus/tectech/loader/MachineLoader.java index 6b37db2cee..ebe8642d26 100644 --- a/src/main/java/com/github/technus/tectech/loader/MachineLoader.java +++ b/src/main/java/com/github/technus/tectech/loader/MachineLoader.java @@ -201,7 +201,7 @@ public class MachineLoader implements Runnable { Machine_Multi_EMmachine.set(new GT_MetaTileEntity_EM_machine(15360, "multimachine.em.processing", "Quantum Processing Machine").getStackForm(1L)); - Machine_Multi_EMCrafter.set(new GT_MetaTileEntity_EM_crafter(15370, "multimachine.em.crafter", "Matter Assembler").getStackForm(1L)); + Machine_Multi_EMCrafter.set(new GT_MetaTileEntity_EM_crafting(15370, "multimachine.em.crafter", "Matter Assembler").getStackForm(1L)); Machine_Multi_Stabilizer.set(new GT_MetaTileEntity_EM_stabilizer(15380, "multimachine.em.stabilizer", "Elemental Stabilizer").getStackForm(1L)); diff --git a/src/main/java/com/github/technus/tectech/recipe/TT_recipeAdder.java b/src/main/java/com/github/technus/tectech/recipe/TT_recipeAdder.java index d1933f0ba4..51c9982752 100644 --- a/src/main/java/com/github/technus/tectech/recipe/TT_recipeAdder.java +++ b/src/main/java/com/github/technus/tectech/recipe/TT_recipeAdder.java @@ -5,7 +5,7 @@ import com.github.technus.tectech.elementalMatter.classes.cElementalDefinitionSt import com.github.technus.tectech.elementalMatter.classes.cElementalDefinitionStackMap; import com.github.technus.tectech.elementalMatter.interfaces.iElementalDefinition; import com.github.technus.tectech.thing.item.DefinitionContainer_EM; -import com.github.technus.tectech.thing.metaTileEntity.multi.GT_MetaTileEntity_EM_crafter; +import com.github.technus.tectech.thing.metaTileEntity.multi.GT_MetaTileEntity_EM_crafting; import com.github.technus.tectech.thing.metaTileEntity.multi.GT_MetaTileEntity_EM_machine; import gregtech.api.enums.ItemList; import gregtech.api.util.GT_Recipe; @@ -80,7 +80,7 @@ public class TT_recipeAdder extends GT_RecipeAdder { else if(researchAmperage > Short.MAX_VALUE) researchAmperage=Short.MAX_VALUE; if(computationRequiredPerSec<=0) computationRequiredPerSec=1; else if(computationRequiredPerSec > Short.MAX_VALUE) computationRequiredPerSec=Short.MAX_VALUE; - TT_recipe.GT_Recipe_MapTT.sResearchableFakeRecipes.addFakeRecipe(false, new ItemStack[]{aResearchItem}, new ItemStack[]{aOutput}, new ItemStack[]{ItemList.Tool_DataOrb.getWithName(1L, "Writes Research result for "+ GT_MetaTileEntity_EM_crafter.crafter)}, null, null, totalComputationRequired, researchEUt, researchAmperage|(computationRequiredPerSec<<16)); + TT_recipe.GT_Recipe_MapTT.sResearchableFakeRecipes.addFakeRecipe(false, new ItemStack[]{aResearchItem}, new ItemStack[]{aOutput}, new ItemStack[]{ItemList.Tool_DataOrb.getWithName(1L, "Writes Research result for "+ GT_MetaTileEntity_EM_crafting.crafter)}, null, null, totalComputationRequired, researchEUt, researchAmperage|(computationRequiredPerSec<<16)); TT_recipe.TT_Recipe_Map.sCrafterRecipes.add(new TT_recipe.TT_assLineRecipe(false,aResearchItem,null,new ItemStack[]{aOutput},new ItemStack[]{ItemList.Tool_DataOrb.getWithName(1L, "Reads Research result")}, null,crafterDuration,crafterEUt,crafterAmperage,eInputs,null,catalyst,check)); return true; @@ -125,7 +125,7 @@ public class TT_recipeAdder extends GT_RecipeAdder { else if(computationRequiredPerSec > Short.MAX_VALUE) computationRequiredPerSec=Short.MAX_VALUE; ItemStack placeholder=new ItemStack(DefinitionContainer_EM.INSTANCE); DefinitionContainer_EM.setContent(placeholder,new cElementalDefinitionStackMap(new cElementalDefinitionStack(aResearchEM,1))); - GT_Recipe thisRecipe=TT_recipe.GT_Recipe_MapTT.sScannableFakeRecipes.addFakeRecipe(false, new ItemStack[]{placeholder}, new ItemStack[]{aOutput}, new ItemStack[]{ItemList.Tool_DataOrb.getWithName(1L, "Writes Research result for "+GT_MetaTileEntity_EM_crafter.crafter)}, null, null, totalComputationRequired, researchEUt, researchAmperage|(computationRequiredPerSec<<16)); + GT_Recipe thisRecipe=TT_recipe.GT_Recipe_MapTT.sScannableFakeRecipes.addFakeRecipe(false, new ItemStack[]{placeholder}, new ItemStack[]{aOutput}, new ItemStack[]{ItemList.Tool_DataOrb.getWithName(1L, "Writes Research result for "+ GT_MetaTileEntity_EM_crafting.crafter)}, null, null, totalComputationRequired, researchEUt, researchAmperage|(computationRequiredPerSec<<16)); TT_recipe.TT_Recipe_Map_EM.sCrafterRecipesEM.add(new TT_recipe.TT_EMRecipe(false,thisRecipe,aResearchEM,null,new ItemStack[]{aOutput},new ItemStack[]{ItemList.Tool_DataOrb.getWithName(1L, "Reads Research result")}, null,crafterDuration,crafterEUt,crafterAmperage,eInputs,null,catalyst,check)); return true; diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_annihilation.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_annihilation.java index ec6e4497cd..2ff9659b73 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_annihilation.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_annihilation.java @@ -3,20 +3,30 @@ package com.github.technus.tectech.thing.metaTileEntity.multi; import com.github.technus.tectech.CommonValues; import com.github.technus.tectech.thing.block.QuantumGlassBlock; import com.github.technus.tectech.thing.metaTileEntity.IConstructable; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import gregtech.api.enums.Textures; +import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.metatileentity.IMetaTileEntity; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; +import gregtech.api.objects.GT_RenderedTexture; import net.minecraft.block.Block; +import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.item.ItemStack; import net.minecraft.util.EnumChatFormatting; import static com.github.technus.tectech.Util.StructureBuilder; import static com.github.technus.tectech.thing.casing.GT_Block_CasingsTT.textureOffset; +import static com.github.technus.tectech.thing.casing.GT_Block_CasingsTT.texturePage; import static com.github.technus.tectech.thing.casing.TT_Container_Casings.sBlockCasingsTT; /** * Created by danie_000 on 17.12.2016. */ public class GT_MetaTileEntity_EM_annihilation extends GT_MetaTileEntity_MultiblockBase_EM implements IConstructable { + private static Textures.BlockIcons.CustomIcon ScreenOFF; + private static Textures.BlockIcons.CustomIcon ScreenON; + //region structure private static final String[][] shape = new String[][]{ {"\u0002","D000","C0 0","C0 . 0","C0 0","D000"}, @@ -56,6 +66,22 @@ public class GT_MetaTileEntity_EM_annihilation extends GT_MetaTileEntity_Multibl return new GT_MetaTileEntity_EM_annihilation(this.mName); } + @Override + @SideOnly(Side.CLIENT) + public void registerIcons(IIconRegister aBlockIconRegister) { + ScreenOFF = new Textures.BlockIcons.CustomIcon("iconsets/EM_ANNIHILATION"); + ScreenON = new Textures.BlockIcons.CustomIcon("iconsets/EM_ANNIHILATION_ACTIVE"); + super.registerIcons(aBlockIconRegister); + } + + @Override + public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) { + if (aSide == aFacing) { + return new ITexture[]{Textures.BlockIcons.casingTexturePages[texturePage][12], new GT_RenderedTexture(aActive ? ScreenON : ScreenOFF)}; + } + return new ITexture[]{Textures.BlockIcons.casingTexturePages[texturePage][12]}; + } + @Override public boolean checkMachine_EM(IGregTechTileEntity iGregTechTileEntity, ItemStack itemStack) { return structureCheck_EM(shape, blockType, blockMeta, addingMethods, casingTextures, blockTypeFallback, blockMetaFallback, 5, 5, 0); diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_computer.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_computer.java index df74ff604d..34a96c7810 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_computer.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_computer.java @@ -9,6 +9,8 @@ import com.github.technus.tectech.thing.metaTileEntity.IConstructable; import com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_Hatch_InputData; import com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_Hatch_OutputData; import com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_Hatch_Rack; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; import gregtech.api.enums.Textures; import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.metatileentity.IMetaTileEntity; @@ -17,6 +19,7 @@ import gregtech.api.metatileentity.MetaTileEntity; import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch; import gregtech.api.objects.GT_RenderedTexture; import net.minecraft.block.Block; +import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.item.ItemStack; import net.minecraft.util.EnumChatFormatting; @@ -33,6 +36,9 @@ import static com.github.technus.tectech.thing.casing.TT_Container_Casings.sBloc * Created by danie_000 on 17.12.2016. */ public class GT_MetaTileEntity_EM_computer extends GT_MetaTileEntity_MultiblockBase_EM implements IConstructable { + private static Textures.BlockIcons.CustomIcon ScreenOFF; + private static Textures.BlockIcons.CustomIcon ScreenON; + private final ArrayList eRacks = new ArrayList<>(); private int maxTemp = 0; @@ -70,6 +76,14 @@ public class GT_MetaTileEntity_EM_computer extends GT_MetaTileEntity_MultiblockB return new GT_MetaTileEntity_EM_computer(this.mName); } + @Override + @SideOnly(Side.CLIENT) + public void registerIcons(IIconRegister aBlockIconRegister) { + ScreenOFF = new Textures.BlockIcons.CustomIcon("iconsets/EM_COMPUTER"); + ScreenON = new Textures.BlockIcons.CustomIcon("iconsets/EM_COMPUTER_ACTIVE"); + super.registerIcons(aBlockIconRegister); + } + @Override public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) { if (aSide == aFacing) { diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_crafter.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_crafter.java deleted file mode 100644 index affcd442ee..0000000000 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_crafter.java +++ /dev/null @@ -1,83 +0,0 @@ -package com.github.technus.tectech.thing.metaTileEntity.multi; - -import com.github.technus.tectech.CommonValues; -import com.github.technus.tectech.thing.block.QuantumGlassBlock; -import com.github.technus.tectech.thing.metaTileEntity.IConstructable; -import gregtech.api.interfaces.metatileentity.IMetaTileEntity; -import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import net.minecraft.block.Block; -import net.minecraft.item.ItemStack; -import net.minecraft.util.EnumChatFormatting; - -import static com.github.technus.tectech.Util.StructureBuilder; -import static com.github.technus.tectech.thing.casing.GT_Block_CasingsTT.textureOffset; -import static com.github.technus.tectech.thing.casing.TT_Container_Casings.sBlockCasingsTT; - -/** - * Created by danie_000 on 17.12.2016. - */ -public class GT_MetaTileEntity_EM_crafter extends GT_MetaTileEntity_MultiblockBase_EM implements IConstructable { - public final static String crafter="EM Crafting"; - //region structure - private static final String[][] shape = new String[][]{ - {"A000","0 0","0 . 0","0 0","A000",}, - {"00000","00000","00000","00000","00000",}, - {"0C0","A!!!","A!1!","A!!!","0C0",}, - {"22222","22222","22122","22222","22222",}, - {"23432","33333","43134","33333","23432",}, - {"23332","33333","33533","33333","23332",}, - {"23432","33333","43134","33333","23432",}, - {"22222","22222","22122","22222","22222",}, - {"0C0","A!!!","A!1!","A!!!","0C0",}, - {"00000","00000","00000","00000","00000",}, - {"A000","0 0","0 0","0 0","A000",}, - }; - private static final Block[] blockType = new Block[]{sBlockCasingsTT, sBlockCasingsTT, sBlockCasingsTT , QuantumGlassBlock.INSTANCE, sBlockCasingsTT, sBlockCasingsTT}; - private static final byte[] blockMeta = new byte[]{4, 10, 5, 0, 6, 9}; - private static final String[] addingMethods = new String[]{"addClassicToMachineList", "addElementalToMachineList"}; - private static final short[] casingTextures = new short[]{textureOffset, textureOffset + 4}; - private static final Block[] blockTypeFallback = new Block[]{sBlockCasingsTT, sBlockCasingsTT}; - private static final byte[] blockMetaFallback = new byte[]{0, 4}; - private static final String[] description = new String[]{ - EnumChatFormatting.AQUA+"Hint Details:", - "1 - Classic Hatches or High Power Casing", - "2 - Elemental Hatches or Molecular Casing", - }; - //endregion - - public GT_MetaTileEntity_EM_crafter(int aID, String aName, String aNameRegional) { - super(aID, aName, aNameRegional); - } - - public GT_MetaTileEntity_EM_crafter(String aName) { - super(aName); - } - - public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { - return new GT_MetaTileEntity_EM_crafter(this.mName); - } - - @Override - public boolean checkMachine_EM(IGregTechTileEntity iGregTechTileEntity, ItemStack itemStack) { - return structureCheck_EM(shape, blockType, blockMeta, addingMethods, casingTextures, blockTypeFallback, blockMetaFallback, 2, 2, 0); - } - - @Override - public void construct(int stackSize, boolean hintsOnly) { - StructureBuilder(shape, blockType, blockMeta,2, 2, 0, getBaseMetaTileEntity(),hintsOnly); - } - - @Override - public String[] getStructureDescription(int stackSize) { - return description; - } - - @Override - public String[] getDescription() { - return new String[]{ - CommonValues.tecMark, - "The most precise way of making stuff.", - EnumChatFormatting.AQUA.toString() + EnumChatFormatting.BOLD + "(Trans-Planck process)" - }; - } -} diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_crafting.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_crafting.java new file mode 100644 index 0000000000..79ece0f7be --- /dev/null +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_crafting.java @@ -0,0 +1,109 @@ +package com.github.technus.tectech.thing.metaTileEntity.multi; + +import com.github.technus.tectech.CommonValues; +import com.github.technus.tectech.thing.block.QuantumGlassBlock; +import com.github.technus.tectech.thing.metaTileEntity.IConstructable; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import gregtech.api.enums.Textures; +import gregtech.api.interfaces.ITexture; +import gregtech.api.interfaces.metatileentity.IMetaTileEntity; +import gregtech.api.interfaces.tileentity.IGregTechTileEntity; +import gregtech.api.objects.GT_RenderedTexture; +import net.minecraft.block.Block; +import net.minecraft.client.renderer.texture.IIconRegister; +import net.minecraft.item.ItemStack; +import net.minecraft.util.EnumChatFormatting; + +import static com.github.technus.tectech.Util.StructureBuilder; +import static com.github.technus.tectech.thing.casing.GT_Block_CasingsTT.textureOffset; +import static com.github.technus.tectech.thing.casing.GT_Block_CasingsTT.texturePage; +import static com.github.technus.tectech.thing.casing.TT_Container_Casings.sBlockCasingsTT; + +/** + * Created by danie_000 on 17.12.2016. + */ +public class GT_MetaTileEntity_EM_crafting extends GT_MetaTileEntity_MultiblockBase_EM implements IConstructable { + private static Textures.BlockIcons.CustomIcon ScreenOFF; + private static Textures.BlockIcons.CustomIcon ScreenON; + + public final static String crafter="EM Crafting"; + //region structure + private static final String[][] shape = new String[][]{ + {"A000","0 0","0 . 0","0 0","A000",}, + {"00000","00000","00000","00000","00000",}, + {"0C0","A!!!","A!1!","A!!!","0C0",}, + {"22222","22222","22122","22222","22222",}, + {"23432","33333","43134","33333","23432",}, + {"23332","33333","33533","33333","23332",}, + {"23432","33333","43134","33333","23432",}, + {"22222","22222","22122","22222","22222",}, + {"0C0","A!!!","A!1!","A!!!","0C0",}, + {"00000","00000","00000","00000","00000",}, + {"A000","0 0","0 0","0 0","A000",}, + }; + private static final Block[] blockType = new Block[]{sBlockCasingsTT, sBlockCasingsTT, sBlockCasingsTT , QuantumGlassBlock.INSTANCE, sBlockCasingsTT, sBlockCasingsTT}; + private static final byte[] blockMeta = new byte[]{4, 10, 5, 0, 6, 9}; + private static final String[] addingMethods = new String[]{"addClassicToMachineList", "addElementalToMachineList"}; + private static final short[] casingTextures = new short[]{textureOffset, textureOffset + 4}; + private static final Block[] blockTypeFallback = new Block[]{sBlockCasingsTT, sBlockCasingsTT}; + private static final byte[] blockMetaFallback = new byte[]{0, 4}; + private static final String[] description = new String[]{ + EnumChatFormatting.AQUA+"Hint Details:", + "1 - Classic Hatches or High Power Casing", + "2 - Elemental Hatches or Molecular Casing", + }; + //endregion + + public GT_MetaTileEntity_EM_crafting(int aID, String aName, String aNameRegional) { + super(aID, aName, aNameRegional); + } + + public GT_MetaTileEntity_EM_crafting(String aName) { + super(aName); + } + + public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { + return new GT_MetaTileEntity_EM_crafting(this.mName); + } + + @Override + @SideOnly(Side.CLIENT) + public void registerIcons(IIconRegister aBlockIconRegister) { + ScreenOFF = new Textures.BlockIcons.CustomIcon("iconsets/EM_CRAFTING"); + ScreenON = new Textures.BlockIcons.CustomIcon("iconsets/EM_CRAFTING_ACTIVE"); + super.registerIcons(aBlockIconRegister); + } + + @Override + public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) { + if (aSide == aFacing) { + return new ITexture[]{Textures.BlockIcons.casingTexturePages[texturePage][12], new GT_RenderedTexture(aActive ? ScreenON : ScreenOFF)}; + } + return new ITexture[]{Textures.BlockIcons.casingTexturePages[texturePage][12]}; + } + + @Override + public boolean checkMachine_EM(IGregTechTileEntity iGregTechTileEntity, ItemStack itemStack) { + return structureCheck_EM(shape, blockType, blockMeta, addingMethods, casingTextures, blockTypeFallback, blockMetaFallback, 2, 2, 0); + } + + @Override + public void construct(int stackSize, boolean hintsOnly) { + StructureBuilder(shape, blockType, blockMeta,2, 2, 0, getBaseMetaTileEntity(),hintsOnly); + } + + @Override + public String[] getStructureDescription(int stackSize) { + return description; + } + + @Override + public String[] getDescription() { + return new String[]{ + CommonValues.tecMark, + "The most precise way of making stuff.", + EnumChatFormatting.AQUA.toString() + EnumChatFormatting.BOLD + "(Trans-Planck process)" + }; + } +} diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_decay.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_decay.java index 679e0a280d..6802518fc5 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_decay.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_decay.java @@ -5,10 +5,16 @@ import com.github.technus.tectech.elementalMatter.classes.cElementalInstanceStac import com.github.technus.tectech.elementalMatter.classes.cElementalInstanceStackMap; import com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_Hatch_EnergyMulti; import com.github.technus.tectech.thing.metaTileEntity.IConstructable; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import gregtech.api.enums.Textures; +import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.metatileentity.IMetaTileEntity; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Energy; +import gregtech.api.objects.GT_RenderedTexture; import net.minecraft.block.Block; +import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.item.ItemStack; import net.minecraft.util.EnumChatFormatting; @@ -16,12 +22,16 @@ import static com.github.technus.tectech.Util.StructureBuilder; import static com.github.technus.tectech.Util.VN; import static com.github.technus.tectech.elementalMatter.interfaces.iElementalDefinition.stableRawLifeTime; import static com.github.technus.tectech.thing.casing.GT_Block_CasingsTT.textureOffset; +import static com.github.technus.tectech.thing.casing.GT_Block_CasingsTT.texturePage; import static com.github.technus.tectech.thing.casing.TT_Container_Casings.sBlockCasingsTT; /** * Created by danie_000 on 17.12.2016. */ public class GT_MetaTileEntity_EM_decay extends GT_MetaTileEntity_MultiblockBase_EM implements IConstructable { + private static Textures.BlockIcons.CustomIcon ScreenOFF; + private static Textures.BlockIcons.CustomIcon ScreenON; + //region structure private static final String[][] shape = new String[][]{ {"0C0","A ","A . ","A ","0C0",}, @@ -59,6 +69,22 @@ public class GT_MetaTileEntity_EM_decay extends GT_MetaTileEntity_MultiblockBase return new GT_MetaTileEntity_EM_decay(this.mName); } + @Override + @SideOnly(Side.CLIENT) + public void registerIcons(IIconRegister aBlockIconRegister) { + ScreenOFF = new Textures.BlockIcons.CustomIcon("iconsets/EM_DECAY"); + ScreenON = new Textures.BlockIcons.CustomIcon("iconsets/EM_DECAY_ACTIVE"); + super.registerIcons(aBlockIconRegister); + } + + @Override + public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) { + if (aSide == aFacing) { + return new ITexture[]{Textures.BlockIcons.casingTexturePages[texturePage][12], new GT_RenderedTexture(aActive ? ScreenON : ScreenOFF)}; + } + return new ITexture[]{Textures.BlockIcons.casingTexturePages[texturePage][12]}; + } + @Override public boolean checkMachine_EM(IGregTechTileEntity iGregTechTileEntity, ItemStack itemStack) { return structureCheck_EM(shape, blockType, blockMeta, addingMethods, casingTextures, blockTypeFallback, blockMetaFallback, 2, 2, 0); diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_research.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_research.java index d481d5fd24..679e44ee8e 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_research.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_research.java @@ -34,7 +34,7 @@ import static com.github.technus.tectech.recipe.TT_recipe.E_RECIPE_ID; import static com.github.technus.tectech.thing.casing.GT_Block_CasingsTT.textureOffset; import static com.github.technus.tectech.thing.casing.GT_Block_CasingsTT.texturePage; import static com.github.technus.tectech.thing.casing.TT_Container_Casings.sBlockCasingsTT; -import static com.github.technus.tectech.thing.metaTileEntity.multi.GT_MetaTileEntity_EM_crafter.crafter; +import static com.github.technus.tectech.thing.metaTileEntity.multi.GT_MetaTileEntity_EM_crafting.crafter; import static com.github.technus.tectech.thing.metaTileEntity.multi.GT_MetaTileEntity_EM_machine.machine; import static gregtech.api.enums.GT_Values.E; diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_scanner.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_scanner.java index e73a313619..0c79bf96fc 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_scanner.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_scanner.java @@ -151,7 +151,7 @@ public class GT_MetaTileEntity_EM_scanner extends GT_MetaTileEntity_MultiblockBa } else { eRecipe = TT_recipe.TT_Recipe_Map_EM.sCrafterRecipesEM.findRecipe(objectResearched.definition); if (eRecipe != null) { - machineType = GT_MetaTileEntity_EM_crafter.crafter; + machineType = GT_MetaTileEntity_EM_crafting.crafter; } } } @@ -186,7 +186,7 @@ public class GT_MetaTileEntity_EM_scanner extends GT_MetaTileEntity_MultiblockBa eRecipe = TT_recipe.TT_Recipe_Map_EM.sCrafterRecipesEM.findRecipe(stackEM.definition); if(eRecipe!=null) { scannerRecipe=eRecipe.scannerRecipe; - machineType=GT_MetaTileEntity_EM_crafter.crafter; + machineType= GT_MetaTileEntity_EM_crafting.crafter; objectResearched=new cElementalDefinitionStack(stackEM.definition,1); //cleanMassEM_EM(objectResearched.getMass()); researchEM.remove(objectResearched.definition); diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_transformer.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_transformer.java index 8d8b758103..afa09f57d9 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_transformer.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_transformer.java @@ -2,12 +2,15 @@ package com.github.technus.tectech.thing.metaTileEntity.multi; import com.github.technus.tectech.CommonValues; import com.github.technus.tectech.thing.metaTileEntity.IConstructable; +import com.github.technus.tectech.thing.metaTileEntity.multi.gui.GT_Container_MultiMachineEM; +import com.github.technus.tectech.thing.metaTileEntity.multi.gui.GT_GUIContainer_MultiMachineEM; import gregtech.api.enums.Textures; import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.metatileentity.IMetaTileEntity; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.objects.GT_RenderedTexture; import net.minecraft.block.Block; +import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.item.ItemStack; import net.minecraft.util.EnumChatFormatting; @@ -73,6 +76,16 @@ public class GT_MetaTileEntity_EM_transformer extends GT_MetaTileEntity_Multiblo StructureBuilder(shape, blockType, blockMeta,1, 1, 0, getBaseMetaTileEntity(),hintsOnly); } + @Override + public Object getServerGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { + return new GT_Container_MultiMachineEM(aPlayerInventory, aBaseMetaTileEntity,true,false,false); + } + + @Override + public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { + return new GT_GUIContainer_MultiMachineEM(aPlayerInventory, aBaseMetaTileEntity, this.getLocalName(), "EMDisplay.png",true,false,false); + } + @Override public String[] getStructureDescription(int stackSize) { return description; diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_TM_microwave.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_TM_microwave.java index a63f948bf1..95fbbd9d56 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_TM_microwave.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_TM_microwave.java @@ -3,6 +3,8 @@ package com.github.technus.tectech.thing.metaTileEntity.multi; import com.github.technus.tectech.CommonValues; import com.github.technus.tectech.auxiliary.Reference; import com.github.technus.tectech.thing.metaTileEntity.IConstructable; +import com.github.technus.tectech.thing.metaTileEntity.multi.gui.GT_Container_MultiMachineEM; +import com.github.technus.tectech.thing.metaTileEntity.multi.gui.GT_GUIContainer_MultiMachineEM; import gregtech.api.enums.Textures; import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.metatileentity.IMetaTileEntity; @@ -15,6 +17,7 @@ import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLiving; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.item.EntityItem; +import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.AxisAlignedBB; @@ -90,6 +93,16 @@ public class GT_MetaTileEntity_TM_microwave extends GT_MetaTileEntity_Multiblock return new ITexture[]{Textures.BlockIcons.CASING_BLOCKS[49]}; } + @Override + public Object getServerGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { + return new GT_Container_MultiMachineEM(aPlayerInventory, aBaseMetaTileEntity, false, false, true); + } + + @Override + public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { + return new GT_GUIContainer_MultiMachineEM(aPlayerInventory, aBaseMetaTileEntity, this.getLocalName(), "EMDisplay.png", false, false, true); + } + @Override public boolean isFacingValid(byte aFacing) { return aFacing >= 2; diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/gui/GT_GUIContainer_MultiMachineEM.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/gui/GT_GUIContainer_MultiMachineEM.java index e1b4c2775c..98e60e4498 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/gui/GT_GUIContainer_MultiMachineEM.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/gui/GT_GUIContainer_MultiMachineEM.java @@ -15,10 +15,20 @@ import static gregtech.api.enums.GT_Values.RES_PATH_GUI; public class GT_GUIContainer_MultiMachineEM extends GT_GUIContainerMetaTile_Machine { String mName = ""; private static byte counter = 0; + public final boolean ePowerPassButton, eSafeVoidButton, allowedToWorkButton; + + public GT_GUIContainer_MultiMachineEM(InventoryPlayer aInventoryPlayer, IGregTechTileEntity aTileEntity, String aName, String aTextureFile, boolean enablePowerPass, boolean enableSafeVoid, boolean enablePowerButton) { + super(new GT_Container_MultiMachineEM(aInventoryPlayer, aTileEntity), RES_PATH_GUI + "multimachines/" + (aTextureFile == null ? "MultiblockDisplay" : aTextureFile)); + mName = aName; + ePowerPassButton=enablePowerPass; + eSafeVoidButton=enableSafeVoid; + allowedToWorkButton=enablePowerButton; + } public GT_GUIContainer_MultiMachineEM(InventoryPlayer aInventoryPlayer, IGregTechTileEntity aTileEntity, String aName, String aTextureFile) { super(new GT_Container_MultiMachineEM(aInventoryPlayer, aTileEntity), RES_PATH_GUI + "multimachines/" + (aTextureFile == null ? "MultiblockDisplay" : aTextureFile)); mName = aName; + ePowerPassButton=eSafeVoidButton=allowedToWorkButton=true; } @Override @@ -68,13 +78,19 @@ public class GT_GUIContainer_MultiMachineEM extends GT_GUIContainerMetaTile_Mach counter = (byte) ((1 + counter) % 6); GL11.glColor4f(1f, 1f, 1f, 1f); - if (((GT_Container_MultiMachineEM) mContainer).ePowerPass) + if(!ePowerPassButton) + drawTexturedModalRect(x + 151, y + 23, 215, 23, 18, 18); + else if (((GT_Container_MultiMachineEM) mContainer).ePowerPass) drawTexturedModalRect(x + 151, y + 23, 183, 23, 18, 18); - if (((GT_Container_MultiMachineEM) mContainer).eSafeVoid) + if(!eSafeVoidButton) + drawTexturedModalRect(x + 151, y + 41, 215, 41, 18, 18); + else if (((GT_Container_MultiMachineEM) mContainer).eSafeVoid) drawTexturedModalRect(x + 151, y + 41, 183, 41, 18, 18); - if (((GT_Container_MultiMachineEM) mContainer).allowedToWork) + if(!allowedToWorkButton) + drawTexturedModalRect(x + 151, y + 57, 215, 57, 18, 18); + else if (((GT_Container_MultiMachineEM) mContainer).allowedToWork) drawTexturedModalRect(x + 151, y + 57, 183, 57, 18, 18); x += 11; -- cgit From a7a53f1ae83926fa4016ce175fdaabe52b555870 Mon Sep 17 00:00:00 2001 From: Technus Date: Sun, 27 Aug 2017 22:42:32 +0200 Subject: Some more gui and mechanics changes --- .../multi/GT_MetaTileEntity_EM_infuser.java | 25 +++--- .../multi/GT_MetaTileEntity_EM_scanner.java | 3 +- .../multi/GT_MetaTileEntity_EM_transformer.java | 4 +- .../multi/GT_MetaTileEntity_MultiblockBase_EM.java | 92 +++++++++++----------- .../multi/GT_MetaTileEntity_TM_microwave.java | 5 -- .../multi/gui/GT_Container_MultiMachineEM.java | 8 +- 6 files changed, 73 insertions(+), 64 deletions(-) (limited to 'src/main/java/com') diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_infuser.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_infuser.java index 23d472f5eb..eb6b3f06c1 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_infuser.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_infuser.java @@ -4,11 +4,14 @@ import cofh.api.energy.IEnergyContainerItem; import com.github.technus.tectech.CommonValues; import com.github.technus.tectech.TecTech; import com.github.technus.tectech.thing.metaTileEntity.IConstructable; +import com.github.technus.tectech.thing.metaTileEntity.multi.gui.GT_Container_MultiMachineEM; +import com.github.technus.tectech.thing.metaTileEntity.multi.gui.GT_GUIContainer_MultiMachineEM; import gregtech.api.interfaces.metatileentity.IMetaTileEntity; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import ic2.api.item.ElectricItem; import ic2.api.item.IElectricItem; import net.minecraft.block.Block; +import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.util.EnumChatFormatting; @@ -44,11 +47,13 @@ public class GT_MetaTileEntity_EM_infuser extends GT_MetaTileEntity_MultiblockBa public GT_MetaTileEntity_EM_infuser(int aID, String aName, String aNameRegional) { super(aID, aName, aNameRegional); minRepairStatus = (byte) getIdealStatus(); + eDismantleBoom=true; } public GT_MetaTileEntity_EM_infuser(String aName) { super(aName); minRepairStatus = (byte) getIdealStatus(); + eDismantleBoom=true; } @Override @@ -60,6 +65,16 @@ public class GT_MetaTileEntity_EM_infuser extends GT_MetaTileEntity_MultiblockBa return new GT_MetaTileEntity_EM_infuser(this.mName); } + @Override + public Object getServerGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { + return new GT_Container_MultiMachineEM(aPlayerInventory, aBaseMetaTileEntity,true,false,true); + } + + @Override + public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { + return new GT_GUIContainer_MultiMachineEM(aPlayerInventory, aBaseMetaTileEntity, this.getLocalName(), "EMDisplay.png",true,false,true); + } + @Override public boolean checkMachine_EM(IGregTechTileEntity iGregTechTileEntity, ItemStack itemStack) { return structureCheck_EM(shape, blockType, blockMeta, addingMethods, casingTextures, blockTypeFallback, blockMetaFallback, 1, 2, 0); @@ -82,18 +97,15 @@ public class GT_MetaTileEntity_EM_infuser extends GT_MetaTileEntity_MultiblockBa if (ofThis instanceof IElectricItem) { mEfficiencyIncrease = 10000; mMaxProgresstime = 20; - eDismatleBoom = true; return true; } else if (TecTech.hasCOFH && ofThis instanceof IEnergyContainerItem) { mEfficiencyIncrease = 10000; mMaxProgresstime = 20; - eDismatleBoom = true; return true; } } mEfficiencyIncrease = 0; mMaxProgresstime = 0; - eDismatleBoom = false; eAmpereFlow = 0; mEUt = 0; return false; @@ -117,13 +129,6 @@ public class GT_MetaTileEntity_EM_infuser extends GT_MetaTileEntity_MultiblockBa this.getBaseMetaTileEntity().disableWorking(); } - @Override - public void onPreTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) { - if ((aTick & 31) == 31) { - eSafeVoid = false; - } - } - @Override public String[] getDescription() { return new String[]{ diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_scanner.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_scanner.java index 0c79bf96fc..3ee6496265 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_scanner.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_scanner.java @@ -71,10 +71,12 @@ public class GT_MetaTileEntity_EM_scanner extends GT_MetaTileEntity_MultiblockBa public GT_MetaTileEntity_EM_scanner(int aID, String aName, String aNameRegional) { super(aID, aName, aNameRegional); + eDismantleBoom=true; } public GT_MetaTileEntity_EM_scanner(String aName) { super(aName); + eDismantleBoom=true; } public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEnt