aboutsummaryrefslogtreecommitdiff
path: root/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi
diff options
context:
space:
mode:
authorbotn365 <42187820+botn365@users.noreply.github.com>2020-01-08 16:48:18 +0100
committerGitHub <noreply@github.com>2020-01-08 16:48:18 +0100
commita3a9d4a5c2e466db33879176626670f2f07b635a (patch)
tree8176e79d6be425dc28cc3a612416b832a5bed3c5 /src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi
parentd7c83c3cd1036668c1f520f144c08de444f675a4 (diff)
parent6bb3c6872c97b36c84f32bf730eee31206728c74 (diff)
downloadGT5-Unofficial-a3a9d4a5c2e466db33879176626670f2f07b635a.tar.gz
GT5-Unofficial-a3a9d4a5c2e466db33879176626670f2f07b635a.tar.bz2
GT5-Unofficial-a3a9d4a5c2e466db33879176626670f2f07b635a.zip
Merge pull request #7 from alkcorp/master
sync
Diffstat (limited to 'src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi')
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialDehydrator.java3
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/advanced/GregtechMetaTileEntity_Adv_DistillationTower.java375
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntity_LargeRocketEngine.java224
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntity_MassFabricator.java5
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/algae/GregtechMTE_AlgaePondBase.java1
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/chemplant/GregtechMTE_ChemicalPlant.java372
6 files changed, 867 insertions, 113 deletions
diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialDehydrator.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialDehydrator.java
index 4cead1c2a8..78896dd650 100644
--- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialDehydrator.java
+++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialDehydrator.java
@@ -212,6 +212,7 @@ public class GregtechMetaTileEntity_IndustrialDehydrator extends GregtechMeta_Mu
long tVoltage = getMaxInputVoltage();
byte tTier = (byte) Math.max(1, GT_Utility.getTier(tVoltage));
+ long tEnergy = getMaxInputEnergy();
Logger.WARNING("Running checkRecipeGeneric(0)");
GT_Recipe tRecipe = this.getRecipeMap().findRecipe(getBaseMetaTileEntity(), mLastRecipe, false,
@@ -239,7 +240,7 @@ public class GregtechMetaTileEntity_IndustrialDehydrator extends GregtechMeta_Mu
int parallelRecipes = 0;
// Count recipes to do in parallel, consuming input items and fluids and
// considering input voltage limits
- for (; parallelRecipes < aMaxParallelRecipes && tTotalEUt < (tVoltage - tRecipeEUt); parallelRecipes++) {
+ for (; parallelRecipes < aMaxParallelRecipes && tTotalEUt < (tEnergy - tRecipeEUt); parallelRecipes++) {
if (!tRecipe.isRecipeInputEqual(true, aFluidInputs, aItemInputs)) {
Logger.WARNING("Broke at " + parallelRecipes + ".");
break;
diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/advanced/GregtechMetaTileEntity_Adv_DistillationTower.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/advanced/GregtechMetaTileEntity_Adv_DistillationTower.java
new file mode 100644
index 0000000000..e5387d8c6f
--- /dev/null
+++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/advanced/GregtechMetaTileEntity_Adv_DistillationTower.java
@@ -0,0 +1,375 @@
+package gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.processing.advanced;
+
+import gregtech.api.GregTech_API;
+import gregtech.api.enums.Textures;
+import gregtech.api.gui.GT_GUIContainer_MultiMachine;
+import gregtech.api.interfaces.ITexture;
+import gregtech.api.interfaces.metatileentity.IMetaTileEntity;
+import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
+import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_InputBus;
+import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Output;
+import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_MultiBlockBase;
+import gregtech.api.objects.GT_RenderedTexture;
+import gregtech.api.util.GT_ModHandler;
+import gregtech.api.util.GT_Recipe;
+import gregtech.api.util.GT_Utility;
+import gtPlusPlus.core.util.Utils;
+import gtPlusPlus.core.util.minecraft.PlayerUtils;
+import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base.GregtechMeta_MultiBlockBase;
+import net.minecraft.block.Block;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.entity.player.InventoryPlayer;
+import net.minecraft.item.ItemStack;
+import net.minecraft.nbt.NBTTagCompound;
+import net.minecraftforge.common.util.ForgeDirection;
+import net.minecraftforge.fluids.FluidStack;
+import org.apache.commons.lang3.ArrayUtils;
+
+import java.util.ArrayList;
+
+public class GregtechMetaTileEntity_Adv_DistillationTower extends GregtechMeta_MultiBlockBase {
+
+ private static final int CASING_INDEX = 49;
+
+ private short mControllerY = 0;
+
+ private byte mMode = 0;
+
+ public GregtechMetaTileEntity_Adv_DistillationTower(int aID, String aName, String aNameRegional) {
+ super(aID, aName, aNameRegional);
+ }
+
+ public GregtechMetaTileEntity_Adv_DistillationTower(String aName) {
+ super(aName);
+ }
+
+ public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) {
+ return new GregtechMetaTileEntity_Adv_DistillationTower(this.mName);
+ }
+
+ public String[] getTooltip() {
+ String s = "Max parallel dictated by tower tier and mode";
+ String s1 = "DTower Mode: T1=4, T2=12";
+ String s2 = "Distilery Mode: Tower Tier * (4*InputTier)";
+ return new String[]{
+ "Controller Block for the Advanced Distillation Tower",
+ "T1 constructed identical to standard DT",
+ "T2 is currently disabled.",
+ "T2 is not variable height",
+ "Size(WxHxD): 3x26x3",
+ "Controller (Front bottom)",
+ "1x Input Hatch (Any bottom layer casing)",
+ "24x Output Hatch (One per layer except bottom/top layer)",
+ "1x Output Bus (Any bottom layer casing)",
+ "1x Maintenance Hatch (Any casing)",
+ "1x Energy Hatch (Any casing)",
+ "Integral Framework I's for the rest",
+ s,
+ s1,
+ s2};
+ }
+
+ public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) {
+ if (aSide == aFacing) {
+ return new ITexture[]{Textures.BlockIcons.CASING_BLOCKS[CASING_INDEX], new GT_RenderedTexture(aActive ? Textures.BlockIcons.OVERLAY_FRONT_DISTILLATION_TOWER_ACTIVE : Textures.BlockIcons.OVERLAY_FRONT_DISTILLATION_TOWER)};
+ }
+ return new ITexture[]{Textures.BlockIcons.CASING_BLOCKS[CASING_INDEX]};
+ }
+
+ public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) {
+ return new GT_GUIContainer_MultiMachine(aPlayerInventory, aBaseMetaTileEntity, getLocalName(), "DistillationTower.png");
+ }
+
+ public GT_Recipe.GT_Recipe_Map getRecipeMap() {
+ return mMode == 0 ? GT_Recipe.GT_Recipe_Map.sDistillationRecipes : GT_Recipe.GT_Recipe_Map.sDistilleryRecipes;
+ }
+
+ public boolean isCorrectMachinePart(ItemStack aStack) {
+ return true;
+ }
+
+ public boolean isFacingValid(byte aFacing) {
+ return aFacing > 1;
+ }
+
+ public int getMaxEfficiency(ItemStack aStack) {
+ return 10000;
+ }
+
+ public int getPollutionPerTick(ItemStack aStack) {
+ return this.mMode == 1 ? 12 : 24;
+ }
+
+ @Override
+ public void saveNBTData(NBTTagCompound aNBT) {
+ aNBT.setByte("mMode", mMode);
+ super.saveNBTData(aNBT);
+ }
+
+ @Override
+ public void loadNBTData(NBTTagCompound aNBT) {
+ mMode = aNBT.getByte("mMode");
+ super.loadNBTData(aNBT);
+ }
+
+ @Override
+ public String getSound() {
+ return GregTech_API.sSoundList.get(Integer.valueOf(203));
+ }
+
+ @Override
+ public void startProcess() {
+ this.sendLoopStart((byte) 1);
+ }
+
+ @Override
+ public void onModeChangeByScrewdriver(byte aSide, EntityPlayer aPlayer, float aX, float aY, float aZ) {
+ mMode++;
+ if (mMode > 1){
+ mMode = 0;
+ PlayerUtils.messagePlayer(aPlayer, "Now running in Distillation Tower Mode.");
+ }
+ else {
+ PlayerUtils.messagePlayer(aPlayer, "Now running in Distillery Mode.");
+ }
+ }
+
+ public int getDamageToComponent(ItemStack aStack) {
+ return 0;
+ }
+
+ public boolean explodesOnComponentBreak(ItemStack aStack) {
+ return false;
+ }
+
+ @Override
+ public boolean addOutput(FluidStack aLiquid) {
+ if (aLiquid == null) return false;
+ FluidStack tLiquid = aLiquid.copy();
+ for (GT_MetaTileEntity_Hatch_Output tHatch : mOutputHatches) {
+ if (isValidMetaTileEntity(tHatch) && GT_ModHandler.isSteam(aLiquid) ? tHatch.outputsSteam() : tHatch.outputsLiquids()) {
+ if (tHatch.getBaseMetaTileEntity().getYCoord() == this.mControllerY + 1) {
+ int tAmount = tHatch.fill(tLiquid, false);
+ if (tAmount >= tLiquid.amount) {
+ return tHatch.fill(tLiquid, true) >= tLiquid.amount;
+ } else if (tAmount > 0) {
+ tLiquid.amount = tLiquid.amount - tHatch.fill(tLiquid, true);
+ }
+ }
+ }
+ }
+ return false;
+ }
+
+ @Override
+ protected void addFluidOutputs(FluidStack[] mOutputFluids2) {
+ for (int i = 0; i < mOutputFluids2.length; i++) {
+ if (mOutputHatches.size() > i && mOutputHatches.get(i) != null && mOutputFluids2[i] != null && isValidMetaTileEntity(mOutputHatches.get(i))) {
+ if (mOutputHatches.get(i).getBaseMetaTileEntity().getYCoord() == this.mControllerY + 1 + i) {
+ mOutputHatches.get(i).fill(mOutputFluids2[i], true);
+ }
+ }
+ }
+
+ }
+
+ @Override
+ public boolean hasSlotInGUI() {
+ return true;
+ }
+
+ @Override
+ public boolean requiresVanillaGtGUI() {
+ return true;
+ }
+
+ @Override
+ public String getCustomGUIResourceName() {
+ return "DistillationTower";
+ }
+
+ @Override
+ public String getMachineType() {
+ return "Distillery, Distillation Tower";
+ }
+
+ @Override
+ public boolean checkRecipe(final ItemStack aStack) {
+ for (GT_MetaTileEntity_Hatch_InputBus tBus : mInputBusses) {
+ ArrayList<ItemStack> tBusItems = new ArrayList<ItemStack>();
+ tBus.mRecipeMap = getRecipeMap();
+ if (isValidMetaTileEntity(tBus)) {
+ for (int i = tBus.getBaseMetaTileEntity().getSizeInventory() - 1; i >= 0; i--) {
+ if (tBus.getBaseMetaTileEntity().getStackInSlot(i) != null)
+ tBusItems.add(tBus.getBaseMetaTileEntity().getStackInSlot(i));
+ }
+ }
+ ItemStack[] inputs = new ItemStack[tBusItems.size()];
+ int slot = 0;
+ for (ItemStack g : tBusItems) {
+ inputs[slot++] = g;
+ }
+ if (inputs.length > 0) {
+ int para = (4* GT_Utility.getTier(this.getMaxInputVoltage()));
+ log("Recipe. ["+inputs.length+"]["+para+"]");
+ if (checkRecipeGeneric(inputs, new FluidStack[]{}, para, 100, 250, 10000)) {
+ log("Recipe 2.");
+ return true;
+ }
+ }
+
+ }
+ return false;
+ }
+
+ @Override
+ public int getMaxParallelRecipes() {
+ if (this.mMode == 0) {
+ return getTierOfTower() == 1 ? 4 : getTierOfTower() == 2 ? 12 : 0;
+ }
+ else if (this.mMode == 1) {
+ return getTierOfTower() * (4 * GT_Utility.getTier(this.getMaxInputVoltage()));
+ }
+ return 0;
+ }
+
+ @Override
+ public int getEuDiscountForParallelism() {
+ return 15;
+ }
+
+ @Override
+ public boolean checkMultiblock(IGregTechTileEntity aBaseMetaTileEntity, ItemStack aStack) {
+ int aTier = getTierOfTower();
+ if (aTier > 0) {
+ if (aTier == 1) {
+ return checkTierOneTower(aBaseMetaTileEntity, aStack);
+ }
+ else if (aTier == 2) {
+ return checkTierTwoTower(aBaseMetaTileEntity, aStack);
+ }
+ }
+ return false;
+ }
+
+ private int getTierOfTower() {
+ return 1;
+ }
+
+ private boolean checkTierOneTower(IGregTechTileEntity aBaseMetaTileEntity, ItemStack aStack) {
+ mControllerY = aBaseMetaTileEntity.getYCoord();
+ int xDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetX;
+ int zDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetZ;
+ int y = 0; //height
+ int casingAmount = 0;
+ boolean reachedTop = false;
+
+ for (int x = xDir - 1; x <= xDir + 1; x++) { //x=width
+ for (int z = zDir - 1; z <= zDir + 1; z++) { //z=depth
+ if (x != 0 || z != 0) {
+ IGregTechTileEntity tileEntity = aBaseMetaTileEntity.getIGregTechTileEntityOffset(x, y, z);
+ Block block = aBaseMetaTileEntity.getBlockOffset(x, y, z);
+ if (!addInputToMachineList(tileEntity, CASING_INDEX)
+ && !addOutputToMachineList(tileEntity, CASING_INDEX)
+ && !addMaintenanceToMachineList(tileEntity, CASING_INDEX)
+ && !addEnergyInputToMachineList(tileEntity, CASING_INDEX)) {
+ if (block == GregTech_API.sBlockCasings4 && aBaseMetaTileEntity.getMetaIDOffset(x, y, z) == 1) {
+ casingAmount++;
+ } else {
+ return false;
+ }
+ }
+ }
+ }
+ }
+ y++;
+
+ while (y < 12 && !reachedTop) {
+ for (int x = xDir - 1; x <= xDir + 1; x++) { //x=width
+ for (int z = zDir - 1; z <= zDir + 1; z++) { //z=depth
+ IGregTechTileEntity tileEntity = aBaseMetaTileEntity.getIGregTechTileEntityOffset(x, y, z);
+ Block block = aBaseMetaTileEntity.getBlockOffset(x, y, z);
+ if (aBaseMetaTileEntity.getAirOffset(x, y, z)) {
+ if (x != xDir || z != zDir) {
+ return false;
+ }
+ } else {
+ if (x == xDir && z == zDir) {
+ reachedTop = true;
+ }
+ if (!addOutputToMachineList(tileEntity, CASING_INDEX)
+ && !addMaintenanceToMachineList(tileEntity, CASING_INDEX)
+ && !addEnergyInputToMachineList(tileEntity, CASING_INDEX)) {
+ if (block == GregTech_API.sBlockCasings4 && aBaseMetaTileEntity.getMetaIDOffset(x, y, z) == 1) {
+ casingAmount++;
+ } else {
+ return false;
+ }
+ }
+ }
+ }
+ }
+ y++;
+ }
+ return casingAmount >= 7 * y - 5 && y >= 3 && y <= 12 && reachedTop;
+ }
+
+ private boolean checkTierTwoTower(IGregTechTileEntity aBaseMetaTileEntity, ItemStack aStack) {
+ mControllerY = aBaseMetaTileEntity.getYCoord();
+ int xDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetX;
+ int zDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetZ;
+ int y = 0; //height
+ int casingAmount = 0;
+ boolean reachedTop = false;
+
+ for (int x = xDir - 1; x <= xDir + 1; x++) { //x=width
+ for (int z = zDir - 1; z <= zDir + 1; z++) { //z=depth
+ if (x != 0 || z != 0) {
+ IGregTechTileEntity tileEntity = aBaseMetaTileEntity.getIGregTechTileEntityOffset(x, y, z);
+ Block block = aBaseMetaTileEntity.getBlockOffset(x, y, z);
+ if (!addInputToMachineList(tileEntity, CASING_INDEX)
+ && !addOutputToMachineList(tileEntity, CASING_INDEX)
+ && !addMaintenanceToMachineList(tileEntity, CASING_INDEX)
+ && !addEnergyInputToMachineList(tileEntity, CASING_INDEX)) {
+ if (block == GregTech_API.sBlockCasings4 && aBaseMetaTileEntity.getMetaIDOffset(x, y, z) == 1) {
+ casingAmount++;
+ } else {
+ return false;
+ }
+ }
+ }
+ }
+ }
+ y++;
+
+ while (y < 12 && !reachedTop) {
+ for (int x = xDir - 1; x <= xDir + 1; x++) { //x=width
+ for (int z = zDir - 1; z <= zDir + 1; z++) { //z=depth
+ IGregTechTileEntity tileEntity = aBaseMetaTileEntity.getIGregTechTileEntityOffset(x, y, z);
+ Block block = aBaseMetaTileEntity.getBlockOffset(x, y, z);
+ if (aBaseMetaTileEntity.getAirOffset(x, y, z)) {
+ if (x != xDir || z != zDir) {
+ return false;
+ }
+ } else {
+ if (x == xDir && z == zDir) {
+ reachedTop = true;
+ }
+ if (!addOutputToMachineList(tileEntity, CASING_INDEX)
+ && !addMaintenanceToMachineList(tileEntity, CASING_INDEX)
+ && !addEnergyInputToMachineList(tileEntity, CASING_INDEX)) {
+ if (block == GregTech_API.sBlockCasings4 && aBaseMetaTileEntity.getMetaIDOffset(x, y, z) == 1) {
+ casingAmount++;
+ } else {
+ return false;
+ }
+ }
+ }
+ }
+ }
+ y++;
+ }
+ return casingAmount >= 7 * y - 5 && y >= 3 && y <= 12 && reachedTop;
+ }
+
+} \ No newline at end of file
diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntity_LargeRocketEngine.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntity_LargeRocketEngine.java
index bc36cb32a1..8e3e40b3ab 100644
--- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntity_LargeRocketEngine.java
+++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntity_LargeRocketEngine.java
@@ -40,6 +40,7 @@ public class GregtechMetaTileEntity_LargeRocketEngine extends GregtechMeta_Multi
protected int fuelValue;
protected int fuelRemaining;
protected int freeFuelTicks = 0;
+ protected int euProduction = 0;
protected boolean boostEu;
public static String mLubricantName = "Carbon Dioxide";
@@ -86,12 +87,13 @@ public class GregtechMetaTileEntity_LargeRocketEngine extends GregtechMeta_Multi
mCoolantName = FluidUtils.getFluidStack("liquidhydrogen", 1).getLocalizedName();
}
return new String[] {
- "Controller Block for the Large Combustion Engine",
- "Supply Rocket Fuels and 1000L of "+mLubricantName+" per hour to run",
- "Supply 40L of "+mCoolantName+" per second to boost output (optional)",
- "Consumes upto 5000L of Air per second",
- "Default: Produces "+GT_Values.V[5]+"EU/t at 100% efficiency",
- "Boosted: Produces "+(GT_Values.V[5]*3)+"EU/t at 150% efficiency",
+ "Controller Block for the Large Rocket Engine",
+ "Supply Rocket Fuels and 1000L(3000L boosted) of "+mLubricantName+" per hour to run",
+ "Supply 4L of "+mCoolantName+" per second per 2100 eu/t to boost output (optional)",
+ "Consumes upto 37500L of Air per second",
+ "Produces between 4K and 32K eu/t depending on how much fuel is fed",
+ "When producing more then 16K eu/t fuel wil be consume less efficiently (3x - 1.5x eff)",
+ "Boosting will produce 3x the amount of power but will consume 3x fuel",
"Size(WxHxD): 3x3x10, Controller (front centered)",
"3x3x10 of Stable "+mCasingName+" (hollow, Min 64!)",
"8x "+mGearboxName+" inside the Hollow Casing",
@@ -122,15 +124,20 @@ public class GregtechMetaTileEntity_LargeRocketEngine extends GregtechMeta_Multi
}
public int getAir() {
+ log("geting air in ");
if (this.mAirIntakes.isEmpty() || this.mAirIntakes.size() <= 0) {
+ log("return air 0");
return 0;
}
else {
int totalAir = 0;
FluidStack airstack = FluidUtils.getFluidStack("air", 1);
for (GT_MetaTileEntity_Hatch_AirIntake u : this.mAirIntakes) {
- if (u != null) {
+ if (u != null && u.mFluid != null) {
+ log(" to fluid stack");
+ // had this trow errors cousing the machine to stop probebly fixed
FluidStack f = u.mFluid;
+ log("fluid stack made");
if (f.isFluidEqual(airstack)) {
totalAir += f.amount;
}
@@ -142,66 +149,100 @@ public class GregtechMetaTileEntity_LargeRocketEngine extends GregtechMeta_Multi
@Override
public boolean checkRecipe(final ItemStack aStack) {
+ if (this.mEfficiency < 0)
+ log(" geting air");
final ArrayList<FluidStack> tFluids = this.getStoredFluids();
FluidStack air = FluidUtils.getFluidStack("air", 1);
+ log(" geting air 2");
int aircount = getAir() ;
- if (aircount < (boostEu ? 500 : 200)) {
- //Logger.INFO("Not Enough Air to Run "+aircount);
+ if (aircount < euProduction/32) {
+ log(" not enough air");
+ //log("Not Enough Air to Run "+aircount);
return false;
}
- else {
- boolean hasIntakeAir = this.depleteInput(FluidUtils.getFluidStack(air, boostEu ? 500 : 200));
+ else {
+ log(" no boost");
+ boolean hasIntakeAir = this.depleteInput(FluidUtils.getFluidStack(air, euProduction/32));
if (!hasIntakeAir) {
- //Logger.INFO("Could not consume Air to run "+aircount);
+ //log("Could not consume Air to run "+aircount);
+ freeFuelTicks = 0;
return false;
}
}
- //Logger.INFO("Running "+aircount);
-
+ // reste fuel ticks incase it does not reset when it stops
+ if (freeFuelTicks != 0 && this.mProgresstime == 0 && this.mEfficiency == 0)
+ freeFuelTicks = 0;
+
+ //log("Running "+aircount);
+ log("looking at hatch");
final Collection<GT_Recipe> tRecipeList = Recipe_GT.Gregtech_Recipe_Map.sRocketFuels.mRecipeList;
+
+
if (tFluids.size() > 0 && tRecipeList != null) {
+ log("has fluid");
+
+ if (tFluids.contains(MISC_MATERIALS.CARBON_DIOXIDE.getFluid(this.boostEu ? 3 : 1)) || tFluids.contains(FluidUtils.getFluidStack("carbondioxide", (this.boostEu ? 3 : 1)))) {
+ log("Found CO2");
+ if (this.mRuntime % 72 == 0 || this.mRuntime == 0) {
+ if (!consumeCO2()) {
+ freeFuelTicks = 0;
+ return false;
+ }
+ }
+ } else
+ {
+ log("no CO found");
+ freeFuelTicks = 0;
+ return false;
+ }
+
+ if (freeFuelTicks == 0)
+ this.boostEu = consumeLOH();
+ log("Did we consume LOH? "+boostEu);
+
for (final FluidStack hatchFluid1 : tFluids) {
if (hatchFluid1.isFluidEqual(air)) {
continue;
- }
- for (final GT_Recipe aFuel : tRecipeList) {
- final FluidStack tLiquid;
- tLiquid = aFuel.mFluidInputs[0];
- if (hatchFluid1.isFluidEqual(tLiquid)) {
-
- final int n = (int) (this.boostEu ? ((GT_Values.V[5]*2) / aFuel.mSpecialValue) : (GT_Values.V[5] / aFuel.mSpecialValue));
-
- if (!consumeFuel(aFuel)) {
- continue;
- }
-
- //Logger.INFO("Consumed some input fuel");
- this.boostEu = consumeLOH();
- //Logger.INFO("Did we consume LOH? "+boostEu);
-
- if (tFluids.contains(MISC_MATERIALS.CARBON_DIOXIDE.getFluid(this.boostEu ? 2 : 1)) || tFluids.contains(FluidUtils.getFluidStack("carbondioxide", (this.boostEu ? 2 : 1)))) {
- //Logger.INFO("Found CO2");
- if (this.mRuntime % 72 == 0 || this.mRuntime == 0) {
- if (!consumeCO2()) {
- return false;
- }
- }
+ }
+
+ if (freeFuelTicks == 0) {
+ log("tick = 0 consuming fuel");
+ for (final GT_Recipe aFuel : tRecipeList) {
+ final FluidStack tLiquid;
+ tLiquid = aFuel.mFluidInputs[0];
+ if (hatchFluid1.isFluidEqual(tLiquid)) {
+ log("consume fuel amount" + hatchFluid1.amount);
+ if (!consumeFuel(aFuel,hatchFluid1.amount)) {
+ continue;
+ }
this.fuelValue = aFuel.mSpecialValue;
this.fuelRemaining = hatchFluid1.amount;
- this.mEUt = (int) ((this.mEfficiency < 2000) ? 0 : GT_Values.V[5]);
+ this.mEUt = (int) ((this.mEfficiency < 2000) ? 0 : GT_Values.V[5]<<1);
this.mProgresstime = 1;
this.mMaxProgresstime = 1;
- this.mEfficiencyIncrease = 5;
+ this.mEfficiencyIncrease = euProduction/4000;
return true;
+ //log("");
}
- return false;
}
+
+ } else
+ {
+ this.mEfficiencyIncrease = euProduction/4000;
+ freeFuelTicks--;
+ this.mEUt = (int) ((this.mEfficiency < 1000) ? 0 : GT_Values.V[5]<<1);
+ this.mProgresstime = 1;
+ this.mMaxProgresstime = 1;
+ return true;
}
+
}
}
this.mEUt = 0;
this.mEfficiency = 0;
+ log("no fuel found");
+ freeFuelTicks = 0;
return false;
}
@@ -210,34 +251,50 @@ public class GregtechMetaTileEntity_LargeRocketEngine extends GregtechMeta_Multi
* @param aFuel
* @return
*/
- public boolean consumeFuel(GT_Recipe aFuel) {
- if (freeFuelTicks > 0) {
- freeFuelTicks--;
- return true;
- }
- else {
- Logger.INFO("Consuming fuel.");
+ public boolean consumeFuel(GT_Recipe aFuel,int amount) {
+ amount *= this.boostEu ? 0.3 : 0.9;
+ log("Consuming fuel.");
freeFuelTicks = 0;
- int value = aFuel.mSpecialValue * 3000;
- Logger.INFO("Value: "+value);
- value /= GT_Values.V[4];
- value /= 10;
- Logger.INFO("Value: "+value);
- FluidStack tLiquid = FluidUtils.getFluidStack(aFuel.mFluidInputs[0], value);
+ int value = aFuel.mSpecialValue * 3;
+ log("amount: "+amount);
+ log("Value: "+value);
+ int energy = value * amount;
+ //engine needs at leas 2A EV of fuel to waork
+ if (energy < 40000){
+ log("not enough fuel to work");
+ return false;
+ }
+ //limits engine to LuV fuel consumption
+ if (energy > 427500){
+ amount = (int) ((double) 427500/value);
+ energy = 427500;
+ }
+ log("amount2: "+amount);
+ FluidStack tLiquid = FluidUtils.getFluidStack(aFuel.mFluidInputs[0], (this.boostEu ? amount * 3 : amount));
if (!this.depleteInput(tLiquid)) {
+ log("could not deplete fluid");
return false;
}
else {
- this.fuelConsumption = value;
- this.freeFuelTicks = value*2;
- Logger.INFO("Consumed "+value+"L. Waiting "+freeFuelTicks+" ticks to consume more.");
+ this.fuelConsumption = this.boostEu ? amount * 3 : amount;
+ this.freeFuelTicks = 20;
+ setEUProduction(energy);
+ log("Consumed "+amount+"L. Waiting "+freeFuelTicks+" ticks to consume more.");
return true;
}
- }
+ }
+
+ public void setEUProduction(int energy){
+ energy /= 20;
+ // 3x eff unles it gose above 16K eu/t
+ double energyEfficiency = energy > 5500 ? ((double) Math.sqrt(5500)/Math.sqrt(energy) * energy) : energy;
+ euProduction = (int) ((double) energyEfficiency * 1.84);
+ if (this.boostEu)
+ euProduction *= 3;
}
public boolean consumeCO2() {
- if (this.depleteInput(MISC_MATERIALS.CARBON_DIOXIDE.getFluid(this.boostEu ? 2 : 1)) || this.depleteInput(FluidUtils.getFluidStack("carbondioxide", (this.boostEu ? 2 : 1)))) {
+ if (this.depleteInput(MISC_MATERIALS.CARBON_DIOXIDE.getFluid(this.boostEu ? 3 : 1)) || this.depleteInput(FluidUtils.getFluidStack("carbondioxide", (this.boostEu ? 3 : 1)))) {
return true;
}
else {
@@ -246,7 +303,8 @@ public class GregtechMetaTileEntity_LargeRocketEngine extends GregtechMeta_Multi
}
public boolean consumeLOH() {
- return this.depleteInput(FluidUtils.getFluidStack(RocketFuels.Liquid_Hydrogen, 2));
+ int LOHamount = (3 * euProduction)/1000;
+ return this.depleteInput(FluidUtils.getFluidStack(RocketFuels.Liquid_Hydrogen, LOHamount)); //(40 * ((long) euProduction / 10000))
}
@Override
@@ -258,15 +316,15 @@ public class GregtechMetaTileEntity_LargeRocketEngine extends GregtechMeta_Multi
final int MAX_LENGTH = 8;
for (int length=0;length<MAX_LENGTH;length++) {
if(getBaseMetaTileEntity().getBlockAtSideAndDistance(tSide, length+1) != getGearboxBlock()) {
- Logger.INFO("Bad Gearbox Block");
+ log("Bad Gearbox Block");
return false;
}
if(getBaseMetaTileEntity().getMetaIDAtSideAndDistance(tSide, length+1) != getGearboxMeta()) {
- Logger.INFO("Bad Gearbox Meta");
+ log("Bad Gearbox Meta");
return false;
}
}
- Logger.INFO("Found "+MAX_LENGTH+" "+mGearboxName+"s.");
+ log("Found "+MAX_LENGTH+" "+mGearboxName+"s.");
for (byte i = -1; i < 2; i = (byte) (i + 1)) {
for (byte j = -1; j < 2; j = (byte) (j + 1)) {
if ((i != 0) || (j != 0)) {
@@ -284,12 +342,12 @@ public class GregtechMetaTileEntity_LargeRocketEngine extends GregtechMeta_Multi
//final Block frontAir = getBaseMetaTileEntity().getBlock(fX, aY, fZ);
//final String frontAirName = frontAir.getUnlocalizedName();
//if(!(getBaseMetaTileEntity().getAir(fX, aY, fZ) || frontAirName.equalsIgnoreCase("tile.air") || frontAirName.equalsIgnoreCase("tile.railcraft.residual.heat"))) {
- //Logger.INFO("Bad Air Check");
+ //log("Bad Air Check");
//return false; //Fail if vent blocks are obstructed
//}
if (((i == 0) || (j == 0)) && ((aLength > 0) && (aLength <= MAX_LENGTH))) {
- Logger.INFO("Checking for Hatches. "+aLength);
+ log("Checking for Hatches. "+aLength);
//Top Row
if (j == 1) {
if (addDynamoToMachineList(getBaseMetaTileEntity().getIGregTechTileEntity(aX, aY, aZ), getCasingTextureIndex())) {
@@ -302,7 +360,7 @@ public class GregtechMetaTileEntity_LargeRocketEngine extends GregtechMeta_Multi
// Do nothing
}
else {
- Logger.INFO("Top Row - "+aLength+" | Did not find casing or Dynamo");
+ log("Top Row - "+aLength+" | Did not find casing or Dynamo");
return false;
}
}
@@ -312,7 +370,7 @@ public class GregtechMetaTileEntity_LargeRocketEngine extends GregtechMeta_Multi
final IMetaTileEntity bCheck = aCheck.getMetaTileEntity();
// Only allow Dynamos on Top
if (bCheck instanceof GT_MetaTileEntity_Hatch_Dynamo) {
- Logger.INFO("Found dynamo in disallowed location | "+aX+", "+aY+", "+aZ+" | "+i+", "+j+", "+aLength);
+ log("Found dynamo in disallowed location | "+aX+", "+aY+", "+aZ+" | "+i+", "+j+", "+aLength);
return false;
}
}
@@ -328,30 +386,30 @@ public class GregtechMetaTileEntity_LargeRocketEngine extends GregtechMeta_Multi
else if (getBaseMetaTileEntity().getBlock(aX, aY, aZ) == getCasingBlock() && getBaseMetaTileEntity().getMetaID(aX, aY, aZ) == getCasingMeta()) {
// Do nothing
}
- else {Logger.INFO("Bad block.");
+ else {log("Bad block.");
return false;
}
}
- Logger.INFO("Passed check. "+aLength);
+ log("Passed check. "+aLength);
} else if (aLength == 0) {
- Logger.INFO("Searching for Gearbox");
+ log("Searching for Gearbox");
if (addMaintenanceToMachineList(getBaseMetaTileEntity().getIGregTechTileEntity(aX, aY, aZ), getCasingTextureIndex())) {
// Do Nothing
}
else if(!(getBaseMetaTileEntity().getBlock(aX, aY, aZ) == getCasingBlock() && getBaseMetaTileEntity().getMetaID(aX, aY, aZ) == getCasingMeta())) {
- Logger.INFO("Bad Missing Casing || Bad Meta");
+ log("Bad Missing Casing || Bad Meta");
return false;
}
else {
- Logger.INFO("Found "+mCasingName+".");
+ log("Found "+mCasingName+".");
}
} else if (getBaseMetaTileEntity().getBlock(aX, aY, aZ) == getCasingBlock() && getBaseMetaTileEntity().getMetaID(aX, aY, aZ) == getCasingMeta()) {
- Logger.INFO("Found Casing.");
+ log("Found Casing.");
// Do nothing
} else {
- Logger.INFO("Bad XXX");
+ log("Bad XXX");
return false;
}
}
@@ -369,24 +427,24 @@ public class GregtechMetaTileEntity_LargeRocketEngine extends GregtechMeta_Multi
}
if (this.mDynamoHatches.size() <= 0 || this.mDynamoHatches.isEmpty()) {
- Logger.INFO("Wrong count for Dynamos");
+ log("Wrong count for Dynamos");
return false;
}
if (this.mMufflerHatches.size() != 1 || this.mMufflerHatches.isEmpty()) {
- Logger.INFO("Wrong count for Mufflers");
+ log("Wrong count for Mufflers");
return false;
}
if (this.mAirIntakes.size() < 8 || this.mAirIntakes.isEmpty()) {
- Logger.INFO("Wrong count for Air Intakes | "+this.mAirIntakes.size());
+ log("Wrong count for Air Intakes | "+this.mAirIntakes.size());
return false;
}
if (this.mMaintenanceHatches.size() < 1 || this.mMaintenanceHatches.isEmpty()) {
- Logger.INFO("Wrong count for Maint. Hatches");
+ log("Wrong count for Maint. Hatches");
return false;
}
- Logger.INFO("Formed Rocket Engine.");
+ log("Formed Rocket Engine.");
return true;
}
@@ -426,6 +484,7 @@ public class GregtechMetaTileEntity_LargeRocketEngine extends GregtechMeta_Multi
@Override
public void saveNBTData(final NBTTagCompound aNBT) {
aNBT.setInteger("freeFuelTicks", freeFuelTicks);
+ aNBT.setInteger("euProduction", euProduction);
super.saveNBTData(aNBT);
}
@@ -433,6 +492,7 @@ public class GregtechMetaTileEntity_LargeRocketEngine extends GregtechMeta_Multi
public void loadNBTData(final NBTTagCompound aNBT) {
super.loadNBTData(aNBT);
freeFuelTicks = aNBT.getInteger("freeFuelTicks");
+ euProduction = aNBT.getInteger("euProduction");
}
@Override
@@ -442,12 +502,12 @@ public class GregtechMetaTileEntity_LargeRocketEngine extends GregtechMeta_Multi
@Override
public int getMaxEfficiency(final ItemStack aStack) {
- return this.boostEu ? 30000 : 10000;
+ return euProduction;
}
@Override
public int getPollutionPerTick(final ItemStack aStack) {
- return this.boostEu ? 150 : 75;
+ return 75 * ( euProduction / 10000);
}
@Override
@@ -463,8 +523,8 @@ public class GregtechMetaTileEntity_LargeRocketEngine extends GregtechMeta_Multi
"Current Pollution: " + getPollutionPerTick(null),
"Time until next fuel consumption: "+freeFuelTicks,
"Current Output: " + this.mEUt * this.mEfficiency / 10000 + " EU/t",
- "Fuel Consumption: " + this.fuelConsumption + "L/t",
- "Fuel Value: " + this.fuelValue + " EU/L",
+ "Fuel Consumption: " + (this.fuelConsumption) + "L/s",
+ "Fuel Value: " + this.fuelValue*3 + " EU/L",
"Fuel Remaining: " + this.fuelRemaining + " Litres",
"Current Efficiency: " + this.mEfficiency / 100 + "%",
(this.getIdealStatus() == this.getRepairStatus()) ? "No Maintainance issues" : "Needs Maintainance" };
diff --git a/src/Java/gtPlusPlus/xmod/gregtech/co