aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTechnus <daniel112092@gmail.com>2017-08-27 22:42:32 +0200
committerTechnus <daniel112092@gmail.com>2017-08-28 09:44:49 +0200
commita7a53f1ae83926fa4016ce175fdaabe52b555870 (patch)
tree42f1c8d418d759faa0e2da6008e717a427378bac
parent459d673501591141d158ebae212857dc9c19db1e (diff)
downloadGT5-Unofficial-a7a53f1ae83926fa4016ce175fdaabe52b555870.tar.gz
GT5-Unofficial-a7a53f1ae83926fa4016ce175fdaabe52b555870.tar.bz2
GT5-Unofficial-a7a53f1ae83926fa4016ce175fdaabe52b555870.zip
Some more gui and mechanics changes
-rw-r--r--src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_infuser.java25
-rw-r--r--src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_scanner.java3
-rw-r--r--src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_transformer.java4
-rw-r--r--src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_MultiblockBase_EM.java92
-rw-r--r--src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_TM_microwave.java5
-rw-r--r--src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/gui/GT_Container_MultiMachineEM.java8
6 files changed, 73 insertions, 64 deletions
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
@@ -61,6 +66,16 @@ 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);
+ }
+
+ @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;
@@ -118,13 +130,6 @@ public class GT_MetaTileEntity_EM_infuser extends GT_MetaTileEntity_MultiblockBa
}
@Override
- public void onPreTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) {
- if ((aTick & 31) == 31) {
- eSafeVoid = false;
- }
- }
-
- @Override
public String[] getDescription() {
return new String[]{
CommonValues.tecMark,
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 aTileEntity) {
@@ -318,6 +320,5 @@ public class GT_MetaTileEntity_EM_scanner extends GT_MetaTileEntity_MultiblockBa
base.getWorld().setBlock(xDir, yDir, zDir, Blocks.air,0,2);
}
}
- eDismatleBoom=shouldExist;
}
}
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 afa09f57d9..0ec32e52fb 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
@@ -50,6 +50,7 @@ public class GT_MetaTileEntity_EM_transformer extends GT_MetaTileEntity_Multiblo
mHardHammer = true;
mSolderingTool = true;
mCrowbar = true;
+ eDismantleBoom=true;
}
public GT_MetaTileEntity_EM_transformer(String aName) {
@@ -60,6 +61,7 @@ public class GT_MetaTileEntity_EM_transformer extends GT_MetaTileEntity_Multiblo
mHardHammer = true;
mSolderingTool = true;
mCrowbar = true;
+ eDismantleBoom=true;
}
public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) {
@@ -119,7 +121,6 @@ public class GT_MetaTileEntity_EM_transformer extends GT_MetaTileEntity_Multiblo
}
eAmpereFlow = 0;
mEUt = 0;
- eDismatleBoom = ePowerPass;
return ePowerPass;
}
@@ -132,7 +133,6 @@ public class GT_MetaTileEntity_EM_transformer extends GT_MetaTileEntity_Multiblo
public void onPreTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) {
if ((aTick & 31) == 31) {
ePowerPass = aBaseMetaTileEntity.isAllowedToWork();
- eSafeVoid = 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 90b4fda033..4d69f4ea81 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
@@ -83,7 +83,7 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt
// 1,3,5 - nok
//TO ENABLE this change value in <init> 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;
+ public boolean eParameters = true, ePowerPass = false, eSafeVoid = false, eDismantleBoom = false;
public byte eCertainMode = 0, eCertainStatus = 0, minRepairStatus = 3;
protected long eMaxAmpereFlow = 0;//don't modify! unless YOU REALLY HAVE TO
@@ -254,7 +254,7 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt
aNBT.setBoolean("eParam", eParameters);
aNBT.setBoolean("ePass", ePowerPass);
aNBT.setBoolean("eVoid", eSafeVoid);
- aNBT.setBoolean("eBoom", eDismatleBoom);
+ aNBT.setBoolean("eBoom", eDismantleBoom);
aNBT.setBoolean("eOK", mMachine);
//Ensures compatibility
@@ -327,7 +327,7 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt
eParameters = aNBT.getBoolean("eParam");
ePowerPass = aNBT.getBoolean("ePass");
eSafeVoid = aNBT.getBoolean("eVoid");
- eDismatleBoom = aNBT.getBoolean("eBoom");
+ eDismantleBoom = aNBT.getBoolean("eBoom");
mMachine = aNBT.getBoolean("eOK");
//Ensures compatibility
@@ -462,7 +462,8 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt
mMachine = checkMachine(aBaseMetaTileEntity, mInventory[1]);
if (!mMachine)
- if (eDismatleBoom && mMaxProgresstime > 0) explodeMultiblock();
+ if ((ePowerPass && getEUVar()>V[3]) || (eDismantleBoom && mMaxProgresstime > 0))
+ explodeMultiblock();
else if (outputEM != null)
for (cElementalInstanceStackMap tree : outputEM)
if (tree.hasStacks()) {
@@ -595,6 +596,46 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt
if (multiCheckAt == Tick)
hatchesStatusUpdate_EM();
+ //region power pass and controller charging
+ {//DO
+ long euVar;
+ for (GT_MetaTileEntity_Hatch_Energy tHatch : mEnergyHatches) {
+ if (this.getEUVar() > this.getMinimumStoredEU()) break;
+ if (isValidMetaTileEntity(tHatch)) {
+ euVar = tHatch.maxEUInput();
+ if (tHatch.getBaseMetaTileEntity().decreaseStoredEnergyUnits(euVar, false))
+ this.setEUVar(this.getEUVar() + euVar);
+ }
+ }
+ for (GT_MetaTileEntity_Hatch_EnergyMulti tHatch : eEnergyMulti) {
+ if (this.getEUVar() > this.getMinimumStoredEU()) break;
+ if (isValidMetaTileEntity(tHatch)) {
+ euVar = tHatch.maxEUInput() * tHatch.Amperes;
+ if (tHatch.getBaseMetaTileEntity().decreaseStoredEnergyUnits(euVar, false))
+ this.setEUVar(this.getEUVar() + euVar);
+ }
+ }
+ if (ePowerPass) {
+ for (GT_MetaTileEntity_Hatch_Dynamo tHatch : mDynamoHatches) {
+ if (isValidMetaTileEntity(tHatch)) {
+ euVar = tHatch.maxEUOutput();
+ if (tHatch.getBaseMetaTileEntity().getStoredEU() <= (tHatch.maxEUStore() - euVar) &&
+ aBaseMetaTileEntity.decreaseStoredEnergyUnits(euVar + Math.min(euVar >> 7,1), false))
+ tHatch.setEUVar(tHatch.getBaseMetaTileEntity().getStoredEU() + euVar);
+ }
+ }
+ for (GT_MetaTileEntity_Hatch_DynamoMulti tHatch : eDynamoMulti) {
+ if (isValidMetaTileEntity(tHatch)) {
+ euVar = tHatch.maxEUOutput() * tHatch.Amperes;
+ if (tHatch.getBaseMetaTileEntity().getStoredEU() <= tHatch.maxEUStore() - euVar &&
+ aBaseMetaTileEntity.decreaseStoredEnergyUnits(euVar + Math.min(euVar >> 7,tHatch.Amperes), false))
+ tHatch.setEUVar(tHatch.getBaseMetaTileEntity().getStoredEU() + euVar);
+ }
+ }
+ }
+ }
+ //endregion
+
if (mMaxProgresstime > 0 && doRandomMaintenanceDamage()) {//Start
if (onRunningTick(mInventory[1])) {//Compute EU
if (!polluteEnvironment(getPollutionPerTick(mInventory[1]))) stopMachine();
@@ -640,46 +681,6 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt
updateSlots();
} else notAllowedToWork_stopMachine_EM();
}
-
- //region power pass
- {//DO ONCE
- long euVar;
- for (GT_MetaTileEntity_Hatch_Energy tHatch : mEnergyHatches) {
- if (this.getEUVar() > this.getMinimumStoredEU()) break;
- if (isValidMetaTileEntity(tHatch)) {
- euVar = tHatch.maxEUInput();
- if (tHatch.getBaseMetaTileEntity().decreaseStoredEnergyUnits(euVar, false))
- this.setEUVar(this.getEUVar() + euVar);
- }
- }
- for (GT_MetaTileEntity_Hatch_EnergyMulti tHatch : eEnergyMulti) {
- if (this.getEUVar() > this.getMinimumStoredEU()) break;
- if (isValidMetaTileEntity(tHatch)) {
- euVar = tHatch.maxEUInput() * tHatch.Amperes;
- if (tHatch.getBaseMetaTileEntity().decreaseStoredEnergyUnits(euVar, false))
- this.setEUVar(this.getEUVar() + euVar);
- }
- }
- if (ePowerPass) {
- for (GT_MetaTileEntity_Hatch_Dynamo tHatch : mDynamoHatches) {
- if (isValidMetaTileEntity(tHatch)) {
- euVar = tHatch.maxEUOutput();
- if (tHatch.getBaseMetaTileEntity().getStoredEU() <= (tHatch.maxEUStore() - euVar) &&
- aBaseMetaTileEntity.decreaseStoredEnergyUnits(euVar + Math.min(euVar >> 7,1), false))
- tHatch.setEUVar(tHatch.getBaseMetaTileEntity().getStoredEU() + euVar);
- }
- }
- for (GT_MetaTileEntity_Hatch_DynamoMulti tHatch : eDynamoMulti) {
- if (isValidMetaTileEntity(tHatch)) {
- euVar = tHatch.maxEUOutput() * tHatch.Amperes;
- if (tHatch.getBaseMetaTileEntity().getStoredEU() <= tHatch.maxEUStore() - euVar &&
- aBaseMetaTileEntity.decreaseStoredEnergyUnits(euVar + Math.min(euVar >> 7,tHatch.Amperes), false))
- tHatch.setEUVar(tHatch.getBaseMetaTileEntity().getStoredEU() + euVar);
- }
- }
- }
- }
- //endregion
} else {//not repaired
stopMachine();
}
@@ -1512,7 +1513,8 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt
for (GT_MetaTileEntity_Hatch_Param hatch : eParamHatches)
hatch.getBaseMetaTileEntity().setActive(false);
}
- if (eDismatleBoom && mMaxProgresstime > 0) explodeMultiblock();
+ if ((ePowerPass && getEUVar()>V[3]) || (eDismantleBoom && mMaxProgresstime > 0))
+ explodeMultiblock();
else if (outputEM != null)
for (cElementalInstanceStackMap output : outputEM)
if (output.hasStacks()) {
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 95fbbd9d56..25fabc6b27 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
@@ -293,9 +293,4 @@ public class GT_MetaTileEntity_TM_microwave extends GT_MetaTileEntity_Multiblock
public byte getTileEntityBaseType() {
return 1;
}
-
- @Override
- public void onPreTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) {
- ePowerPass=false;
- }
}
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 ec359a0a49..769953d0ef 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
@@ -51,7 +51,13 @@ 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:
- if(ePowerPassButton) base.ePowerPass ^= true;
+ if(ePowerPassButton) {
+ base.ePowerPass ^= true;
+ if (!allowedToWorkButton) {//TRANSFORMER HACK
+ if (base.ePowerPass) base.getBaseMetaTileEntity().enableWorking();
+ else base.getBaseMetaTileEntity().disableWorking();
+ }
+ }
break;
case 2:
if(eSafeVoidButton) base.eSafeVoid ^= true;