Adjusting multiblocks for bettter tiering

This commit is contained in:
Technus 2016-09-06 12:37:11 +02:00
parent 222e8ee267
commit 7dfb3e0da9
17 changed files with 111 additions and 154 deletions

View file

@ -14,7 +14,6 @@ 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;
@ -519,8 +518,8 @@ public abstract class GT_MetaTileEntity_MultiBlockBase extends MetaTileEntity {
* @param aDuration - recipe Duration
* @param mAmperage - should be 1 ?
*/
protected void calculateOverclockedNessMulti(int aEUt, int aDuration, int mAmperage) {
byte mTier=GT_Utility.getTier(getMaxInputVoltage());
protected void calculateOverclockedNessMulti(int aEUt, int aDuration, int mAmperage, long maxInputVoltage) {
byte mTier=(byte)Math.max(0,GT_Utility.getTier(maxInputVoltage));
if(mTier==0){
//Long time calculation
long xMaxProgresstime = (long)aDuration*2L;
@ -540,7 +539,7 @@ public abstract class GT_MetaTileEntity_MultiBlockBase extends MetaTileEntity {
mMaxProgresstime = aDuration;
while (tempEUt <= V[mTier -1] * (long)mAmperage) {
while (tempEUt <= V[mTier -1] * mAmperage) {
tempEUt *= 4;//this actually controls overclocking
xEUt *= 4;//this is effect of everclocking
mMaxProgresstime /= 2;//this is effect of overclocking

View file

@ -107,7 +107,7 @@ public class GT_MetaTileEntity_AdvMiner2 extends GT_MetaTileEntity_MultiBlockBas
int tMetaID = getBaseMetaTileEntity().getMetaIDOffset(i, yLevel - getBaseMetaTileEntity().getYCoord(), f);
if (tBlock instanceof GT_Block_Ores_Abstract) {
TileEntity tTileEntity = getBaseMetaTileEntity().getTileEntityOffset(i, yLevel - getBaseMetaTileEntity().getYCoord(), f);
if ((tTileEntity!=null) && (tTileEntity instanceof GT_TileEntity_Ores) && ((GT_TileEntity_Ores) tTileEntity).mNatural == true && !mMineList.contains(new ChunkPosition(i, yLevel - getBaseMetaTileEntity().getYCoord(), f))) {
if ((tTileEntity!=null) && (tTileEntity instanceof GT_TileEntity_Ores) && ((GT_TileEntity_Ores) tTileEntity).mNatural && !mMineList.contains(new ChunkPosition(i, yLevel - getBaseMetaTileEntity().getYCoord(), f))) {
mMineList.add(new ChunkPosition(i, yLevel - getBaseMetaTileEntity().getYCoord(), f));
}
}
@ -125,7 +125,7 @@ public class GT_MetaTileEntity_AdvMiner2 extends GT_MetaTileEntity_MultiBlockBas
}
if (mMineList.isEmpty()) {
if(getBaseMetaTileEntity().getBlockOffset(ForgeDirection.getOrientation(getBaseMetaTileEntity().getBackFacing()).offsetX, getYOfPumpHead() - 1 - getBaseMetaTileEntity().getYCoord(), ForgeDirection.getOrientation(getBaseMetaTileEntity().getBackFacing()).offsetZ) != Blocks.bedrock){
if (mEnergyHatches.size() > 0 && mEnergyHatches.get(0).getEUVar() > (512 + getMaxInputVoltage() * 4)) {
if (mEnergyHatches.size() > 0 && mEnergyHatches.get(0).getEUVar() > (512L + getMaxInputVoltage() * 4L)) {
moveOneDown();
}
}else{
@ -187,27 +187,15 @@ public class GT_MetaTileEntity_AdvMiner2 extends GT_MetaTileEntity_MultiBlockBas
}
}
byte tTier = (byte) Math.max(1, GT_Utility.getTier(tVoltage));
calculateOverclockedNessMulti(48, 24, 1, tVoltage);
//In case recipe is too OP for that machine
if (mMaxProgresstime == Integer.MAX_VALUE - 1 && mEUt == Integer.MAX_VALUE - 1)
return false;
this.mEfficiency = (10000 - (getIdealStatus() - getRepairStatus()) * 1000);
this.mEfficiencyIncrease = 10000;
int tEU = 48;
int tDuration = 24;
if (tEU <= 16) {
this.mEUt = (tEU * (1 << tTier - 1) * (1 << tTier - 1));
this.mMaxProgresstime = (tDuration / (1 << tTier - 1));
} else {
this.mEUt = tEU;
this.mMaxProgresstime = tDuration;
while (this.mEUt <= gregtech.api.enums.GT_Values.V[(tTier - 1)]) {
this.mEUt *= 4;
this.mMaxProgresstime /= 2;
}
}
if (this.mEUt > 0) {
this.mEUt = (-this.mEUt);
}
this.mMaxProgresstime = Math.max(1, this.mMaxProgresstime);
return true;
}

View file

@ -118,19 +118,12 @@ public class GT_MetaTileEntity_AssemblyLine
}
}
}
byte tTier = (byte) Math.max(1, GT_Utility.getTier(getMaxInputVoltage()));
this.mEfficiency = (10000 - (getIdealStatus() - getRepairStatus()) * 1000);
this.mEfficiencyIncrease = 10000;
if (mEUt <= 16) {
this.mEUt = (mEUt * (1 << tTier - 1) * (1 << tTier - 1));
this.mMaxProgresstime = (mMaxProgresstime / (1 << tTier - 1));
} else {
while (this.mEUt <= gregtech.api.enums.GT_Values.V[(tTier - 1)]) {
this.mEUt *= 4;
this.mMaxProgresstime /= 2;
}
}
this.mMaxProgresstime = Math.max(1, this.mMaxProgresstime);
calculateOverclockedNessMulti(mEUt, mMaxProgresstime, 1, getMaxInputVoltage());
//In case recipe is too OP for that machine
if (mMaxProgresstime == Integer.MAX_VALUE - 1 && mEUt == Integer.MAX_VALUE - 1)
return false;
updateSlots();
return true;
}

View file

@ -94,7 +94,7 @@ public class GT_MetaTileEntity_DistillationTower
}
long tVoltage = getMaxInputVoltage();
byte tTier = (byte) Math.max(1, GT_Utility.getTier(tVoltage));
byte tTier = (byte) Math.max(0, GT_Utility.getTier(tVoltage));
FluidStack[] tFluids = (FluidStack[]) Arrays.copyOfRange(tFluidList.toArray(new FluidStack[tFluidList.size()]), 0, tFluidList.size());
if (tFluids.length > 0) {
for(int i = 0;i<tFluids.length;i++){
@ -103,17 +103,10 @@ public class GT_MetaTileEntity_DistillationTower
if (tRecipe.isRecipeInputEqual(true, tFluids, new ItemStack[]{})) {
this.mEfficiency = (10000 - (getIdealStatus() - getRepairStatus()) * 1000);
this.mEfficiencyIncrease = 10000;
if (tRecipe.mEUt <= 16) {
this.mEUt = (tRecipe.mEUt * (1 << tTier - 1) * (1 << tTier - 1));
this.mMaxProgresstime = (tRecipe.mDuration / (1 << tTier - 1));
} else {
this.mEUt = tRecipe.mEUt;
this.mMaxProgresstime = tRecipe.mDuration;
while (this.mEUt <= gregtech.api.enums.GT_Values.V[(tTier - 1)]) {
this.mEUt *= 4;
this.mMaxProgresstime /= 2;
}
}
calculateOverclockedNessMulti(mEUt, mMaxProgresstime, 1, tVoltage);
//In case recipe is too OP for that machine
if (mMaxProgresstime == Integer.MAX_VALUE - 1 && mEUt == Integer.MAX_VALUE - 1)
return false;
if (this.mEUt > 0) {
this.mEUt = (-this.mEUt);
}

View file

@ -108,17 +108,10 @@ public class GT_MetaTileEntity_ElectricBlastFurnace
if ((tRecipe != null) && (this.mHeatingCapacity >= tRecipe.mSpecialValue) && (tRecipe.isRecipeInputEqual(true, tFluids, tInputs))) {
this.mEfficiency = (10000 - (getIdealStatus() - getRepairStatus()) * 1000);
this.mEfficiencyIncrease = 10000;
if (tRecipe.mEUt <= 16) {
this.mEUt = (tRecipe.mEUt * (1 << tTier - 1) * (1 << tTier - 1));
this.mMaxProgresstime = (tRecipe.mDuration / (1 << tTier - 1));
} else {
this.mEUt = tRecipe.mEUt;
this.mMaxProgresstime = tRecipe.mDuration;
while (this.mEUt <= gregtech.api.enums.GT_Values.V[(tTier - 1)]) {
this.mEUt *= 4;
this.mMaxProgresstime /= 2;
}
}
calculateOverclockedNessMulti(mEUt, mMaxProgresstime, 1, tVoltage);
//In case recipe is too OP for that machine
if (mMaxProgresstime == Integer.MAX_VALUE - 1 && mEUt == Integer.MAX_VALUE - 1)
return false;
if (this.mEUt > 0) {
this.mEUt = (-this.mEUt);
}

View file

@ -87,9 +87,12 @@ public class GT_MetaTileEntity_ImplosionCompressor
if ((tRecipe != null) && (tRecipe.isRecipeInputEqual(true, null, tInputs))) {
this.mEfficiency = (10000 - (getIdealStatus() - getRepairStatus()) * 1000);
this.mEfficiencyIncrease = 10000;
//OC THAT EXPLOSIVE SHIT!!!
calculateOverclockedNessMulti(mEUt, tRecipe.mDuration, 1, getMaxInputVoltage());
//In case recipe is too OP for that machine
if (mMaxProgresstime == Integer.MAX_VALUE - 1 && mEUt == Integer.MAX_VALUE - 1)
return false;
this.mEUt = (-tRecipe.mEUt);
this.mMaxProgresstime = Math.max(1, tRecipe.mDuration);
this.mOutputItems = new ItemStack[]{tRecipe.getOutput(0), tRecipe.getOutput(1)};
sendLoopStart((byte) 20);
updateSlots();

View file

@ -130,12 +130,12 @@ public abstract class GT_MetaTileEntity_LargeTurbine extends GT_MetaTileEntity_M
if (baseEff == 0 || optFlow == 0 || counter >= 1000 || this.getBaseMetaTileEntity().hasWorkJustBeenEnabled()
|| this.getBaseMetaTileEntity().hasInventoryBeenModified()) {
counter = 0;
baseEff = (int) ((50.0F
+ (10.0F * ((GT_MetaGenerated_Tool) aStack.getItem()).getToolCombatDamage(aStack))) * 100);
optFlow = (int) Math.max(Float.MIN_NORMAL,
baseEff = GT_Utility.safeInt((long)((50.0F
+ (10.0F * ((GT_MetaGenerated_Tool) aStack.getItem()).getToolCombatDamage(aStack))) * 100));
optFlow = GT_Utility.safeInt((long)Math.max(Float.MIN_NORMAL,
((GT_MetaGenerated_Tool) aStack.getItem()).getToolStats(aStack).getSpeedMultiplier()
* ((GT_MetaGenerated_Tool) aStack.getItem()).getPrimaryMaterial(aStack).mToolSpeed
* 50);
* 50));
} else {
counter++;
}
@ -146,7 +146,7 @@ public abstract class GT_MetaTileEntity_LargeTurbine extends GT_MetaTileEntity_M
// Magic numbers: can always change by at least 10 eu/t, but otherwise by at most 1 percent of the difference in power level (per tick)
// This is how much the turbine can actually change during this tick
int maxChangeAllowed = Math.max(10, (int) Math.ceil(Math.abs(difference) * 0.01));
int maxChangeAllowed = Math.max(10, GT_Utility.safeInt((long)Math.ceil(Math.abs(difference) * 0.01)));
if (Math.abs(difference) > maxChangeAllowed) { // If this difference is too big, use the maximum allowed change
int change = maxChangeAllowed * (difference > 0 ? 1 : -1); // Make the change positive or negative.
@ -164,7 +164,7 @@ public abstract class GT_MetaTileEntity_LargeTurbine extends GT_MetaTileEntity_M
this.mMaxProgresstime = 1;
this.mEfficiencyIncrease = (10);
if(this.mDynamoHatches.size()>0){
if(this.mDynamoHatches.get(0).getBaseMetaTileEntity().getOutputVoltage() < (int)((long)mEUt * (long)mEfficiency / 10000L)){
if(this.mDynamoHatches.get(0).getBaseMetaTileEntity().getOutputVoltage() < GT_Utility.safeInt((long)mEUt * (long)mEfficiency / 10000L)){
explodeMultiblock();}
}
return true;
@ -209,7 +209,7 @@ public abstract class GT_MetaTileEntity_LargeTurbine extends GT_MetaTileEntity_M
int tDura = 0;
if (mInventory[1] != null && mInventory[1].getItem() instanceof GT_MetaGenerated_Tool_01) {
tDura = (int) ((100.0f / GT_MetaGenerated_Tool.getToolMaxDamage(mInventory[1]) * (GT_MetaGenerated_Tool.getToolDamage(mInventory[1]))+1));
tDura = GT_Utility.safeInt((long)(100.0f / GT_MetaGenerated_Tool.getToolMaxDamage(mInventory[1]) * (GT_MetaGenerated_Tool.getToolDamage(mInventory[1]))+1));
}
return new String[]{

View file

@ -88,10 +88,10 @@ public class GT_MetaTileEntity_LargeTurbine_Gas extends GT_MetaTileEntity_LargeT
if (aFluids.size() >= 1) {
FluidStack firstFuelType = new FluidStack(aFluids.get(0), 0); // Identify a SINGLE type of fluid to process. Doesn't matter which one. Ignore the rest!
int fuelValue = getFuelValue(firstFuelType);
actualOptimalFlow = (int) (aOptFlow / fuelValue);
actualOptimalFlow = GT_Utility.safeInt((long)aOptFlow / fuelValue);
this.realOptFlow = actualOptimalFlow;
int remainingFlow = (int) (actualOptimalFlow * 1.25f); // Allowed to use up to 125% of optimal flow. Variable required outside of loop for multi-hatch scenarios.
int remainingFlow = GT_Utility.safeInt((long)(actualOptimalFlow * 1.25f)); // Allowed to use up to 125% of optimal flow. Variable required outside of loop for multi-hatch scenarios.
int flow = 0;
int totalFlow = 0;
@ -106,7 +106,7 @@ public class GT_MetaTileEntity_LargeTurbine_Gas extends GT_MetaTileEntity_LargeT
}
}
tEU = (int) (Math.min((float) actualOptimalFlow, totalFlow) * fuelValue);
tEU = GT_Utility.safeInt((long)Math.min((float) actualOptimalFlow, totalFlow) * fuelValue);
if (totalFlow != actualOptimalFlow) {
float efficiency = 1.0f - Math.abs(((totalFlow - (float) actualOptimalFlow) / actualOptimalFlow));
@ -114,9 +114,9 @@ public class GT_MetaTileEntity_LargeTurbine_Gas extends GT_MetaTileEntity_LargeT
if (efficiency < 0)
efficiency = 0; // Can happen with really ludicrously poor inefficiency.
tEU *= efficiency;
tEU = Math.max(1, (int)((long)tEU * (long)aBaseEff / 10000L));
tEU = Math.max(1, GT_Utility.safeInt((long)tEU * (long)aBaseEff / 10000L));
} else {
tEU = (int)((long)tEU * (long)aBaseEff / 10000L);
tEU = GT_Utility.safeInt((long)tEU * (long)aBaseEff / 10000L);
}
return tEU;

View file

@ -8,6 +8,7 @@ import gregtech.api.interfaces.metatileentity.IMetaTileEntity;
import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
import gregtech.api.objects.GT_RenderedTexture;
import gregtech.api.util.GT_ModHandler;
import gregtech.api.util.GT_Utility;
import net.minecraft.block.Block;
import net.minecraft.item.ItemStack;
import net.minecraftforge.fluids.FluidStack;
@ -73,14 +74,14 @@ public class GT_MetaTileEntity_LargeTurbine_HPSteam extends GT_MetaTileEntity_La
int tEU = 0;
int totalFlow = 0; // Byproducts are based on actual flow
int flow = 0;
int remainingFlow = (int) (aOptFlow * 1.25f); // Allowed to use up to 125% of optimal flow
int remainingFlow = GT_Utility.safeInt((long)(aOptFlow * 1.25f)); // Allowed to use up to 125% of optimal flow
this.realOptFlow = aOptFlow;
for (int i = 0; i < aFluids.size() && remainingFlow > 0; i++) {
String fluidName = aFluids.get(i).getFluid().getUnlocalizedName(aFluids.get(i));
if (fluidName.equals("ic2.fluidSuperheatedSteam")) {
flow = aFluids.get(i).amount; // Get all (steam) in hatch
flow = Math.min(flow, Math.min(remainingFlow, (int) (aOptFlow * 1.25f))); // try to use up to 125% of optimal flow w/o exceeding remainingFlow
flow = Math.min(flow, Math.min(remainingFlow, GT_Utility.safeInt((long)(aOptFlow * 1.25f)))); // try to use up to 125% of optimal flow w/o exceeding remainingFlow
depleteInput(new FluidStack(aFluids.get(i), flow)); // deplete that amount
this.storedFluid = aFluids.get(i).amount;
remainingFlow -= flow; // track amount we're allowed to keep depleting from hatches
@ -97,15 +98,15 @@ public class GT_MetaTileEntity_LargeTurbine_HPSteam extends GT_MetaTileEntity_La
}
}
tEU = (int) (Math.min((float) aOptFlow, totalFlow));
tEU = GT_Utility.safeInt((long)Math.min((float) aOptFlow, totalFlow));
addOutput(GT_ModHandler.getSteam(totalFlow));
if (totalFlow > 0 && totalFlow != aOptFlow) {
float efficiency = 1.0f - Math.abs(((totalFlow - (float) aOptFlow) / aOptFlow));
if(totalFlow>aOptFlow){efficiency = 1.0f;}
tEU *= efficiency;
tEU = Math.max(1, (int)((long)tEU * (long)aBaseEff / 10000L));
tEU = Math.max(1, GT_Utility.safeInt((long)tEU * (long)aBaseEff / 10000L));
} else {
tEU = (int)((long)tEU * (long)aBaseEff / 10000L);
tEU = GT_Utility.safeInt((long)tEU * (long)aBaseEff / 10000L);
}
return tEU;

View file

@ -92,17 +92,17 @@ public class GT_MetaTileEntity_LargeTurbine_Plasma extends GT_MetaTileEntity_Lar
if (aFluids.size() >= 1) {
FluidStack firstFuelType = new FluidStack(aFluids.get(0), 0); // Identify a SINGLE type of fluid to process. Doesn't matter which one. Ignore the rest!
int fuelValue = getFuelValue(firstFuelType);
actualOptimalFlow = (int) ((aOptFlow + fuelValue - 1) / fuelValue);
actualOptimalFlow = GT_Utility.safeInt(((long)aOptFlow + (long)fuelValue - 1) / (long)fuelValue);
this.realOptFlow = actualOptimalFlow; // For scanner info
int remainingFlow = (int) (actualOptimalFlow * 1.25f); // Allowed to use up to 125% of optimal flow. Variable required outside of loop for multi-hatch scenarios.
int remainingFlow = GT_Utility.safeInt((long)(actualOptimalFlow * 1.25f)); // Allowed to use up to 125% of optimal flow. Variable required outside of loop for multi-hatch scenarios.
int flow = 0;
int totalFlow = 0;
for (int i = 0; i < aFluids.size(); i++) {
if (aFluids.get(i).isFluidEqual(firstFuelType)) {
flow = aFluids.get(i).amount; // Get all (steam) in hatch
flow = Math.min(flow, Math.min(remainingFlow, (int) (actualOptimalFlow * 1.25f))); // try to use up to 125% of optimal flow w/o exceeding remainingFlow
flow = Math.min(flow, Math.min(remainingFlow, GT_Utility.safeInt((long)(actualOptimalFlow * 1.25f)))); // try to use up to 125% of optimal flow w/o exceeding remainingFlow
depleteInput(new FluidStack(aFluids.get(i), flow)); // deplete that amount
this.storedFluid = aFluids.get(i).amount;
remainingFlow -= flow; // track amount we're allowed to continue depleting from hatches
@ -122,7 +122,7 @@ public class GT_MetaTileEntity_LargeTurbine_Plasma extends GT_MetaTileEntity_Lar
}
}
tEU = (int) (Math.min((float) actualOptimalFlow, totalFlow) * fuelValue);
tEU = GT_Utility.safeInt((long)Math.min((float) actualOptimalFlow, totalFlow) * fuelValue);
if (totalFlow != actualOptimalFlow) {
float efficiency = 1.0f - Math.abs(((totalFlow - (float) actualOptimalFlow) / actualOptimalFlow));
@ -130,9 +130,9 @@ public class GT_MetaTileEntity_LargeTurbine_Plasma extends GT_MetaTileEntity_Lar
if (efficiency < 0)
efficiency = 0; // Can happen with really ludicrously poor inefficiency.
tEU *= efficiency;
tEU = Math.max(1, (int)((long)tEU * (long)aBaseEff / 10000L));
tEU = Math.max(1, GT_Utility.safeInt((long)tEU * (long)aBaseEff / 10000L));
} else {
tEU = (int)((long)tEU * (long)aBaseEff / 10000L);
tEU = GT_Utility.safeInt((long)tEU * (long)aBaseEff / 10000L);
}
return tEU;

View file

@ -8,6 +8,7 @@ import gregtech.api.interfaces.metatileentity.IMetaTileEntity;
import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
import gregtech.api.objects.GT_RenderedTexture;
import gregtech.api.util.GT_ModHandler;
import gregtech.api.util.GT_Utility;
import net.minecraft.block.Block;
import net.minecraft.item.ItemStack;
import net.minecraftforge.fluids.FluidStack;
@ -82,14 +83,14 @@ public class GT_MetaTileEntity_LargeTurbine_Steam extends GT_MetaTileEntity_Larg
int tEU = 0;
int totalFlow = 0; // Byproducts are based on actual flow
int flow = 0;
int remainingFlow = (int) (aOptFlow * 1.25f); // Allowed to use up to 125% of optimal flow. Variable required outside of loop for multi-hatch scenarios.
this.realOptFlow = ((aOptFlow / 2) / (0.5));
int remainingFlow = GT_Utility.safeInt((long)(aOptFlow * 1.25f)); // Allowed to use up to 125% of optimal flow. Variable required outside of loop for multi-hatch scenarios.
this.realOptFlow = ((aOptFlow>>1)<<1);//REALLY?
for (int i = 0; i < aFluids.size() && remainingFlow > 0; i++) { // loop through each hatch; extract inputs and track totals.
String fluidName = aFluids.get(i).getFluid().getUnlocalizedName(aFluids.get(i));
if (fluidName.equals("fluid.steam") || fluidName.equals("ic2.fluidSteam") || fluidName.equals("fluid.mfr.steam.still.name")) {
flow = aFluids.get(i).amount; // Get all (steam) in hatch
flow = Math.min(flow, Math.min(remainingFlow, (int) (aOptFlow * 1.25f))); // try to use up to 125% of optimal flow w/o exceeding remainingFlow
flow = Math.min(flow, Math.min(remainingFlow, GT_Utility.safeInt((long)(aOptFlow * 1.25f)))); // try to use up to 125% of optimal flow w/o exceeding remainingFlow
depleteInput(new FluidStack(aFluids.get(i), flow)); // deplete that amount
this.storedFluid = aFluids.get(i).amount;
remainingFlow -= flow; // track amount we're allowed to continue depleting from hatches
@ -104,16 +105,16 @@ public class GT_MetaTileEntity_LargeTurbine_Steam extends GT_MetaTileEntity_Larg
}
}
tEU = (int) (Math.min((float) aOptFlow, totalFlow));
tEU = GT_Utility.safeInt((long)(Math.min((float) aOptFlow, totalFlow)));
int waterToOutput = useWater(totalFlow / 160.0f);
addOutput(GT_ModHandler.getDistilledWater(waterToOutput));
if (totalFlow > 0 && totalFlow != aOptFlow) {
float efficiency = 1.0f - Math.abs(((totalFlow - (float) aOptFlow) / aOptFlow));
if(totalFlow>aOptFlow){efficiency = 1.0f;}
tEU *= efficiency;
tEU = Math.max(1, (int)((long)tEU * (long)aBaseEff / 20000L));
tEU = Math.max(1, GT_Utility.safeInt((long)tEU * (long)aBaseEff / 20000L));
} else {
tEU = (int)((long)tEU * (long)aBaseEff / 20000L);
tEU = GT_Utility.safeInt((long)tEU * (long)aBaseEff / 20000L);
}
return tEU;

View file

@ -75,7 +75,7 @@ public class GT_MetaTileEntity_MultiFurnace
public boolean checkRecipe(ItemStack aStack) {
ArrayList<ItemStack> tInputList = getStoredInputs();
if (!tInputList.isEmpty()) {
byte tTier = (byte) Math.max(1, GT_Utility.getTier(getMaxInputVoltage()));
int mVolatage=GT_Utility.safeInt(getMaxInputVoltage());
int j = 0;
this.mOutputItems = new ItemStack[8 * this.mLevel];
@ -87,9 +87,12 @@ public class GT_MetaTileEntity_MultiFurnace
if (j > 0) {
this.mEfficiency = (10000 - (getIdealStatus() - getRepairStatus()) * 1000);
this.mEfficiencyIncrease = 10000;
calculateOverclockedNessMulti(4, 512, 1, mVolatage);
//In case recipe is too OP for that machine
if (mMaxProgresstime == Integer.MAX_VALUE - 1 && mEUt == Integer.MAX_VALUE - 1)
return false;
this.mEUt = (-4 * (1 << tTier - 1) * (1 << tTier - 1) * this.mLevel / this.mCostDiscount);
this.mMaxProgresstime = Math.max(1, 512 / (1 << tTier - 1));
this.mEUt = -GT_Utility.safeInt(((long)mEUt) * this.mLevel / (long)this.mCostDiscount);
}
updateSlots();
return true;

View file

@ -83,22 +83,14 @@ public class GT_MetaTileEntity_OilCracker extends GT_MetaTileEntity_MultiBlockBa
this.mEfficiency = (10000 - (getIdealStatus() - getRepairStatus()) * 1000);
this.mEfficiencyIncrease = 10000;
if (tRecipe.mEUt <= 16) {
this.mEUt = (tRecipe.mEUt * (1 << tTier - 1) * (1 << tTier - 1));
this.mMaxProgresstime = (tRecipe.mDuration / (1 << tTier - 1));
} else {
this.mEUt = tRecipe.mEUt;
this.mMaxProgresstime = tRecipe.mDuration;
while (this.mEUt <= gregtech.api.enums.GT_Values.V[(tTier - 1)]) {
this.mEUt *= 4;
this.mMaxProgresstime /= 2;
}
}
calculateOverclockedNessMulti(mEUt, tRecipe.mDuration, 1, getMaxInputVoltage());
//In case recipe is too OP for that machine
if (mMaxProgresstime == Integer.MAX_VALUE - 1 && mEUt == Integer.MAX_VALUE - 1)
return false;
if (steam) this.mEUt = this.mEUt / 2;
if (this.mEUt > 0) {
this.mEUt = (-this.mEUt);
}
this.mMaxProgresstime = Math.max(1, this.mMaxProgresstime);
this.mOutputFluids = new FluidStack[]{tRecipe.getFluidOutput(0)};
if (hydrogen) this.mOutputFluids[0].amount = this.mOutputFluids[0].amount * 130 / 100;
return true;

View file

@ -89,27 +89,15 @@ public class GT_MetaTileEntity_OilDrill extends GT_MetaTileEntity_MultiBlockBase
} else {
tFluid.amount = tFluid.amount / 5000;
}
long tVoltage = getMaxInputVoltage();
byte tTier = (byte) Math.max(1, GT_Utility.getTier(tVoltage));
this.mEfficiency = (10000 - (getIdealStatus() - getRepairStatus()) * 1000);
this.mEfficiencyIncrease = 10000;
int tEU = 24;
int tDuration = 160;
if (tEU <= 16) {
this.mEUt = (tEU * (1 << tTier - 1) * (1 << tTier - 1));
this.mMaxProgresstime = (tDuration / (1 << tTier - 1));
} else {
this.mEUt = tEU;
this.mMaxProgresstime = tDuration;
while (this.mEUt <= gregtech.api.enums.GT_Values.V[(tTier - 1)]) {
this.mEUt *= 4;
this.mMaxProgresstime /= 2;
}
}
calculateOverclockedNessMulti(24, 160, 1, getMaxInputVoltage());
//In case recipe is too OP for that machine
if (mMaxProgresstime == Integer.MAX_VALUE - 1 && mEUt == Integer.MAX_VALUE - 1)
return false;
if (this.mEUt > 0) {
this.mEUt = (-this.mEUt);
}
this.mMaxProgresstime = Math.max(1, this.mMaxProgresstime);
this.mOutputFluids = new FluidStack[]{tFluid};
return true;
}

View file

@ -1,6 +1,7 @@
package gregtech.common.tileentities.machines.multi;
import gregtech.api.GregTech_API;
import gregtech.api.enums.GT_Values;
import gregtech.api.enums.Textures;
import gregtech.api.gui.GT_GUIContainer_MultiMachine;
import gregtech.api.interfaces.ITexture;
@ -170,6 +171,24 @@ public class GT_MetaTileEntity_ProcessingArray extends GT_MetaTileEntity_MultiBl
}
ArrayList<ItemStack> tInputList = getStoredInputs();
int tTier = 0;
if (mInventory[1].getUnlocalizedName().endsWith("10")) {
tTier = 10;
}
if (mInventory[1].getUnlocalizedName().endsWith("11")) {
tTier = 11;
}
if (mInventory[1].getUnlocalizedName().endsWith("12")) {
tTier = 12;
}
if (mInventory[1].getUnlocalizedName().endsWith("13")) {
tTier = 13;
}
if (mInventory[1].getUnlocalizedName().endsWith("14")) {
tTier = 14;
}
if (mInventory[1].getUnlocalizedName().endsWith("15")) {
tTier = 15;
}
if (mInventory[1].getUnlocalizedName().endsWith("1")) {
tTier = 1;
}
@ -194,6 +213,9 @@ public class GT_MetaTileEntity_ProcessingArray extends GT_MetaTileEntity_MultiBl
if (mInventory[1].getUnlocalizedName().endsWith("8")) {
tTier = 8;
}
if (mInventory[1].getUnlocalizedName().endsWith("9")) {
tTier = 9;
}
if(!mMachine.equals(mInventory[1].getUnlocalizedName()))mLastRecipe=null;
mMachine = mInventory[1].getUnlocalizedName();
@ -222,18 +244,14 @@ public class GT_MetaTileEntity_ProcessingArray extends GT_MetaTileEntity_MultiBl
this.mMaxProgresstime = tRecipe.mDuration;
this.mEfficiency = (10000 - (getIdealStatus() - getRepairStatus()) * 1000);
this.mEfficiencyIncrease = 10000;
if (tRecipe.mEUt <= 16) {
this.mEUt = (tRecipe.mEUt * (1 << tTier - 1) * (1 << tTier - 1));
this.mMaxProgresstime = (tRecipe.mDuration / (1 << tTier - 1));
} else {
this.mEUt = tRecipe.mEUt;
this.mMaxProgresstime = tRecipe.mDuration;
while (this.mEUt <= gregtech.api.enums.GT_Values.V[(tTier - 1)]) {
this.mEUt *= 4;
this.mMaxProgresstime /= 2;
}
}
this.mEUt *= i;
calculateOverclockedNessMulti(tRecipe.mEUt, tRecipe.mDuration, 1, GT_Values.V[tTier]);
//In case recipe is too OP for that machine
if (mMaxProgresstime == Integer.MAX_VALUE - 1 && mEUt == Integer.MAX_VALUE - 1)
return false;
this.mEUt = GT_Utility.safeInt(this.mEUt*i,1);
if (mEUt == Integer.MAX_VALUE - 1)
return false;
if (this.mEUt > 0) {
this.mEUt = (-this.mEUt);
}

View file

@ -67,19 +67,10 @@ public class GT_MetaTileEntity_PyrolyseOven extends GT_MetaTileEntity_MultiBlock
this.mEfficiency = (10000 - (getIdealStatus() - getRepairStatus()) * 1000);
this.mEfficiencyIncrease = 10000;
this.mEUt = tRecipe.mEUt;
this.mMaxProgresstime = tRecipe.mDuration;
if (tRecipe.mEUt <= 16) {
this.mEUt = (tRecipe.mEUt * (1 << tTier - 1) * (1 << tTier - 1));
this.mMaxProgresstime = (tRecipe.mDuration / (1 << tTier - 1));
} else {
this.mEUt = tRecipe.mEUt;
this.mMaxProgresstime = tRecipe.mDuration;
while (this.mEUt <= gregtech.api.enums.GT_Values.V[(tTier - 1)]) {
this.mEUt *= 4;
this.mMaxProgresstime /= 2;
}
}
calculateOverclockedNessMulti(tRecipe.mEUt, tRecipe.mDuration, 1, tVoltage);
//In case recipe is too OP for that machine
if (mMaxProgresstime == Integer.MAX_VALUE - 1 && mEUt == Integer.MAX_VALUE - 1)
return false;
if (this.mEUt > 0) {
this.mEUt = (-this.mEUt);
}

View file

@ -76,17 +76,11 @@ public class GT_MetaTileEntity_VacuumFreezer
if (tRecipe.isRecipeInputEqual(true, null, new ItemStack[]{tInput})) {
this.mEfficiency = (10000 - (getIdealStatus() - getRepairStatus()) * 1000);
this.mEfficiencyIncrease = 10000;
if (tRecipe.mEUt <= 16) {
this.mEUt = (tRecipe.mEUt * (1 << tTier - 1) * (1 << tTier - 1));
this.mMaxProgresstime = (tRecipe.mDuration / (1 << tTier - 1));
} else {
this.mEUt = tRecipe.mEUt;
this.mMaxProgresstime = tRecipe.mDuration;
while (this.mEUt <= gregtech.api.enums.GT_Values.V[(tTier - 1)]) {
this.mEUt *= 4;
this.mMaxProgresstime /= 2;
}
}
calculateOverclockedNessMulti(tRecipe.mEUt, tRecipe.mDuration, 1, tVoltage);
//In case recipe is too OP for that machine
if (mMaxProgresstime == Integer.MAX_VALUE - 1 && mEUt == Integer.MAX_VALUE - 1)
return false;
if (this.mEUt > 0) {
this.mEUt = (-this.mEUt);
}