aboutsummaryrefslogtreecommitdiff
path: root/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations
diff options
context:
space:
mode:
authorAlkalus <3060479+draknyte1@users.noreply.github.com>2019-03-12 05:08:33 +0000
committerAlkalus <3060479+draknyte1@users.noreply.github.com>2019-03-12 05:08:33 +0000
commitdbe1827984f9dd1e87d500882c541181bdaeb542 (patch)
tree10f60a2559121185f97c73b4b37152424068c5a8 /src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations
parent6093c5e76fad9cb1ec8a44e7a638c0350f11e952 (diff)
downloadGT5-Unofficial-dbe1827984f9dd1e87d500882c541181bdaeb542.tar.gz
GT5-Unofficial-dbe1827984f9dd1e87d500882c541181bdaeb542.tar.bz2
GT5-Unofficial-dbe1827984f9dd1e87d500882c541181bdaeb542.zip
+ Added framework for additional Oil chemistry in future updates.
+ Added additional processes for obtaining Kerosene. % Mild rebalance to GT++ Rocket Fuels. % Swapped Coal by-products (Coal Tar, Coal Tar Oil and Sulfuric Coal Tar Oil) from Gas Turbine fuel to Semifluid fuel. % Allowed ItemPackages to register themselves to the onLoadComplete() event. $ Fixed GT++ Rocket Fuels being unusable in Rocket Engines. $ Fixed Tooltip on GC Fuel loader when the GC-ASM is not active.
Diffstat (limited to 'src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations')
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/generators/GregtechRocketFuelGeneratorBase.java101
1 files changed, 83 insertions, 18 deletions
diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/generators/GregtechRocketFuelGeneratorBase.java b/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/generators/GregtechRocketFuelGeneratorBase.java
index a88d6a4832..15c6fa00f6 100644
--- a/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/generators/GregtechRocketFuelGeneratorBase.java
+++ b/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/generators/GregtechRocketFuelGeneratorBase.java
@@ -15,8 +15,9 @@ import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_BasicTank;
import gregtech.api.util.GT_Recipe;
import gregtech.api.util.GT_Recipe.GT_Recipe_Map;
import gregtech.api.util.GT_Utility;
-
+import gtPlusPlus.api.objects.Logger;
import gtPlusPlus.core.lib.CORE;
+import gtPlusPlus.core.util.Utils;
import gtPlusPlus.core.util.minecraft.gregtech.PollutionUtils;
import net.minecraftforge.fluids.FluidStack;
@@ -144,7 +145,7 @@ public abstract class GregtechRocketFuelGeneratorBase extends GT_MetaTileEntity_
@Override
public boolean isOutputFacing(final byte aSide) {
- return true;
+ return this.getBaseMetaTileEntity().getFrontFacing() == aSide;
}
@Override
@@ -154,7 +155,7 @@ public abstract class GregtechRocketFuelGeneratorBase extends GT_MetaTileEntity_
@Override
public long maxEUOutput() {
- return this.getBaseMetaTileEntity().isAllowedToWork() ? V[this.mTier] : 0;
+ return V[this.mTier];
}
@Override
@@ -164,22 +165,22 @@ public abstract class GregtechRocketFuelGeneratorBase extends GT_MetaTileEntity_
@Override
public boolean doesFillContainers() {
- return this.getBaseMetaTileEntity().isAllowedToWork();
+ return false;
}
@Override
public boolean doesEmptyContainers() {
- return this.getBaseMetaTileEntity().isAllowedToWork();
+ return true;
}
@Override
public boolean canTankBeFilled() {
- return this.getBaseMetaTileEntity().isAllowedToWork();
+ return true;
}
@Override
public boolean canTankBeEmptied() {
- return this.getBaseMetaTileEntity().isAllowedToWork();
+ return false;
}
@Override
@@ -199,6 +200,61 @@ public abstract class GregtechRocketFuelGeneratorBase extends GT_MetaTileEntity_
@Override
public void onPostTick(final IGregTechTileEntity aBaseMetaTileEntity, final long aTick) {
+
+
+ //super.onPostTick(aBaseMetaTileEntity, aTick);
+
+ /*if (aBaseMetaTileEntity.isServerSide() && aBaseMetaTileEntity.isAllowedToWork() && aTick % 10L == 0L) {
+ int tFuelValue;
+ if (this.mFluid == null) {
+ if (aBaseMetaTileEntity.getUniversalEnergyStored() < this.maxEUOutput() + this.getMinimumStoredEU()) {
+ this.mInventory[this.getStackDisplaySlot()] = null;
+ } else {
+ if (this.mInventory[this.getStackDisplaySlot()] == null) {
+ this.mInventory[this.getStackDisplaySlot()] = new ItemStack(Blocks.fire, 1);
+ }
+
+ this.mInventory[this.getStackDisplaySlot()].setStackDisplayName("Generating: "
+ + (aBaseMetaTileEntity.getUniversalEnergyStored() - this.getMinimumStoredEU()) + " EU");
+ }
+ } else {
+ tFuelValue = this.getFuelValue(this.mFluid);
+ int tConsumed = this.consumedFluidPerOperation(this.mFluid);
+ if (tFuelValue > 0 && tConsumed > 0 && this.mFluid.amount > tConsumed) {
+ long tFluidAmountToUse = Math.min((long) (this.mFluid.amount / tConsumed),
+ (this.maxEUStore() - aBaseMetaTileEntity.getUniversalEnergyStored()) / (long) tFuelValue);
+ if (tFluidAmountToUse > 0L && aBaseMetaTileEntity
+ .increaseStoredEnergyUnits(tFluidAmountToUse * (long) tFuelValue, true)) {
+ PollutionUtils.addPollution(this.getBaseMetaTileEntity(), 10 * this.getPollution());
+ this.mFluid.amount = (int) ((long) this.mFluid.amount - tFluidAmountToUse * (long) tConsumed);
+ }
+ }
+ }
+
+ if (this.mInventory[this.getInputSlot()] != null
+ && aBaseMetaTileEntity.getUniversalEnergyStored() < this.maxEUOutput() * 20L
+ + this.getMinimumStoredEU()
+ && GT_Utility.getFluidForFilledItem(this.mInventory[this.getInputSlot()], true) == null) {
+ tFuelValue = this.getFuelValue(this.mInventory[this.getInputSlot()]);
+ if (tFuelValue > 0) {
+ ItemStack tEmptyContainer = this.getEmptyContainer(this.mInventory[this.getInputSlot()]);
+ if (aBaseMetaTileEntity.addStackToSlot(this.getOutputSlot(), tEmptyContainer)) {
+ aBaseMetaTileEntity.increaseStoredEnergyUnits((long) tFuelValue, true);
+ aBaseMetaTileEntity.decrStackSize(this.getInputSlot(), 1);
+ PollutionUtils.addPollution(this.getBaseMetaTileEntity(), 10 * this.getPollution());
+ }
+ }
+ }
+ }
+
+ if (aBaseMetaTileEntity.isServerSide()) {
+ aBaseMetaTileEntity.setActive(aBaseMetaTileEntity.isAllowedToWork() && aBaseMetaTileEntity
+ .getUniversalEnergyStored() >= this.maxEUOutput() + this.getMinimumStoredEU());
+ }*/
+
+
+
+
if (aBaseMetaTileEntity.isServerSide() && aBaseMetaTileEntity.isAllowedToWork() && ((aTick % 10) == 0)) {
if (this.mFluid == null) {
if (aBaseMetaTileEntity.getUniversalEnergyStored() < (this.maxEUOutput() + this.getMinimumStoredEU())) {
@@ -211,16 +267,14 @@ public abstract class GregtechRocketFuelGeneratorBase extends GT_MetaTileEntity_
}
} else {
final int tFuelValue = this.getFuelValue(this.mFluid), tConsumed = this.consumedFluidPerOperation(this.mFluid);
- if ((tFuelValue > 0) && (tConsumed > 0) && (this.mFluid.amount > tConsumed)) {
+ if ((tFuelValue > 0) && (tConsumed > 0) && (this.mFluid.amount >= tConsumed)) {
final long tFluidAmountToUse = Math.min(this.mFluid.amount / tConsumed, (((this.maxEUOutput() * 20) + this.getMinimumStoredEU()) - aBaseMetaTileEntity.getUniversalEnergyStored()) / tFuelValue);
- if ((tFluidAmountToUse > 0) && aBaseMetaTileEntity.increaseStoredEnergyUnits(tFluidAmountToUse * tFuelValue, true)){
- if (this.useFuel){
- this.mFluid.amount -= tFluidAmountToUse * tConsumed;
- this.useFuel = false;
- }
- else {
- this.useFuel = true;
- }
+ if ((tFluidAmountToUse > 0) && aBaseMetaTileEntity.increaseStoredEnergyUnits(tFluidAmountToUse * tFuelValue, true)){
+ useFuel = Utils.invertBoolean(useFuel);
+ int aSafeFloor= (int) Math.max(((tFluidAmountToUse * tConsumed)/3), 1);
+ int toConsumeTrue = (int) (useFuel ? aSafeFloor : 0);
+ //Logger.INFO("True consumption: "+toConsumeTrue+" | Consuming this tick? "+useFuel);
+ this.mFluid.amount -= toConsumeTrue;
PollutionUtils.addPollution(getBaseMetaTileEntity(), 10 * getPollution());
}
}
@@ -260,14 +314,25 @@ public abstract class GregtechRocketFuelGeneratorBase extends GT_MetaTileEntity_
FluidStack tLiquid;
final Collection<GT_Recipe> tRecipeList = this.getRecipes().mRecipeList;
if (tRecipeList != null) {
+ //Logger.INFO("Step A");
for (final GT_Recipe tFuel : tRecipeList) {
- if ((tLiquid = GT_Utility.getFluidForFilledItem(tFuel.getRepresentativeInput(0), true)) != null) {
+ //Logger.INFO("Step B");
+ if ((tLiquid = tFuel.mFluidInputs[0]) != null) {
+ //Logger.INFO("Step C");
if (aLiquid.isFluidEqual(tLiquid)) {
- return (int) (((long) tFuel.mSpecialValue * this.getEfficiency() * this.consumedFluidPerOperation(tLiquid)) / 100);
+ //Logger.INFO("Found some fuel?");
+ int aperOp = this.consumedFluidPerOperation(tLiquid);
+ int aConsume = (int) (((long) tFuel.mSpecialValue * this.getEfficiency() * aperOp) / 100);
+ //Logger.INFO("Fuel Value: "+tFuel.mSpecialValue);
+ //Logger.INFO("Efficiency: "+getEfficiency());
+ //Logger.INFO("Consumed per op: "+aperOp);
+ //Logger.INFO("Consuming "+aConsume);
+ return aConsume;
}
}
}
}
+ //Logger.INFO("No Fuel Value | Valid? "+(aLiquid != null));
return 0;
}