diff options
Diffstat (limited to 'src')
4 files changed, 319 insertions, 13 deletions
diff --git a/src/Java/gregtech/api/util/SemiFluidFuelHandler.java b/src/Java/gregtech/api/util/SemiFluidFuelHandler.java index 1414b3beb3..c5b1065831 100644 --- a/src/Java/gregtech/api/util/SemiFluidFuelHandler.java +++ b/src/Java/gregtech/api/util/SemiFluidFuelHandler.java @@ -58,6 +58,7 @@ public class SemiFluidFuelHandler { public static boolean generateFuels() { final FluidStack aCreosote = FluidUtils.getFluidStack("creosote", 1000); final FluidStack aHeavyFuel = FluidUtils.getFluidStack("liquid_heavy_fuel", 1000); + final FluidStack aHeavyOil = FluidUtils.getFluidStack("liquid_heavy_oil", 1000); final HashMap<Integer, Pair<FluidStack, Integer>> aFoundFluidsFromItems = new HashMap<Integer, Pair<FluidStack, Integer>>(); // Find Fluids From items for (final GT_Recipe r : gregtech.api.util.GT_Recipe.GT_Recipe_Map.sDenseLiquidFuels.mRecipeList) { @@ -80,7 +81,7 @@ public class SemiFluidFuelHandler { aContainsCreosote = true; } } - g.mSpecialValue *= aContainsCreosote ? 8 : 4; + g.mSpecialValue *= aContainsCreosote ? 6 : 3; Logger.INFO("Added " + g.mFluidInputs[0].getLocalizedName() + " to the Semi-Fluid Generator fuel map. Fuel Produces "+g.mSpecialValue+"EU per 1000L."); sSemiFluidLiquidFuels.add(g); } @@ -89,9 +90,9 @@ public class SemiFluidFuelHandler { if (p != null) { int aFuelValue = p.getValue(); if (p.getKey().isFluidEqual(aCreosote)) { - aFuelValue *= 8; + aFuelValue *= 6; } - else if (p.getKey().isFluidEqual(aHeavyFuel)){ + else if (p.getKey().isFluidEqual(aHeavyFuel) || p.getKey().isFluidEqual(aHeavyOil)){ aFuelValue *= 1.5; } else { diff --git a/src/Java/gtPlusPlus/core/item/chemistry/GenericChem.java b/src/Java/gtPlusPlus/core/item/chemistry/GenericChem.java index 422927dd7b..ec1d51b502 100644 --- a/src/Java/gtPlusPlus/core/item/chemistry/GenericChem.java +++ b/src/Java/gtPlusPlus/core/item/chemistry/GenericChem.java @@ -38,7 +38,7 @@ public class GenericChem extends ItemPackage { new MaterialStack[] { new MaterialStack(NONMATERIAL.PTFE, 75), new MaterialStack(NONMATERIAL.PLASTIC, 15), - new MaterialStack(ELEMENT.getInstance().NITROGEN, 5), + new MaterialStack(ELEMENT.getInstance().CARBON, 5), new MaterialStack(ELEMENT.getInstance().SODIUM, 5) });// Not a GT // Inherited diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/custom/power/GTPP_MTE_BasicLosslessGenerator.java b/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/custom/power/GTPP_MTE_BasicLosslessGenerator.java new file mode 100644 index 0000000000..e0fbade97c --- /dev/null +++ b/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/custom/power/GTPP_MTE_BasicLosslessGenerator.java @@ -0,0 +1,299 @@ +package gtPlusPlus.xmod.gregtech.api.metatileentity.custom.power; + +import gregtech.api.enums.GT_Values; +import gregtech.api.enums.Textures.BlockIcons; +import gregtech.api.interfaces.ITexture; +import gregtech.api.interfaces.tileentity.IGregTechTileEntity; +import gregtech.api.util.GT_Recipe; +import gregtech.api.util.GT_Utility; +import gregtech.api.util.GT_Recipe.GT_Recipe_Map; +import gregtech.common.GT_Pollution; +import java.util.Collection; +import java.util.Iterator; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.init.Blocks; +import net.minecraft.item.ItemStack; +import net.minecraftforge.fluids.FluidStack; + +public abstract class GTPP_MTE_BasicLosslessGenerator extends GTPP_MTE_BasicTank { + public GTPP_MTE_BasicLosslessGenerator(int aID, String aName, String aNameRegional, int aTier, String aDescription, + ITexture... aTextures) { + super(aID, aName, aNameRegional, aTier, 3, aDescription, aTextures); + } + + public GTPP_MTE_BasicLosslessGenerator(int aID, String aName, String aNameRegional, int aTier, + String[] aDescription, ITexture... aTextures) { + super(aID, aName, aNameRegional, aTier, 3, aDescription, aTextures); + } + + public GTPP_MTE_BasicLosslessGenerator(String aName, int aTier, String aDescription, ITexture[][][] aTextures) { + super(aName, aTier, 3, aDescription, aTextures); + } + + public GTPP_MTE_BasicLosslessGenerator(String aName, int aTier, String[] aDescription, ITexture[][][] aTextures) { + super(aName, aTier, 3, aDescription, aTextures); + } + + public ITexture[][][] getTextureSet(ITexture[] aTextures) { + ITexture[][][] rTextures = new ITexture[10][17][]; + + for (byte i = -1; i < 16; ++i) { + rTextures[0][i + 1] = this.getFront(i); + rTextures[1][i + 1] = this.getBack(i); + rTextures[2][i + 1] = this.getBottom(i); + rTextures[3][i + 1] = this.getTop(i); + rTextures[4][i + 1] = this.getSides(i); + rTextures[5][i + 1] = this.getFrontActive(i); + rTextures[6][i + 1] = this.getBackActive(i); + rTextures[7][i + 1] = this.getBottomActive(i); + rTextures[8][i + 1] = this.getTopActive(i); + rTextures[9][i + 1] = this.getSidesActive(i); + } + + return rTextures; + } + + public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, + boolean aActive, boolean aRedstone) { + return this.mTextures[(aActive ? 5 : 0) + (aSide == aFacing + ? 0 + : (aSide == GT_Utility.getOppositeSide(aFacing) + ? 1 + : (aSide == 0 ? 2 : (aSide == 1 ? 3 : 4))))][aColorIndex + 1]; + } + + public String[] getDescription() { + String[] desc = new String[this.mDescriptionArray.length + 1]; + System.arraycopy(this.mDescriptionArray, 0, desc, 0, this.mDescriptionArray.length); + desc[this.mDescriptionArray.length] = "Fuel Efficiency: " + this.getEfficiency() + "%"; + return desc; + } + + public boolean onRightclick(IGregTechTileEntity aBaseMetaTileEntity, EntityPlayer aPlayer) { + if (aBaseMetaTileEntity.isClientSide()) { + return true; + } else { + aBaseMetaTileEntity.openGUI(aPlayer); + return true; + } + } + + public ITexture[] getFront(byte aColor) { + return new ITexture[]{BlockIcons.MACHINE_CASINGS[this.mTier][aColor + 1]}; + } + + public ITexture[] getBack(byte aColor) { + return new ITexture[]{BlockIcons.MACHINE_CASINGS[this.mTier][aColor + 1]}; + } + + public ITexture[] getBottom(byte aColor) { + return new ITexture[]{BlockIcons.MACHINE_CASINGS[this.mTier][aColor + 1]}; + } + + public ITexture[] getTop(byte aColor) { + return new ITexture[]{BlockIcons.MACHINE_CASINGS[this.mTier][aColor + 1]}; + } + + public ITexture[] getSides(byte aColor) { + return new ITexture[]{BlockIcons.MACHINE_CASINGS[this.mTier][aColor + 1]}; + } + + public ITexture[] getFrontActive(byte aColor) { + return this.getFront(aColor); + } + + public ITexture[] getBackActive(byte aColor) { + return this.getBack(aColor); + } + + public ITexture[] getBottomActive(byte aColor) { + return this.getBottom(aColor); + } + + public ITexture[] getTopActive(byte aColor) { + return this.getTop(aColor); + } + + public ITexture[] getSidesActive(byte aColor) { + return this.getSides(aColor); + } + + public boolean isFacingValid(byte aSide) { + return aSide > 1; + } + + public boolean isSimpleMachine() { + return false; + } + + public boolean isValidSlot(int aIndex) { + return aIndex < 2; + } + + public boolean isEnetOutput() { + return true; + } + + public boolean isOutputFacing(byte aSide) { + return true; + } + + public boolean isAccessAllowed(EntityPlayer aPlayer) { + return true; + } + + public long maxEUOutput() { + return this.getBaseMetaTileEntity().isAllowedToWork() ? GT_Values.V[this.mTier] : 0L; + } + + public long maxEUStore() { + return Math.max(this.getEUVar(), GT_Values.V[this.mTier] * 40L + this.getMinimumStoredEU()); + } + + public boolean doesFillContainers() { + return this.getBaseMetaTileEntity().isAllowedToWork(); + } + + public boolean doesEmptyContainers() { + return this.getBaseMetaTileEntity().isAllowedToWork(); + } + + public boolean canTankBeFilled() { + return this.getBaseMetaTileEntity().isAllowedToWork(); + } + + public boolean canTankBeEmptied() { + return this.getBaseMetaTileEntity().isAllowedToWork(); + } + + public boolean displaysItemStack() { + return true; + } + + public boolean displaysStackSize() { + return false; + } + + public boolean isFluidInputAllowed(FluidStack aFluid) { + return this.getFuelValue(aFluid) > 0; + } + + public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long 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)) { + GT_Pollution.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); + GT_Pollution.addPollution(this.getBaseMetaTileEntity(), 10 * this.getPollution()); + } + } + } + } + + if (aBaseMetaTileEntity.isServerSide()) { + aBaseMetaTileEntity.setActive(aBaseMetaTileEntity.isAllowedToWork() && aBaseMetaTileEntity + .getUniversalEnergyStored() >= this.maxEUOutput() + this.getMinimumStoredEU()); + } + + } + + public abstract int getPollution(); + + public abstract GT_Recipe_Map getRecipes(); + + public abstract int getEfficiency(); + + public int consumedFluidPerOperation(FluidStack aLiquid) { + return 1; + } + + public int getFuelValue(FluidStack aLiquid) { + if (aLiquid != null && this.getRecipes() != null) { + Collection<GT_Recipe> tRecipeList = this.getRecipes().mRecipeList; + if (tRecipeList != null) { + Iterator var4 = tRecipeList.iterator(); + + while (var4.hasNext()) { + GT_Recipe tFuel = (GT_Recipe) var4.next(); + FluidStack tLiquid; + if ((tLiquid = GT_Utility.getFluidForFilledItem(tFuel.getRepresentativeInput(0), true)) != null + && aLiquid.isFluidEqual(tLiquid)) { + return (int) ((long) tFuel.mSpecialValue * (long) this.getEfficiency() + * (long) this.consumedFluidPerOperation(tLiquid) / 100L); + } + } + } + + return 0; + } else { + return 0; + } + } + + public int getFuelValue(ItemStack aStack) { + if (!GT_Utility.isStackInvalid(aStack) && this.getRecipes() != null) { + GT_Recipe tFuel = this.getRecipes().findRecipe(this.getBaseMetaTileEntity(), false, Long.MAX_VALUE, + (FluidStack[]) null, new ItemStack[]{aStack}); + return tFuel != null ? (int) ((long) tFuel.mSpecialValue * 1000L * (long) this.getEfficiency() / 100L) : 0; + } else { + return 0; + } + } + + public ItemStack getEmptyContainer(ItemStack aStack) { + if (!GT_Utility.isStackInvalid(aStack) && this.getRecipes() != null) { + GT_Recipe tFuel = this.getRecipes().findRecipe(this.getBaseMetaTileEntity(), false, Long.MAX_VALUE, + (FluidStack[]) null, new ItemStack[]{aStack}); + return tFuel != null + ? GT_Utility.copy(new Object[]{tFuel.getOutput(0)}) + : GT_Utility.getContainerItem(aStack, true); + } else { + return null; + } + } + + public boolean allowPutStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) { + return super.allowPutStack(aBaseMetaTileEntity, aIndex, aSide, aStack) && (this.getFuelValue(aStack) > 0 + || this.getFuelValue(GT_Utility.getFluidForFilledItem(aStack, true)) > 0); + } + + public int getCapacity() { + return 16000; + } + + public int getTankPressure() { + return -100; + } +}
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/generators/GT_MetaTileEntity_SemiFluidGenerator.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/generators/GT_MetaTileEntity_SemiFluidGenerator.java index 45a73f9e35..ef3e06086e 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/generators/GT_MetaTileEntity_SemiFluidGenerator.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/generators/GT_MetaTileEntity_SemiFluidGenerator.java @@ -18,9 +18,11 @@ import gregtech.api.util.GT_ModHandler; import gregtech.api.util.GT_Recipe; import gregtech.api.util.GT_Utility; import gregtech.api.util.Recipe_GT.Gregtech_Recipe_Map; +import gtPlusPlus.api.objects.Logger; import gtPlusPlus.core.lib.CORE; +import gtPlusPlus.xmod.gregtech.api.metatileentity.custom.power.GTPP_MTE_BasicLosslessGenerator; -public class GT_MetaTileEntity_SemiFluidGenerator extends GT_MetaTileEntity_BasicGenerator{ +public class GT_MetaTileEntity_SemiFluidGenerator extends GTPP_MTE_BasicLosslessGenerator{ public static final int BASE_POLLUTION = 2; public int mEfficiency; @@ -48,7 +50,7 @@ public class GT_MetaTileEntity_SemiFluidGenerator extends GT_MetaTileEntity_Basi @Override public int getCapacity() { - return 8000; + return 4000 * this.mTier; } public void onConfigLoad() { @@ -63,6 +65,7 @@ public class GT_MetaTileEntity_SemiFluidGenerator extends GT_MetaTileEntity_Basi @Override public GT_Recipe.GT_Recipe_Map getRecipes() { + //Logger.INFO("Fuel Count: "+Gregtech_Recipe_Map.sSemiFluidLiquidFuels.mRecipeList.size()); return Gregtech_Recipe_Map.sSemiFluidLiquidFuels; } @@ -91,12 +94,15 @@ public class GT_MetaTileEntity_SemiFluidGenerator extends GT_MetaTileEntity_Basi @Override public int getFuelValue(ItemStack aStack) { - if ((GT_Utility.isStackInvalid(aStack)) || (getRecipes() == null)) + if ((GT_Utility.isStackInvalid(aStack)) || (getRecipes() == null)) { + Logger.INFO("Bad Fuel?"); return 0; + } int rValue = Math.max(GT_ModHandler.getFuelCanValue(aStack) * 6 / 5, super.getFuelValue(aStack)); if (ItemList.Fuel_Can_Plastic_Filled.isStackEqual(aStack, false, true)) { rValue = Math.max(rValue, GameRegistry.getFuelValue(aStack) * 3); } + Logger.INFO("Good Fuel: "+rValue); return rValue; } @@ -110,7 +116,7 @@ public class GT_MetaTileEntity_SemiFluidGenerator extends GT_MetaTileEntity_Basi @Override public ITexture[] getBack(byte aColor) { return new ITexture[] { super.getBack(aColor)[0], - new GT_RenderedTexture(Textures.BlockIcons.DIESEL_GENERATOR_BACK) }; + new GT_RenderedTexture(Textures.BlockIcons.DIESEL_GENERATOR_TOP) }; } @Override @@ -122,13 +128,13 @@ public class GT_MetaTileEntity_SemiFluidGenerator extends GT_MetaTileEntity_Basi @Override public ITexture[] getTop(byte aColor) { return new ITexture[] { super.getTop(aColor)[0], - new GT_RenderedTexture(Textures.BlockIcons.DIESEL_GENERATOR_TOP) }; + new GT_RenderedTexture(Textures.BlockIcons.DIESEL_GENERATOR_SIDE) }; } @Override public ITexture[] getSides(byte aColor) { return new ITexture[] { super.getSides(aColor)[0], - new GT_RenderedTexture(Textures.BlockIcons.DIESEL_GENERATOR_SIDE) }; + new GT_RenderedTexture(Textures.BlockIcons.DIESEL_GENERATOR_TOP) }; } @Override @@ -141,7 +147,7 @@ public class GT_MetaTileEntity_SemiFluidGenerator extends GT_MetaTileEntity_Basi @Override public ITexture[] getBackActive(byte aColor) { return new ITexture[] { super.getBackActive(aColor)[0], - new GT_RenderedTexture(Textures.BlockIcons.DIESEL_GENERATOR_BACK_ACTIVE) }; + new GT_RenderedTexture(Textures.BlockIcons.DIESEL_GENERATOR_TOP_ACTIVE) }; } @Override @@ -153,13 +159,13 @@ public class GT_MetaTileEntity_SemiFluidGenerator extends GT_MetaTileEntity_Basi @Override public ITexture[] getTopActive(byte aColor) { return new ITexture[] { super.getTopActive(aColor)[0], - new GT_RenderedTexture(Textures.BlockIcons.DIESEL_GENERATOR_TOP_ACTIVE) }; + new GT_RenderedTexture(Textures.BlockIcons.DIESEL_GENERATOR_SIDE_ACTIVE) }; } @Override public ITexture[] getSidesActive(byte aColor) { return new ITexture[] { super.getSidesActive(aColor)[0], - new GT_RenderedTexture(Textures.BlockIcons.DIESEL_GENERATOR_SIDE_ACTIVE) }; + new GT_RenderedTexture(Textures.BlockIcons.DIESEL_GENERATOR_TOP_ACTIVE) }; } } |