aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/gregtech/common/tileentities
diff options
context:
space:
mode:
authorTechnus <daniel112092@gmail.com>2016-09-05 21:16:46 +0200
committerTechnus <daniel112092@gmail.com>2016-09-21 22:03:00 +0200
commit66f7ef1cc0d5198a043a4f750270531037196503 (patch)
treefd9bef7493dfcccda60d49cd8112829ea7d7c12b /src/main/java/gregtech/common/tileentities
parentd09a81b50186cb198fad5320574db98be57d1d5c (diff)
downloadGT5-Unofficial-66f7ef1cc0d5198a043a4f750270531037196503.tar.gz
GT5-Unofficial-66f7ef1cc0d5198a043a4f750270531037196503.tar.bz2
GT5-Unofficial-66f7ef1cc0d5198a043a4f750270531037196503.zip
EVEN MORE WORK^2
Diffstat (limited to 'src/main/java/gregtech/common/tileentities')
-rw-r--r--src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Disassembler.java29
-rw-r--r--src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Massfabricator.java15
-rw-r--r--src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_MicrowaveEnergyTransmitter.java7
-rw-r--r--src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_MonsterRepellent.java4
-rw-r--r--src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_PotionBrewer.java11
-rw-r--r--src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Printer.java6
-rw-r--r--src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Pump.java20
7 files changed, 59 insertions, 33 deletions
diff --git a/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Disassembler.java b/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Disassembler.java
index 2d6f110563..5c191d97a4 100644
--- a/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Disassembler.java
+++ b/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Disassembler.java
@@ -1,5 +1,6 @@
package gregtech.common.tileentities.machines.basic;
+import gregtech.api.enums.GT_Values;
import gregtech.api.enums.Textures;
import gregtech.api.interfaces.ITexture;
import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
@@ -31,8 +32,8 @@ public class GT_MetaTileEntity_Disassembler
tNBT = tNBT.getCompoundTag("GT.CraftingComponents");
if (tNBT != null) {
boolean isAnyOutput=false;
- calculateOverclockedNess(16,80);
- this.mMaxProgresstime = 80;//Override speed overclocking
+ calculateOverclockedNessDisassembler(16);
+ this.mMaxProgresstime = 80;
//In case recipe is too OP for that machine
if (mEUt == Integer.MAX_VALUE - 1)//&& mMaxProgresstime==Integer.MAX_VALUE-1
return FOUND_RECIPE_BUT_DID_NOT_MEET_REQUIREMENTS;
@@ -40,7 +41,7 @@ public class GT_MetaTileEntity_Disassembler
if (getBaseMetaTileEntity().getRandomNumber(100) < 50 + 10 * this.mTier) {
this.mOutputItems[i] = GT_Utility.loadItem(tNBT, "Ingredient." + i);
if (this.mOutputItems[i] != null) {
- this.mMaxProgresstime *= (mTier>5 ? 1.7F-(mTier/8.0F) : 1.7F);
+ this.mMaxProgresstime *= (mTier>5 ? 1.7F-(mTier/10.0F) : 1.7F);
isAnyOutput=true;
}
}
@@ -56,6 +57,28 @@ public class GT_MetaTileEntity_Disassembler
return 0;
}
+ private void calculateOverclockedNessDisassembler(int aEUt) {
+ if(mTier==0){
+ mEUt=aEUt/4;
+ }else{
+ //Long EUt calculation
+ long xEUt=aEUt;
+ //Isnt too low EUt check?
+ long tempEUt = xEUt<GT_Values.V[1] ? GT_Values.V[1] : xEUt;
+
+ while (tempEUt <= GT_Values.V[mTier -1] * (long)mAmperage) {
+ tempEUt *= 4;//this actually controls overclocking
+ xEUt *= 4;//this is effect of overclocking
+ }
+ if(xEUt>Integer.MAX_VALUE-1){
+ mEUt = Integer.MAX_VALUE-1;
+ }else{
+ mEUt = (int)xEUt;
+ mEUt = mEUt == 0 ? 1 : mEUt;
+ }
+ }
+ }
+
public boolean allowPutStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) {
return (super.allowPutStack(aBaseMetaTileEntity, aIndex, aSide, aStack)) && (aStack.getTagCompound() != null) && (aStack.getTagCompound().getCompoundTag("GT.CraftingComponents") != null);
}
diff --git a/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Massfabricator.java b/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Massfabricator.java
index c1bfb28fa1..de3ec5d45e 100644
--- a/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Massfabricator.java
+++ b/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Massfabricator.java
@@ -7,6 +7,7 @@ import gregtech.api.metatileentity.MetaTileEntity;
import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_BasicMachine;
import gregtech.api.objects.GT_RenderedTexture;
import gregtech.api.util.GT_Config;
+import gregtech.api.util.GT_Utility;
import net.minecraftforge.fluids.FluidStack;
import static gregtech.api.enums.GT_Values.V;
@@ -76,22 +77,22 @@ public class GT_MetaTileEntity_Massfabricator
mEUt=Integer.MAX_VALUE-1;
mMaxProgresstime=Integer.MAX_VALUE-1;
}else{
- mEUt=((int)GT_Values.V[1] * (1<<(mTier+3)))/2;
+ mEUt= (int)(GT_Values.V[1] * 4);
mMaxProgresstime=(int)xMaxProgresstime;
}
}else{
+ //TODO: CHECK IF THAT WORKS
//Long EUt calculation
- long xEUt=(GT_Values.V[1] * (1L<<(mTier+3)))/2;
+ long xEUt=GT_Values.V[1] * (long)Math.pow(2,mTier+2);
- long tempEUt = GT_Values.V[1];
+ long tempEUt = GT_Values.V[mTier];
mMaxProgresstime = sDurationMultiplier;
- while (tempEUt <= V[mTier -1] * (long)mAmperage) {
- tempEUt *= 2;//this actually controls overclocking
- xEUt *= 2;//this is effect of everclocking
+ while (tempEUt <= V[mTier -1]) {
+ tempEUt *= 4;//this actually controls overclocking
mMaxProgresstime /= 2;//this is effect of overclocking
- xEUt = mMaxProgresstime==0 ? (int)(xEUt/1.5F) : xEUt;//U know, if the time is less than 1 tick make the machine use 2x less power
+ xEUt = mMaxProgresstime==0 ? (int)(xEUt/1.1F) : xEUt;//U know, if the time is less than 1 tick make the machine use less power
}
if(xEUt>Integer.MAX_VALUE-1){
mEUt = Integer.MAX_VALUE-1;
diff --git a/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_MicrowaveEnergyTransmitter.java b/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_MicrowaveEnergyTransmitter.java
index f269cc6c5c..d0b22dd859 100644
--- a/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_MicrowaveEnergyTransmitter.java
+++ b/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_MicrowaveEnergyTransmitter.java
@@ -183,15 +183,14 @@ public class GT_MetaTileEntity_MicrowaveEnergyTransmitter extends GT_MetaTileEnt
}
}
int tDistance = distanceCalculation();
- long tEnergyTrans = Math.min(V[mTier], getBaseMetaTileEntity().getStoredEU());
if (tTile != null && tTile instanceof IEnergyConnected) {
int tLoss = 1;
if (mMaxLossDistance != 0) {
tLoss = GT_Utility.safeInt(10 + tDistance * (mMaxLoss - 10) / mMaxLossDistance);
}
- if(getBaseMetaTileEntity().getStoredEU()>=V[mTier] + ((V[mTier] * tLoss) / 100)){
- if (((IEnergyConnected) tTile).injectEnergyUnits((byte) 6, tEnergyTrans, 1) > 0) {
- getBaseMetaTileEntity().decreaseStoredEnergyUnits(V[mTier] + ((V[mTier] * tLoss) / 100), false);
+ if(getBaseMetaTileEntity().isUniversalEnergyStored(V[mTier] + (((V[mTier] * tLoss) / 100)))){
+ if (((IEnergyConnected) tTile).injectEnergyUnits((byte) 6, V[mTier], 1) > 0) {
+ getBaseMetaTileEntity().decreaseStoredEnergyUnits(V[mTier] + (((V[mTier] * tLoss) / 100)), false);
}
}
}
diff --git a/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_MonsterRepellent.java b/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_MonsterRepellent.java
index 2ba2cd140b..f98f8af1e0 100644
--- a/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_MonsterRepellent.java
+++ b/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_MonsterRepellent.java
@@ -87,12 +87,12 @@ public class GT_MetaTileEntity_MonsterRepellent extends GT_MetaTileEntity_Tiered
@Override
public long getMinimumStoredEU() {
- return 512;
+ return 512L;
}
@Override
public long maxEUStore() {
- return 512 + V[mTier] * 50;
+ return 512L + V[mTier] * 50;
}
@Override
diff --git a/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_PotionBrewer.java b/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_PotionBrewer.java
index 57bfea5a97..1a919a5e0e 100644
--- a/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_PotionBrewer.java
+++ b/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_PotionBrewer.java
@@ -35,7 +35,7 @@ public class GT_MetaTileEntity_PotionBrewer
}
public int checkRecipe() {
- int tCheck = super.checkRecipe();
+ int tCheck = super.checkRecipe(true);
if (tCheck != 0) {
return tCheck;
}
@@ -106,13 +106,16 @@ public class GT_MetaTileEntity_PotionBrewer
}
private final int setOutput(String aFluidName) {
+ calculateOverclockedNess(4,128);
+ //In case recipe is too OP for that machine
+ if (mMaxProgresstime == Integer.MAX_VALUE - 1 && mEUt == Integer.MAX_VALUE - 1)
+ return FOUND_RECIPE_BUT_DID_NOT_MEET_REQUIREMENTS;
+
this.mOutputFluid = FluidRegistry.getFluidStack(aFluidName, 750);
if (this.mOutputFluid == null) {
this.mOutputFluid = FluidRegistry.getFluidStack("potion.mundane", getFillableStack().amount);
getInputAt(0).stackSize -= 1;
getFillableStack().amount = 0;
- this.mEUt = (4 * (1 << this.mTier - 1) * (1 << this.mTier - 1));
- this.mMaxProgresstime = (128 / (1 << this.mTier - 1));
return 2;
}
if (getFillableStack().amount < 750) {
@@ -120,8 +123,6 @@ public class GT_MetaTileEntity_PotionBrewer
}
getInputAt(0).stackSize -= 1;
getFillableStack().amount -= 750;
- this.mEUt = (4 * (1 << this.mTier - 1) * (1 << this.mTier - 1));
- this.mMaxProgresstime = (128 / (1 << this.mTier - 1));
return 2;
}
diff --git a/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Printer.java b/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Printer.java
index 312047cc8d..44c39612c6 100644
--- a/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Printer.java
+++ b/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Printer.java
@@ -35,8 +35,10 @@ public class GT_MetaTileEntity_Printer
for (int j = tList.size() - 1; i < j; i++) {
if (GT_Utility.areStacksEqual(getInputAt(0), (ItemStack) tList.get(i))) {
this.mOutputItems[0] = GT_Utility.copyAmount(1L, new Object[]{tList.get(i + 1)});
- this.mEUt = (1 * (1 << this.mTier - 1) * (1 << this.mTier - 1));
- this.mMaxProgresstime = (32 / (1 << this.mTier - 1));
+ calculateOverclockedNess(1,32);
+ //In case recipe is too OP for that machine
+ if (mMaxProgresstime == Integer.MAX_VALUE - 1 && mEUt == Integer.MAX_VALUE - 1)
+ return FOUND_RECIPE_BUT_DID_NOT_MEET_REQUIREMENTS;
getInputAt(0).stackSize -= 1;
return 2;
}
diff --git a/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Pump.java b/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Pump.java
index 6aabea8286..622a8aff05 100644
--- a/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Pump.java
+++ b/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Pump.java
@@ -121,7 +121,7 @@ public class GT_MetaTileEntity_Pump extends GT_MetaTileEntity_Hatch {
((GT_MetaTileEntity_Pump) tTileEntity.getMetaTileEntity()).mPumpTimer -= 1;
}
if (this.mPumpCountBelow <= 0) {
- if ((getBaseMetaTileEntity().isAllowedToWork()) && (getBaseMetaTileEntity().isUniversalEnergyStored(16 * ((int) Math.pow(4, this.mTier))))
+ if ((getBaseMetaTileEntity().isAllowedToWork()) && (getBaseMetaTileEntity().isUniversalEnergyStored(16 * ((long) Math.pow(4, this.mTier))))
&& ((this.mFluid == null) || (this.mFluid.amount + 1000 <= getCapacity()))) {
boolean tMovedOneDown = false;
if ((this.mPumpList.isEmpty()) && (getBaseMetaTileEntity().getTimer() % 100L == 0L)) {
@@ -146,7 +146,7 @@ public class GT_MetaTileEntity_Pump extends GT_MetaTileEntity_Hatch {
this.mPumpList.clear();
int y = getBaseMetaTileEntity().getYCoord() - 1;
for (int yHead = getYOfPumpHead(); (this.mPumpList.isEmpty()) && (y >= yHead); y--) {
- scanForFluid(getBaseMetaTileEntity().getXCoord(), y, getBaseMetaTileEntity().getZCoord(), this.mPumpList, getBaseMetaTileEntity().getXCoord(), getBaseMetaTileEntity().getZCoord(), 10 * ((int) Math.pow(1.6, this.mTier)));
+ scanForFluid(getBaseMetaTileEntity().getXCoord(), y, getBaseMetaTileEntity().getZCoord(), this.mPumpList, getBaseMetaTileEntity().getXCoord(), getBaseMetaTileEntity().getZCoord(), 10 * ((int) Math.pow(1.6D, this.mTier)));
}
}
if ((!tMovedOneDown) && (this.mPumpTimer <= 0)) {
@@ -155,7 +155,7 @@ public class GT_MetaTileEntity_Pump extends GT_MetaTileEntity_Hatch {
((ChunkPosition) this.mPumpList.get(this.mPumpList.size() - 1)).chunkPosY,
((ChunkPosition) this.mPumpList.remove(this.mPumpList.size() - 1)).chunkPosZ))) {
}
- this.mPumpTimer = 160 / ((int) Math.pow(2, this.mTier));
+ this.mPumpTimer = GT_Utility.safeInt(160L / (long)Math.pow(2, this.mTier) );
}
}
}
@@ -282,31 +282,31 @@ public class GT_MetaTileEntity_Pump extends GT_MetaTileEntity_Hatch {
if ((aBlock == Blocks.water) || (aBlock == Blocks.flowing_water)) {
if (aMeta == 0) {
if (this.mFluid == null) {
- getBaseMetaTileEntity().decreaseStoredEnergyUnits(16 * ((int) Math.pow(4, this.mTier)), true);
+ getBaseMetaTileEntity().decreaseStoredEnergyUnits(16 * ((long) Math.pow(4, this.mTier)), true);
this.mFluid = GT_ModHandler.getWater(1000L);
} else if (GT_ModHandler.isWater(this.mFluid)) {
- getBaseMetaTileEntity().decreaseStoredEnergyUnits(16 * ((int) Math.pow(4, this.mTier)), true);
+ getBaseMetaTileEntity().decreaseStoredEnergyUnits(16 * ((long) Math.pow(4, this.mTier)), true);
this.mFluid.amount += 1000;
} else {
return false;
}
} else {
- getBaseMetaTileEntity().decreaseStoredEnergyUnits(4 * ((int) Math.pow(4, this.mTier)), true);
+ getBaseMetaTileEntity().decreaseStoredEnergyUnits(4 * ((long) Math.pow(4, this.mTier)), true);
}
}
if ((aBlock == Blocks.lava) || (aBlock == Blocks.flowing_lava)) {
if (aMeta == 0) {
if (this.mFluid == null) {
- getBaseMetaTileEntity().decreaseStoredEnergyUnits(16 * ((int) Math.pow(4, this.mTier)), true);
+ getBaseMetaTileEntity().decreaseStoredEnergyUnits(16 * ((long) Math.pow(4, this.mTier)), true);
this.mFluid = GT_ModHandler.getLava(1000L);
} else if (GT_ModHandler.isLava(this.mFluid)) {
- getBaseMetaTileEntity().decreaseStoredEnergyUnits(16 * ((int) Math.pow(4, this.mTier)), true);
+ getBaseMetaTileEntity().decreaseStoredEnergyUnits(16 * ((long) Math.pow(4, this.mTier)), true);
this.mFluid.amount += 1000;
} else {
return false;
}
} else {
- getBaseMetaTileEntity().decreaseStoredEnergyUnits(4 * ((int) Math.pow(4, this.mTier)), true);
+ getBaseMetaTileEntity().decreaseStoredEnergyUnits(4 * ((long) Math.pow(4, this.mTier)), true);
}
}
if ((aBlock instanceof IFluidBlock)) {
@@ -316,7 +316,7 @@ public class GT_MetaTileEntity_Pump extends GT_MetaTileEntity_Hatch {
} else if (this.mFluid.isFluidEqual(((IFluidBlock) aBlock).drain(getBaseMetaTileEntity().getWorld(), aX, aY, aZ, false))) {
this.getBaseMetaTileEntity().getWorld().setBlockToAir(aX, aY, aZ);
this.mFluid.amount += 1000;
- getBaseMetaTileEntity().decreaseStoredEnergyUnits(16 * ((int) Math.pow(4, this.mTier)), true);
+ getBaseMetaTileEntity().decreaseStoredEnergyUnits(16 * ((long) Math.pow(4, this.mTier)), true);
} else {
return false;
}