aboutsummaryrefslogtreecommitdiff
path: root/src/Java/gtPlusPlus/xmod
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
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')
-rw-r--r--src/Java/gtPlusPlus/xmod/galacticraft/handler/HandlerTooltip_GC.java37
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/generators/GregtechRocketFuelGeneratorBase.java101
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/generators/GregtechMetaTileEntityRocketFuelGenerator.java8
3 files changed, 110 insertions, 36 deletions
diff --git a/src/Java/gtPlusPlus/xmod/galacticraft/handler/HandlerTooltip_GC.java b/src/Java/gtPlusPlus/xmod/galacticraft/handler/HandlerTooltip_GC.java
index 58331c4300..64f1cfbe23 100644
--- a/src/Java/gtPlusPlus/xmod/galacticraft/handler/HandlerTooltip_GC.java
+++ b/src/Java/gtPlusPlus/xmod/galacticraft/handler/HandlerTooltip_GC.java
@@ -1,6 +1,8 @@
package gtPlusPlus.xmod.galacticraft.handler;
import java.lang.reflect.Field;
+import java.util.HashMap;
+import java.util.LinkedHashMap;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
import net.minecraft.block.Block;
@@ -18,7 +20,7 @@ public class HandlerTooltip_GC {
private static Block mBlock;
private static Class<?> oMainClass;
private static Class<?> oFuelLoaderClass;
- private static String[] mFuelNames;
+ private static HashMap <Integer, String> mFuelNames;
@SubscribeEvent
public void onItemTooltip(ItemTooltipEvent event) {
@@ -30,8 +32,7 @@ public class HandlerTooltip_GC {
if (GCBlocks != null) {
oMainClass = GCBlocks;
- Class<?> GCFuelLoader = Class
- .forName("micdoodle8.mods.galacticraft.core.blocks.BlockFuelLoader");
+ Class<?> GCFuelLoader = ReflectionUtils.getClass("micdoodle8.mods.galacticraft.core.blocks.BlockFuelLoader");
if (GCFuelLoader != null) {
oFuelLoaderClass = GCFuelLoader;
@@ -49,24 +50,26 @@ public class HandlerTooltip_GC {
} catch (Throwable t) {
}
}
- if (mFuelNames == null || mFuelNames.length == 0) {
- mFuelNames = new String[RocketFuels.mValidRocketFuels.size()];
- int slot = 0;
- for (Fluid f : RocketFuels.mValidRocketFuels.values()) {
- mFuelNames[slot++] = f.getLocalizedName();
+
+ if (mFuelNames == null || mFuelNames.isEmpty()) {
+ mFuelNames = new LinkedHashMap<Integer, String>();
+ for (int aMapKey : RocketFuels.mValidRocketFuels.keySet()) {
+ Fluid aFuel = RocketFuels.mValidRocketFuels.get(aMapKey);
+ if (aFuel != null) {
+ mFuelNames.put(aMapKey, aFuel.getLocalizedName());
+ }
}
- }
- if (mItemBlock != null) {
+ }
+ if (mItemBlock != null && !mFuelNames.isEmpty()) {
Item aTempItem = event.itemStack.getItem();
Block aTempBlock = Block.getBlockFromItem(aTempItem);
- if (aTempItem == mItemBlock || oFuelLoaderClass.isInstance(aTempBlock)
- || event.itemStack.getUnlocalizedName().toLowerCase().contains("fuelloader")) {
- int aTier = 0;
- for (String s : mFuelNames) {
- if (s != null) {
- event.toolTip.add("Tier "+aTier+": "+s);
+ if (aTempItem == mItemBlock || oFuelLoaderClass.isInstance(aTempBlock) || event.itemStack.getUnlocalizedName().toLowerCase().contains("fuelloader")) {
+ for (int aMapKey : mFuelNames.keySet()) {
+ String aFuel = mFuelNames.get(aMapKey);
+ if (aFuel != null) {
+ event.toolTip.add("Tier "+(aMapKey+1)+": "+aFuel);
}
- }
+ }
}
}
}
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;
}
diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/generators/GregtechMetaTileEntityRocketFuelGenerator.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/generators/GregtechMetaTileEntityRocketFuelGenerator.java
index 288501086b..1d81e44e1f 100644
--- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/generators/GregtechMetaTileEntityRocketFuelGenerator.java
+++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/generators/GregtechMetaTileEntityRocketFuelGenerator.java
@@ -15,6 +15,7 @@ import gregtech.api.objects.GT_RenderedTexture;
import gregtech.api.util.GT_ModHandler;
import gregtech.api.util.GT_Recipe;
import gregtech.api.util.Recipe_GT;
+import gtPlusPlus.api.objects.Logger;
import gtPlusPlus.core.util.math.MathUtils;
import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base.generators.GregtechRocketFuelGeneratorBase;
import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock;
@@ -41,6 +42,7 @@ extends GregtechRocketFuelGeneratorBase {
@Override
public MetaTileEntity newMetaEntity(final IGregTechTileEntity aTileEntity) {
+ Logger.INFO("Valid Fuels: "+Recipe_GT.Gregtech_Recipe_Map.sRocketFuels.mRecipeList.size());
return new GregtechMetaTileEntityRocketFuelGenerator(this.mName, this.mTier, this.mDescription, this.mTextures);
}
@@ -60,7 +62,10 @@ extends GregtechRocketFuelGeneratorBase {
@Override
public int getEfficiency() {
- return ((40+((this.mTier) * 16))/4)+(this.mTier);
+ int eff = ((40+((this.mTier) * 16))/4)+(this.mTier);
+
+ return eff;
+
}
@Override
@@ -69,6 +74,7 @@ extends GregtechRocketFuelGeneratorBase {
if (ItemList.Fuel_Can_Plastic_Filled.isStackEqual(aStack, false, true)) {
rValue = Math.max(rValue, GameRegistry.getFuelValue(aStack) * 3);
}
+ Logger.INFO("Fuel Item is worth: "+rValue);
return rValue;
}