aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/gregtech
diff options
context:
space:
mode:
authorTechnus <daniel112092@gmail.com>2016-09-06 10:35:38 +0200
committerTechnus <daniel112092@gmail.com>2016-09-21 22:03:16 +0200
commit222e8ee267aa687c4755800f99955e2a5af67d91 (patch)
treeb3a2081151d641cfd73fc84840df7f839c01aaac /src/main/java/gregtech
parent81dc8a48b10e44df1b49d02fd8e90afbe021feb4 (diff)
downloadGT5-Unofficial-222e8ee267aa687c4755800f99955e2a5af67d91.tar.gz
GT5-Unofficial-222e8ee267aa687c4755800f99955e2a5af67d91.tar.bz2
GT5-Unofficial-222e8ee267aa687c4755800f99955e2a5af67d91.zip
adding method to multibocks
Diffstat (limited to 'src/main/java/gregtech')
-rw-r--r--src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_MultiBlockBase.java45
1 files changed, 45 insertions, 0 deletions
diff --git a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_MultiBlockBase.java b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_MultiBlockBase.java
index 8f2dabef5f..5738af5708 100644
--- a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_MultiBlockBase.java
+++ b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_MultiBlockBase.java
@@ -14,6 +14,7 @@ import gregtech.api.metatileentity.MetaTileEntity;
import gregtech.api.objects.GT_ItemStack;
import gregtech.api.util.GT_ModHandler;
import gregtech.api.util.GT_OreDictUnificator;
+import gregtech.api.util.GT_Recipe;
import gregtech.api.util.GT_Recipe.GT_Recipe_Map;
import gregtech.api.util.GT_Utility;
import gregtech.common.items.GT_MetaGenerated_Tool_01;
@@ -512,6 +513,50 @@ public abstract class GT_MetaTileEntity_MultiBlockBase extends MetaTileEntity {
return rVoltage;
}
+ /**
+ * Calcualtes overclocked ness using long integers
+ * @param aEUt - recipe EUt
+ * @param aDuration - recipe Duration
+ * @param mAmperage - should be 1 ?
+ */
+ protected void calculateOverclockedNessMulti(int aEUt, int aDuration, int mAmperage) {
+ byte mTier=GT_Utility.getTier(getMaxInputVoltage());
+ if(mTier==0){
+ //Long time calculation
+ long xMaxProgresstime = (long)aDuration*2L;
+ if(xMaxProgresstime>Integer.MAX_VALUE-1){
+ //make impossible if too long
+ mEUt=Integer.MAX_VALUE-1;
+ mMaxProgresstime=Integer.MAX_VALUE-1;
+ }else{
+ mEUt=aEUt/4;
+ mMaxProgresstime=(int)xMaxProgresstime;
+ }
+ }else{
+ //Long EUt calculation
+ long xEUt=aEUt;
+ //Isnt too low EUt check?
+ long tempEUt = xEUt<V[1] ? V[1] : xEUt;
+
+ mMaxProgresstime = aDuration;
+
+ while (tempEUt <= V[mTier -1] * (long)mAmperage) {
+ tempEUt *= 4;//this actually controls overclocking
+ xEUt *= 4;//this is effect of everclocking
+ mMaxProgresstime /= 2;//this is effect of overclocking
+ xEUt = mMaxProgresstime==0 ? xEUt/2 : xEUt;//U know, if the time is less than 1 tick make the machine use 2x less power
+ }
+ if(xEUt>Integer.MAX_VALUE-1){
+ mEUt = Integer.MAX_VALUE-1;
+ mMaxProgresstime = Integer.MAX_VALUE-1;
+ }else{
+ mEUt = (int)xEUt;
+ mEUt = mEUt == 0 ? 1 : mEUt;
+ mMaxProgresstime = mMaxProgresstime<1 ? 1 : mMaxProgresstime;//set time to 1 tick
+ }
+ }
+ }
+
public boolean drainEnergyInput(long aEU) {
if (aEU <= 0) return true;
for (GT_MetaTileEntity_Hatch_Energy tHatch : mEnergyHatches)