aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_LargeTurbine_Diesel.java128
-rw-r--r--src/main/java/gregtech/loaders/preload/GT_Loader_MetaTileEntities.java2
2 files changed, 130 insertions, 0 deletions
diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_LargeTurbine_Diesel.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_LargeTurbine_Diesel.java
new file mode 100644
index 0000000000..ddd11bb338
--- /dev/null
+++ b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_LargeTurbine_Diesel.java
@@ -0,0 +1,128 @@
+package gregtech.common.tileentities.machines.multi;
+
+import gregtech.api.GregTech_API;
+import gregtech.api.enums.Textures;
+import gregtech.api.interfaces.ITexture;
+import gregtech.api.interfaces.metatileentity.IMetaTileEntity;
+import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
+import gregtech.api.objects.GT_RenderedTexture;
+import gregtech.api.util.GT_Recipe;
+import gregtech.api.util.GT_Recipe.GT_Recipe_Map;
+import gregtech.api.util.GT_Utility;
+import net.minecraft.block.Block;
+import net.minecraft.item.ItemStack;
+import net.minecraftforge.fluids.FluidStack;
+
+import java.util.ArrayList;
+import java.util.Collection;
+
+public class GT_MetaTileEntity_LargeTurbine_Diesel extends GT_MetaTileEntity_LargeTurbine {
+
+ public GT_MetaTileEntity_LargeTurbine_Diesel(int aID, String aName, String aNameRegional) {
+ super(aID, aName, aNameRegional);
+ }
+
+ public GT_MetaTileEntity_LargeTurbine_Diesel(String aName) {
+ super(aName);
+ }
+
+ @Override
+ public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) {
+ return new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[1][aColorIndex + 1], aFacing == aSide ? aActive ? new GT_RenderedTexture(Textures.BlockIcons.LARGETURBINE_ACTIVE5) : new GT_RenderedTexture(Textures.BlockIcons.LARGETURBINE5) : Textures.BlockIcons.CASING_BLOCKS[57]};
+ }
+
+
+ public String[] getDescription() {
+ return new String[]{
+ "Controller Block for the Large Diesel Generator",
+ "Size: 3x4x3 (Hollow)", "Controller (front centered)",
+ "1x Input Hatch (side centered)",
+ "1x Dynamo Hatch (back centered)",
+ "1x Maintenance Hatch (side centered)",
+ "Turbine Casings for the rest (24 at least!)",
+ "Needs a Turbine Item (inside controller GUI)"};
+ }
+
+ public int getFuelValue(FluidStack aLiquid) {
+ if (aLiquid == null || GT_Recipe_Map.sTurbineFuels == null) return 0;
+ FluidStack tLiquid;
+ Collection<GT_Recipe> tRecipeList = GT_Recipe_Map.sDieselFuels.mRecipeList;
+ if (tRecipeList != null) for (GT_Recipe tFuel : tRecipeList)
+ if ((tLiquid = GT_Utility.getFluidForFilledItem(tFuel.getRepresentativeInput(0), true)) != null)
+ if (aLiquid.isFluidEqual(tLiquid)) return tFuel.mSpecialValue;
+ return 0;
+ }
+
+ @Override
+ public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) {
+ return new GT_MetaTileEntity_LargeTurbine_Plasma(mName);
+ }
+
+ @Override
+ public Block getCasingBlock() {
+ return GregTech_API.sBlockCasings4;
+ }
+
+ @Override
+ public byte getCasingMeta() {
+ return 9;
+ }
+
+ @Override
+ public byte getCasingTextureIndex() {
+ return 46;
+ }
+
+ @Override
+ public int getPollutionPerTick(ItemStack aStack) {
+ return 0;
+ }
+
+ @Override
+ int fluidIntoPower(ArrayList<FluidStack> aFluids, int aOptFlow, int aBaseEff) {
+
+ aOptFlow *= 5;
+ int tEU = 0;
+
+ int actualOptimalFlow = 0;
+
+ 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);
+
+ 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 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
+ depleteInput(new FluidStack(aFluids.get(i), flow)); // deplete that amount
+ remainingFlow -= flow; // track amount we're allowed to continue depleting from hatches
+ totalFlow += flow; // track total input used
+ }
+ }
+
+ tEU = (int) (Math.min((float) actualOptimalFlow, totalFlow) * fuelValue);
+
+ if (totalFlow != actualOptimalFlow) {
+ float efficiency = 1.0f - Math.abs(((totalFlow - (float) actualOptimalFlow) / actualOptimalFlow));
+ if(totalFlow>aOptFlow){efficiency = 1.0f;}
+ if (efficiency < 0)
+ efficiency = 0; // Can happen with really ludicrously poor inefficiency.
+ tEU *= efficiency;
+ tEU = Math.max(1, tEU * aBaseEff / 10000);
+ } else {
+ tEU = tEU * aBaseEff / 10000;
+ }
+
+ return tEU;
+
+ }
+ return 0;
+ }
+
+
+}
diff --git a/src/main/java/gregtech/loaders/preload/GT_Loader_MetaTileEntities.java b/src/main/java/gregtech/loaders/preload/GT_Loader_MetaTileEntities.java
index 3f9886974e..5eaea080aa 100644
--- a/src/main/java/gregtech/loaders/preload/GT_Loader_MetaTileEntities.java
+++ b/src/main/java/gregtech/loaders/preload/GT_Loader_MetaTileEntities.java
@@ -956,11 +956,13 @@ public class GT_Loader_MetaTileEntities
ItemList.LargeGasTurbine.set(new GT_MetaTileEntity_LargeTurbine_Gas(1151, "multimachine.largegasturbine", "Large Gas Turbine").getStackForm(1L));
ItemList.LargeHPSteamTurbine.set(new GT_MetaTileEntity_LargeTurbine_HPSteam(1152, "multimachine.largehpturbine", "Large HP Steam Turbine").getStackForm(1L));
ItemList.LargePlasmaTurbine.set(new GT_MetaTileEntity_LargeTurbine_Plasma(1153, "multimachine.largeplasmaturbine", "Large Plasma Generator").getStackForm(1L));
+ ItemList.LargeDieselTurbine.set(new GT_MetaTileEntity_LargeTurbine_Diesel(1171, "multimachine.largedieselturbine", "Large Diesel Generator").getStackForm(1L));
GT_ModHandler.addCraftingRecipe(ItemList.LargeSteamTurbine.get(1L, new Object[0]), GT_ModHandler.RecipeBits.DISMANTLEABLE | GT_ModHandler.RecipeBits.NOT_REMOVABLE | GT_ModHandler.RecipeBits.REVERSIBLE | GT_ModHandler.RecipeBits.BUFFERED, new Object[]{"CPC", "PMP", "BPB", 'M', ItemList.Hull_HV, 'B', OrePrefixes.pipeLarge.get(Materials.StainlessSteel), 'C', OrePrefixes.circuit.get(Materials.Advanced), 'P', OrePrefixes.gearGt.get(Materials.Steel)});
GT_ModHandler.addCraftingRecipe(ItemList.LargeGasTurbine.get(1L, new Object[0]), GT_ModHandler.RecipeBits.DISMANTLEABLE | GT_ModHandler.RecipeBits.NOT_REMOVABLE | GT_ModHandler.RecipeBits.REVERSIBLE | GT_ModHandler.RecipeBits.BUFFERED, new Object[]{"CPC", "PMP", "BPB", 'M', ItemList.Hull_EV, 'B', OrePrefixes.pipeLarge.get(Materials.Titanium), 'C', OrePrefixes.circuit.get(Materials.Elite), 'P', OrePrefixes.gearGt.get(Materials.Titanium)});
GT_ModHandler.addCraftingRecipe(ItemList.LargeHPSteamTurbine.get(1L, new Object[0]), GT_ModHandler.RecipeBits.DISMANTLEABLE | GT_ModHandler.RecipeBits.NOT_REMOVABLE | GT_ModHandler.RecipeBits.REVERSIBLE | GT_ModHandler.RecipeBits.BUFFERED, new Object[]{"CPC", "PMP", "BPB", 'M', ItemList.Hull_IV, 'B', OrePrefixes.pipeLarge.get(Materials.TungstenSteel), 'C', OrePrefixes.circuit.get(Materials.Master), 'P', OrePrefixes.gearGt.get(Materials.TungstenSteel)});
GT_ModHandler.addCraftingRecipe(ItemList.LargePlasmaTurbine.get(1L, new Object[0]), GT_ModHandler.RecipeBits.DISMANTLEABLE | GT_ModHandler.RecipeBits.NOT_REMOVABLE | GT_ModHandler.RecipeBits.REVERSIBLE | GT_ModHandler.RecipeBits.BUFFERED, new Object[]{"CPC", "PMP", "BPB", 'M', ItemList.Hull_UV, 'B', OrePrefixes.pipeHuge.get(Materials.TungstenSteel), 'C', OrePrefixes.circuit.get(Materials.Master), 'P', OrePrefixes.gearGt.get(Materials.TungstenSteel)});
+ GT_ModHandler.addCraftingRecipe(ItemList.LargeGasTurbine.get(1L, new Object[0]), GT_ModHandler.RecipeBits.DISMANTLEABLE | GT_ModHandler.RecipeBits.NOT_REMOVABLE | GT_ModHandler.RecipeBits.REVERSIBLE | GT_ModHandler.RecipeBits.BUFFERED, new Object[]{"CPC", "PMP", "BPB", 'M', ItemList.Hull_EV, 'B', OrePrefixes.pipeHuge.get(Materials.Titanium), 'C', OrePrefixes.circuit.get(Materials.Elite), 'P', OrePrefixes.gearGt.get(Materials.Titanium)});
ItemList.Pump_LV.set(new GT_MetaTileEntity_Pump(1140, "basicmachine.pump.tier.01", "Basic Pump", 1).getStackForm(1L));