diff options
author | Tec <daniel112092@gmail.com> | 2021-01-25 20:24:18 +0100 |
---|---|---|
committer | Tec <daniel112092@gmail.com> | 2021-01-25 20:24:18 +0100 |
commit | f1abb31f609b9f2ae89cea9169180fd85da77fa1 (patch) | |
tree | 951c8558cc06157ae7c0cdb6d5d1c0b9b1d6d257 /src/main | |
parent | 54da6804038db3a00696ebe83fbc4f8d3c8ff50b (diff) | |
download | GT5-Unofficial-f1abb31f609b9f2ae89cea9169180fd85da77fa1.tar.gz GT5-Unofficial-f1abb31f609b9f2ae89cea9169180fd85da77fa1.tar.bz2 GT5-Unofficial-f1abb31f609b9f2ae89cea9169180fd85da77fa1.zip |
PowerPassCover
Diffstat (limited to 'src/main')
9 files changed, 63 insertions, 40 deletions
diff --git a/src/main/java/com/github/technus/tectech/thing/cover/GT_Cover_TM_PowerPassUpgrade.java b/src/main/java/com/github/technus/tectech/thing/cover/GT_Cover_TM_PowerPassUpgrade.java index ce40a33dff..dbbd5be370 100644 --- a/src/main/java/com/github/technus/tectech/thing/cover/GT_Cover_TM_PowerPassUpgrade.java +++ b/src/main/java/com/github/technus/tectech/thing/cover/GT_Cover_TM_PowerPassUpgrade.java @@ -3,35 +3,47 @@ package com.github.technus.tectech.thing.cover; import com.github.technus.tectech.thing.metaTileEntity.multi.base.GT_MetaTileEntity_MultiblockBase_EM; import gregtech.api.interfaces.tileentity.ICoverable; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; +import gregtech.api.objects.GT_ItemStack; import gregtech.api.util.GT_CoverBehavior; +import net.minecraft.item.ItemStack; public class GT_Cover_TM_PowerPassUpgrade extends GT_CoverBehavior { public GT_Cover_TM_PowerPassUpgrade() { } + public boolean isCoverPlaceable(byte aSide, GT_ItemStack aStack, ICoverable aTileEntity) { + IGregTechTileEntity iGregTechTileEntityOffset = aTileEntity.getIGregTechTileEntityOffset(0, 0, 0); + if (iGregTechTileEntityOffset instanceof GT_MetaTileEntity_MultiblockBase_EM) { + GT_MetaTileEntity_MultiblockBase_EM multi = (GT_MetaTileEntity_MultiblockBase_EM) iGregTechTileEntityOffset; + return !multi.ePowerPassCapable; + } + return false; + } + @Override - public int doCoverThings(byte aSide, byte aInputRedstone, int aCoverID, int aCoverVariable, ICoverable aTileEntity, long aTimer) { - IGregTechTileEntity TE = aTileEntity.getIGregTechTileEntityOffset(0, 0, 0); - if (TE instanceof GT_MetaTileEntity_MultiblockBase_EM) { - GT_MetaTileEntity_MultiblockBase_EM multi = (GT_MetaTileEntity_MultiblockBase_EM) TE; - multi.ePowerPassUpgraded = true; + public void placeCover(byte aSide, ItemStack aCover, ICoverable aTileEntity) { + IGregTechTileEntity iGregTechTileEntityOffset = aTileEntity.getIGregTechTileEntityOffset(0, 0, 0); + if (iGregTechTileEntityOffset instanceof GT_MetaTileEntity_MultiblockBase_EM) { + GT_MetaTileEntity_MultiblockBase_EM multi = (GT_MetaTileEntity_MultiblockBase_EM) iGregTechTileEntityOffset; + multi.ePowerPassCapable = true; + multi.ePowerPass = true; } - return super.doCoverThings(aSide, aInputRedstone, aCoverID, aCoverVariable, aTileEntity, aTimer); + super.placeCover(aSide, aCover, aTileEntity); } @Override public boolean onCoverRemoval(byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity, boolean aForced) { - IGregTechTileEntity TE = aTileEntity.getIGregTechTileEntityOffset(0, 0, 0); - if (TE instanceof GT_MetaTileEntity_MultiblockBase_EM) { - GT_MetaTileEntity_MultiblockBase_EM multi = (GT_MetaTileEntity_MultiblockBase_EM) TE; - multi.ePowerPassUpgraded = false; + IGregTechTileEntity iGregTechTileEntityOffset = aTileEntity.getIGregTechTileEntityOffset(0, 0, 0); + if (iGregTechTileEntityOffset instanceof GT_MetaTileEntity_MultiblockBase_EM) { + GT_MetaTileEntity_MultiblockBase_EM multi = (GT_MetaTileEntity_MultiblockBase_EM) iGregTechTileEntityOffset; + multi.ePowerPassCapable = false; + multi.ePowerPass = false; } return true; } - @Override + @Deprecated public int getTickRate(byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity) { - //It updates once every 200 ticks, so once every 10 seconds - return 200; + return 0; } } diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_dataBank.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_dataBank.java index 77647a0e20..6d4f096e91 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_dataBank.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_dataBank.java @@ -130,12 +130,12 @@ public class GT_MetaTileEntity_EM_dataBank extends GT_MetaTileEntity_MultiblockB @Override public Object getServerGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { - return new GT_Container_MultiMachineEM(aPlayerInventory, aBaseMetaTileEntity, true, false, true); + return new GT_Container_MultiMachineEM(aPlayerInventory, aBaseMetaTileEntity, false, true); } @Override public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { - return new GT_GUIContainer_MultiMachineEM(aPlayerInventory, aBaseMetaTileEntity, getLocalName(), "EMDisplay.png", true, false, true);//todo texture + return new GT_GUIContainer_MultiMachineEM(aPlayerInventory, aBaseMetaTileEntity, getLocalName(), "EMDisplay.png", false, true);//todo texture } @Override 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 152d110c8d..a3bc9a2c17 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 @@ -167,12 +167,12 @@ public class GT_MetaTileEntity_EM_infuser extends GT_MetaTileEntity_MultiblockBa @Override public Object getServerGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { - return new GT_Container_MultiMachineEM(aPlayerInventory, aBaseMetaTileEntity, true, false, true); + return new GT_Container_MultiMachineEM(aPlayerInventory, aBaseMetaTileEntity, false, true); } @Override public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { - return new GT_GUIContainer_MultiMachineEM(aPlayerInventory, aBaseMetaTileEntity, getLocalName(), "EMDisplay.png", true, false, true); + return new GT_GUIContainer_MultiMachineEM(aPlayerInventory, aBaseMetaTileEntity, getLocalName(), "EMDisplay.png", false, true); } public final static ResourceLocation activitySound = new ResourceLocation(Reference.MODID + ":fx_whooum"); 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 cdac772541..62de14f019 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 @@ -117,12 +117,12 @@ public class GT_MetaTileEntity_EM_transformer extends GT_MetaTileEntity_Multiblo @Override public Object getServerGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { - return new GT_Container_MultiMachineEM(aPlayerInventory, aBaseMetaTileEntity, true, false, false); + return new GT_Container_MultiMachineEM(aPlayerInventory, aBaseMetaTileEntity, false, false); } @Override public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { - return new GT_GUIContainer_MultiMachineEM(aPlayerInventory, aBaseMetaTileEntity, getLocalName(), "EMDisplay.png", true, false, false); + return new GT_GUIContainer_MultiMachineEM(aPlayerInventory, aBaseMetaTileEntity, getLocalName(), "EMDisplay.png", false, false); } @Override 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 543c09b72a..fa97bd9f8e 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 @@ -198,12 +198,12 @@ public class GT_MetaTileEntity_TM_microwave extends GT_MetaTileEntity_Multiblock @Override public Object getServerGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { - return new GT_Container_MultiMachineEM(aPlayerInventory, aBaseMetaTileEntity, false, true, true); + return new GT_Container_MultiMachineEM(aPlayerInventory, aBaseMetaTileEntity, true, true); } @Override public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { - return new GT_GUIContainer_MultiMachineEM(aPlayerInventory, aBaseMetaTileEntity, getLocalName(), "EMDisplay.png", false, true, true);//todo texture + return new GT_GUIContainer_MultiMachineEM(aPlayerInventory, aBaseMetaTileEntity, getLocalName(), "EMDisplay.png", true, true);//todo texture } @Override diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_TM_proccessingStack.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_TM_proccessingStack.java index 189eae8205..c6c9a654dd 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_TM_proccessingStack.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_TM_proccessingStack.java @@ -99,12 +99,12 @@ public class GT_MetaTileEntity_TM_proccessingStack extends GT_MetaTileEntity_Mul @Override public Object getServerGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { - return new GT_Container_MultiMachineEM(aPlayerInventory, aBaseMetaTileEntity, false, true, true); + return new GT_Container_MultiMachineEM(aPlayerInventory, aBaseMetaTileEntity, true, true); } @Override public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { - return new GT_GUIContainer_MultiMachineEM(aPlayerInventory, aBaseMetaTileEntity, getLocalName(), "EMDisplay.png", false, true, true); + return new GT_GUIContainer_MultiMachineEM(aPlayerInventory, aBaseMetaTileEntity, getLocalName(), "EMDisplay.png", true, true); } @Override diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/base/GT_Container_MultiMachineEM.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/base/GT_Container_MultiMachineEM.java index 8086b70691..7cbd51228e 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/base/GT_Container_MultiMachineEM.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/base/GT_Container_MultiMachineEM.java @@ -20,11 +20,12 @@ public class GT_Container_MultiMachineEM extends GT_ContainerMetaTile_Machine { public long[] eParamsOutl = new long[20]; public byte eCertainMode = 5, eCertainStatus = 127; public boolean ePowerPass = false, eSafeVoid = false, allowedToWork = false; - public final boolean ePowerPassButton, eSafeVoidButton, allowedToWorkButton; + public boolean ePowerPassButton; + public final boolean eSafeVoidButton, allowedToWorkButton; - public GT_Container_MultiMachineEM(InventoryPlayer aInventoryPlayer, IGregTechTileEntity aTileEntity, boolean enablePowerPass, boolean enableSafeVoid, boolean enablePowerButton) { + public GT_Container_MultiMachineEM(InventoryPlayer aInventoryPlayer, IGregTechTileEntity aTileEntity, boolean enableSafeVoid, boolean enablePowerButton) { super(aInventoryPlayer, aTileEntity); - ePowerPassButton=enablePowerPass; + ePowerPassButton=false; eSafeVoidButton=enableSafeVoid; allowedToWorkButton=enablePowerButton; } @@ -74,7 +75,11 @@ public class GT_Container_MultiMachineEM extends GT_ContainerMetaTile_Machine { case 0: if(ePowerPassButton) { TecTech.proxy.playSound(base,"fx_click"); - mte.ePowerPass ^= true; + if(mte.ePowerPassCapable){ + mte.ePowerPass ^= true; + }else { + mte.ePowerPass = false; + } if (!allowedToWorkButton) {//TRANSFORMER HACK if (mte.ePowerPass) { mte.getBaseMetaTileEntity().enableWorking(); @@ -118,6 +123,7 @@ public class GT_Container_MultiMachineEM extends GT_ContainerMetaTile_Machine { eCertainMode = ((GT_MetaTileEntity_MultiblockBase_EM) mTileEntity.getMetaTileEntity()).eCertainMode; eCertainStatus = ((GT_MetaTileEntity_MultiblockBase_EM) mTileEntity.getMetaTileEntity()).eCertainStatus; ePowerPass = ((GT_MetaTileEntity_MultiblockBase_EM) mTileEntity.getMetaTileEntity()).ePowerPass; + ePowerPassButton = ((GT_MetaTileEntity_MultiblockBase_EM) mTileEntity.getMetaTileEntity()).ePowerPassCapable; eSafeVoid = ((GT_MetaTileEntity_MultiblockBase_EM) mTileEntity.getMetaTileEntity()).eSafeVoid; allowedToWork = mTileEntity.isAllowedToWork(); @@ -127,7 +133,7 @@ public class GT_Container_MultiMachineEM extends GT_ContainerMetaTile_Machine { var1.sendProgressBarUpdate(this, i++, (eParamsInStatus[j].getOrdinalByte() | (eParamsOutStatus[j].getOrdinalByte() << 8))); } var1.sendProgressBarUpdate(this, 120, eCertainMode | (eCertainStatus << 8)); - var1.sendProgressBarUpdate(this, 121, (ePowerPass ? 1 : 0) + (eSafeVoid ? 2 : 0) + (allowedToWork ? 4 : 0)); + var1.sendProgressBarUpdate(this, 121, (ePowerPass ? 1 : 0) + (eSafeVoid ? 2 : 0) + (allowedToWork ? 4 : 0) + (ePowerPassButton?8:0)); for(int i=128,k=208,j=0;j<20;j++,i+=4,k+=4) { Util.sendDouble(eParamsOut[j], this, var1, i); Util.sendDouble(eParamsIn[j], this, var1, k); @@ -151,6 +157,7 @@ public class GT_Container_MultiMachineEM extends GT_ContainerMetaTile_Machine { ePowerPass = (par2 & 1) == 1; eSafeVoid = (par2 & 2) == 2; allowedToWork = (par2 & 4) == 4; + ePowerPassButton = (par2 & 8) == 8; } else if(par1>=128 && par1<208){ int pos=(par1-128)>>2; eParamsOut[pos]=Double.longBitsToDouble(eParamsOutl[pos]=Util.receiveLong(eParamsOutl[pos],par1&0xFFFFFFFC,par1,par2)); diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/base/GT_GUIContainer_MultiMachineEM.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/base/GT_GUIContainer_MultiMachineEM.java index 5f5ddf6e4a..c471698a1c 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/base/GT_GUIContainer_MultiMachineEM.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/base/GT_GUIContainer_MultiMachineEM.java @@ -20,14 +20,13 @@ import static gregtech.api.enums.GT_Values.RES_PATH_GUI; public class GT_GUIContainer_MultiMachineEM extends GT_GUIContainerMetaTile_Machine { private String mName; private static byte counter = 0; - private final boolean ePowerPassButton, eSafeVoidButton, allowedToWorkButton; + private final boolean eSafeVoidButton, allowedToWorkButton; private final GT_Container_MultiMachineEM mContainer; - public GT_GUIContainer_MultiMachineEM(InventoryPlayer aInventoryPlayer, IGregTechTileEntity aTileEntity, String aName, String aTextureFile, boolean enablePowerPass, boolean enableSafeVoid, boolean enablePowerButton) { + public GT_GUIContainer_MultiMachineEM(InventoryPlayer aInventoryPlayer, IGregTechTileEntity aTileEntity, String aName, String aTextureFile, boolean enableSafeVoid, boolean enablePowerButton) { super(new GT_Container_MultiMachineEM(aInventoryPlayer, aTileEntity), RES_PATH_GUI + "multimachines/" + (aTextureFile == null ? "MultiblockDisplay" : aTextureFile)); mContainer=(GT_Container_MultiMachineEM)super.mContainer; mName = aName; - ePowerPassButton=enablePowerPass; eSafeVoidButton=enableSafeVoid; allowedToWorkButton=enablePowerButton; ySize= 192; @@ -38,7 +37,7 @@ public class GT_GUIContainer_MultiMachineEM extends GT_GUIContainerMetaTile_Mach super(new GT_Container_MultiMachineEM(aInventoryPlayer, aTileEntity), RES_PATH_GUI + "multimachines/" + (aTextureFile == null ? "MultiblockDisplay" : aTextureFile)); mContainer=(GT_Container_MultiMachineEM)super.mContainer; mName = aName; - ePowerPassButton=eSafeVoidButton=allowedToWorkButton=true; + eSafeVoidButton=allowedToWorkButton=true; ySize= 192; xSize = 198; } @@ -108,10 +107,12 @@ public class GT_GUIContainer_MultiMachineEM extends GT_GUIContainerMetaTile_Mach counter = (byte) ((1 + counter) % 6); GL11.glColor4f(1f, 1f, 1f, 1f); x+= 173; - if(!ePowerPassButton) { + if (mContainer.ePowerPassButton) { + if (mContainer.ePowerPass) {// + drawTexturedModalRect(x, y + 115, 207, 23, 18, 18); + } + } else {//no function drawTexturedModalRect(x, y + 115, 231, 23, 18, 18); - } else if (mContainer.ePowerPass) { - drawTexturedModalRect(x, y + 115, 207, 23, 18, 18); } if(!eSafeVoidButton) { diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/base/GT_MetaTileEntity_MultiblockBase_EM.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/base/GT_MetaTileEntity_MultiblockBase_EM.java index 7cc83caaba..da5ca5500d 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/base/GT_MetaTileEntity_MultiblockBase_EM.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/base/GT_MetaTileEntity_MultiblockBase_EM.java @@ -122,7 +122,7 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt protected byte minRepairStatus = 3; //can power pass be enabled - public boolean ePowerPassUpgraded = false; + public boolean ePowerPassCapable = false; //functionality toggles - changed by buttons in gui also public boolean ePowerPass = false, eSafeVoid = false; @@ -293,7 +293,7 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt */ @Override protected void addFluidOutputs(FluidStack[] mOutputFluids) { - int min = mOutputFluids.length > mOutputHatches.size() ? mOutputHatches.size() : mOutputFluids.length; + int min = Math.min(mOutputFluids.length, mOutputHatches.size()); for (int i = 0; i < min; ++i) { if (mOutputHatches.get(i) != null && mOutputFluids[i] != null && GT_MetaTileEntity_MultiBlockBase.isValidMetaTileEntity(mOutputHatches.get(i))) { mOutputHatches.get(i).fill(mOutputFluids[i], true); @@ -546,11 +546,11 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt for (GT_MetaTileEntity_Hatch_ElementalContainer hatch_elemental : eInputHatches) { hatch_elemental.id = -1; } - for (GT_MetaTileEntity_Hatch_DataConnector hatch_data : eOutputData) { + for (GT_MetaTileEntity_Hatch_OutputData hatch_data : eOutputData) { hatch_data.id = -1; hatch_data.q = null; } - for (GT_MetaTileEntity_Hatch_DataConnector hatch_data : eInputData) { + for (GT_MetaTileEntity_Hatch_InputData hatch_data : eInputData) { hatch_data.id = -1; } for (GT_MetaTileEntity_Hatch_Uncertainty hatch : eUncertainHatches) { @@ -724,10 +724,10 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt aNBT.setByte("eFlip", (byte)extendedFacing.getFlip().getIndex()); aNBT.setBoolean("eParam", eParameters); aNBT.setBoolean("ePass", ePowerPass); + aNBT.setBoolean("ePassCapable", ePowerPassCapable); aNBT.setBoolean("eVoid", eSafeVoid); aNBT.setBoolean("eBoom", eDismantleBoom); aNBT.setBoolean("eOK", mMachine); - //Ensures compatibility if (mOutputItems != null) { aNBT.setInteger("mOutputItemsLength", mOutputItems.length); @@ -817,6 +817,9 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt Flip.byIndex(aNBT.getByte("eFlip"))); eParameters = !aNBT.hasKey("eParam") || aNBT.getBoolean("eParam"); ePowerPass = aNBT.getBoolean("ePass"); + if(aNBT.hasKey("ePassCapable")) { + ePowerPassCapable = aNBT.getBoolean("ePassCapable"); + } eSafeVoid = aNBT.getBoolean("eVoid"); eDismantleBoom = aNBT.getBoolean("eBoom"); mMachine = aNBT.getBoolean("eOK"); |