aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/com
diff options
context:
space:
mode:
authorTechnus <daniel112092@gmail.com>2017-07-24 11:32:42 +0200
committerTechnus <daniel112092@gmail.com>2017-07-24 11:32:42 +0200
commitb8d73c63442ff692a9e313eef9a542dca751e36d (patch)
tree710513df26bf9c4c06c728ffbbd2d71044e5c222 /src/main/java/com
parentc3040908f941cecec9c6a0ffa741a26f904c9027 (diff)
downloadGT5-Unofficial-b8d73c63442ff692a9e313eef9a542dca751e36d.tar.gz
GT5-Unofficial-b8d73c63442ff692a9e313eef9a542dca751e36d.tar.bz2
GT5-Unofficial-b8d73c63442ff692a9e313eef9a542dca751e36d.zip
Expanding api a bit, fixing microwave
Diffstat (limited to 'src/main/java/com')
-rw-r--r--src/main/java/com/github/technus/tectech/thing/CustomItemList.java2
-rw-r--r--src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/gui/GT_GUIContainer_Param.java15
-rw-r--r--src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_MultiblockBase_EM.java26
-rw-r--r--src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_TM_microwave.java18
4 files changed, 42 insertions, 19 deletions
diff --git a/src/main/java/com/github/technus/tectech/thing/CustomItemList.java b/src/main/java/com/github/technus/tectech/thing/CustomItemList.java
index d00e97ca36..d3269609ff 100644
--- a/src/main/java/com/github/technus/tectech/thing/CustomItemList.java
+++ b/src/main/java/com/github/technus/tectech/thing/CustomItemList.java
@@ -71,7 +71,7 @@ public enum CustomItemList implements IItemContainer {
public Block getBlock() {
if (mHasNotBeenSet)
throw new IllegalAccessError("The Enum '" + name() + "' has not been set to an Item at this time!");
- return GT_Utility.getBlockFromStack(getItem());
+ return GT_Utility.getBlockFromStack(new ItemStack(getItem()));
}
@Override
diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/gui/GT_GUIContainer_Param.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/gui/GT_GUIContainer_Param.java
index 877b91f09c..c272e67fdc 100644
--- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/gui/GT_GUIContainer_Param.java
+++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/gui/GT_GUIContainer_Param.java
@@ -15,17 +15,16 @@ public final class GT_GUIContainer_Param extends GT_GUIContainerMetaTile_Machine
protected void drawGuiContainerForegroundLayer(int par1, int par2) {
if (this.mContainer != null) {
proxy.renderUnicodeString("Parametrizer: " + ((GT_Container_Param) this.mContainer).param, 46, 7, 167, 0xffffff);
- proxy.renderUnicodeString("\u2460\u2b07" + String.format(java.util.Locale.ENGLISH, "%+.5E", ((GT_Container_Param) this.mContainer).input1f), 46, 16, 167, 0x22ddff);
- proxy.renderUnicodeString("\u2461\u2b07" + String.format(java.util.Locale.ENGLISH, "%+.5E", ((GT_Container_Param) this.mContainer).input2f), 46, 24, 167, 0x00ffff);
- proxy.renderUnicodeString("\u2460\u2b06" + String.format(java.util.Locale.ENGLISH, "%+.5E", ((GT_Container_Param) this.mContainer).value1f), 46, 33, 167, 0x00bbff);
- proxy.renderUnicodeString("\u2461\u2b06" + String.format(java.util.Locale.ENGLISH, "%+.5E", ((GT_Container_Param) this.mContainer).value2f), 46, 41, 167, 0x0077ff);
- proxy.renderUnicodeString("M\u2460: " + ((GT_Container_Param) this.mContainer).value1, 46, 50, 167, 0x00bbff);
- proxy.renderUnicodeString("M\u2461: " + ((GT_Container_Param) this.mContainer).value2, 46, 58, 167, 0x0077ff);
- proxy.renderUnicodeString("E\u2460\u2461: " + ((GT_Container_Param) this.mContainer).exponent, 46, 66, 167, 0x0033ff);
+ proxy.renderUnicodeString("\u24EA\u2b07" + String.format(java.util.Locale.ENGLISH, "%+.5E", ((GT_Container_Param) this.mContainer).input1f), 46, 16, 167, 0x22ddff);
+ proxy.renderUnicodeString("\u2460\u2b07" + String.format(java.util.Locale.ENGLISH, "%+.5E", ((GT_Container_Param) this.mContainer).input2f), 46, 24, 167, 0x00ffff);
+ proxy.renderUnicodeString("\u24EA\u2b06" + String.format(java.util.Locale.ENGLISH, "%+.5E", ((GT_Container_Param) this.mContainer).value1f), 46, 33, 167, 0x00bbff);
+ proxy.renderUnicodeString("\u2460\u2b06" + String.format(java.util.Locale.ENGLISH, "%+.5E", ((GT_Container_Param) this.mContainer).value2f), 46, 41, 167, 0x0077ff);
+ proxy.renderUnicodeString("M\u24EA: " + ((GT_Container_Param) this.mContainer).value1, 46, 50, 167, 0x00bbff);
+ proxy.renderUnicodeString("M\u2460: " + ((GT_Container_Param) this.mContainer).value2, 46, 58, 167, 0x0077ff);
+ proxy.renderUnicodeString("E\u24EA\u2460: " + ((GT_Container_Param) this.mContainer).exponent, 46, 66, 167, 0x0033ff);
} else {
proxy.renderUnicodeString("Parametrizer", 46, 7, 167, 0xffffff);
}
- //167
}
protected void drawGuiContainerBackgroundLayer(float par1, int par2, int par3) {
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 6679a0ea60..b790b84394 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
@@ -88,6 +88,8 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt
public long eRequiredData = 0;
protected long eAvailableData = 0;
+ private boolean previousTickValueForWorkEnabled=false;
+
//init param states in constructor, or implement it in checkrecipe/outputfunction
//METHODS TO OVERRIDE
@@ -121,7 +123,13 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt
}//For that extra hatches explosions, and maybe some MOORE EXPLOSIONS
protected void EM_stopMachine() {
- }//On machine stop
+ }//On machine stop - now called when softhammered to offline state! - it does not cause a full stop like power failure
+
+ @Deprecated
+ protected void EM_workJustGotEnabled(){}//usually check recipe is more useful, therefore this one is deprecated
+ protected void EM_workJustGotDisabled(){}
+ //callback on enable/disable work, they don't care if the multiblock is complete or not
+ //(you can check that with looking at mMachine and other variables)
//machine structure check
protected boolean EM_checkMachine(IGregTechTileEntity iGregTechTileEntity, ItemStack itemStack) {
@@ -144,6 +152,8 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt
//default is once per 50s; mUpdate is decremented every tick
}
+ protected void EM_onFirstTick(){} // callback on first tick
+
//RATHER LEAVE ALONE Section
@@ -362,9 +372,22 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt
}
@Override
+ public final void onFirstTick(IGregTechTileEntity aBaseMetaTileEntity) {
+ super.onFirstTick(aBaseMetaTileEntity);
+ previousTickValueForWorkEnabled=getBaseMetaTileEntity().isAllowedToWork();//Assign new value
+ EM_onFirstTick();
+ }
+
+ @Override
public final void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) {
if (aBaseMetaTileEntity.isServerSide()) {
if (mEfficiency < 0) mEfficiency = 0;
+
+ if(getBaseMetaTileEntity().hasWorkJustBeenEnabled()) EM_workJustGotEnabled();
+ if(previousTickValueForWorkEnabled && !getBaseMetaTileEntity().isAllowedToWork())
+ EM_workJustGotDisabled();
+ previousTickValueForWorkEnabled=getBaseMetaTileEntity().isAllowedToWork();//Assign new value
+
if (--mUpdate == 0 || --mStartUpCheck == 0 || cyclicUpdate() || aBaseMetaTileEntity.hasWorkJustBeenEnabled()) {
mInputHatches.clear();
mInputBusses.clear();
@@ -637,7 +660,6 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt
}
@Deprecated
- @Override
public final int getAmountOfOutputs() {
throw new NoSuchMethodError("Deprecated Do not use");
}
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 7e9bbda59f..c2b8050aab 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
@@ -33,7 +33,7 @@ import static gregtech.api.GregTech_API.sBlockCasings4;
public class GT_MetaTileEntity_TM_microwave extends GT_MetaTileEntity_MultiblockBase_EM implements iConstructible {
private int powerSetting = 1000;
private int timerSetting = 0;
- private int timerValue = 0,timerValueBackup=0;
+ private int timerValue = 0;
//region Structure
//use multi A energy inputs, use less power the longer it runs
@@ -102,7 +102,7 @@ public class GT_MetaTileEntity_TM_microwave extends GT_MetaTileEntity_Multiblock
public boolean EM_checkRecipe(ItemStack itemStack) {
if(powerSetting<=300 || eParamsInStatus[0] == PARAM_TOO_HIGH || timerSetting<=0 || timerSetting>3000) return false;
if (timerValue <= 0) {
- timerValueBackup=timerValue=timerSetting;
+ timerValue=timerSetting;
}
mEUt = -(powerSetting >> 1);
eAmpereFlow = 1;
@@ -114,7 +114,6 @@ public class GT_MetaTileEntity_TM_microwave extends GT_MetaTileEntity_Multiblock
@Override
public void EM_outputFunction() {
timerValue--;
- timerValueBackup--;
IGregTechTileEntity mte=getBaseMetaTileEntity();
int xDirShift = ForgeDirection.getOrientation(mte.getBackFacing()).offsetX*2;
int zDirShift = ForgeDirection.getOrientation(mte.getBackFacing()).offsetZ*2;
@@ -159,7 +158,7 @@ public class GT_MetaTileEntity_TM_microwave extends GT_MetaTileEntity_Multiblock
aabb.maxZ+=.5f;
}
mOutputItems=itemsToOutput.toArray(new ItemStack[0]);
- if(timerValue<=0 || timerValueBackup<=0) {
+ if(timerValue<=0) {
mte.getWorld().playSoundEffect(xPos,yPos,zPos, Reference.MODID+":microwave_ding", 1, 1);
stopMachine();
}
@@ -190,6 +189,7 @@ public class GT_MetaTileEntity_TM_microwave extends GT_MetaTileEntity_Multiblock
if (eSafeVoid) {
eSafeVoid=false;
+ int timerValueBackup=timerValue;
stopMachine();
timerValue=timerValueBackup;
}
@@ -201,22 +201,24 @@ public class GT_MetaTileEntity_TM_microwave extends GT_MetaTileEntity_Multiblock
}
@Override
+ protected void EM_workJustGotDisabled() {
+ timerValue=0;
+ }
+
+ @Override
public void saveNBTData(NBTTagCompound aNBT) {
super.saveNBTData(aNBT);
aNBT.setInteger("eTimerVal", timerValue);
- aNBT.setInteger("eTimerValBU", timerValueBackup);
}
@Override
public void loadNBTData(NBTTagCompound aNBT) {
super.loadNBTData(aNBT);
timerValue = aNBT.getInteger("eTimerVal");
- timerValueBackup = aNBT.getInteger("eTimerValBU");
}
@Override
public void doExplosion(long aExplosionPower) {
- super.doExplosion(aExplosionPower);
explodeMultiblock();
- }
+ }//Redirecting to explodemultiblock
}