Cleanup + Improvement
This commit is contained in:
parent
4fdbf01fae
commit
960087a0a8
4 changed files with 40 additions and 80 deletions
|
@ -638,7 +638,7 @@ public enum ItemList implements IItemContainer {
|
|||
ModularBasicHelmet, ModularBasicChestplate, ModularBasicLeggings, ModularBasicBoots,
|
||||
ModularElectric1Helmet, ModularElectric1Chestplate, ModularElectric1Leggings, ModularElectric1Boots,
|
||||
ModularElectric2Helmet, ModularElectric2Chestplate, ModularElectric2Leggings, ModularElectric2Boots, Block_Powderbarrel, GelledToluene,
|
||||
FluidRegulator_LV, FluidRegulator_MV, FluidRegulator_HV, FluidRegulator_EV, FluidRegulator_IV, FluidFilter, CuringOven, Machine_Multi_Assemblyline, Machine_Multi_DieselEngine, Machine_Multi_TurboDieselEngine;
|
||||
FluidRegulator_LV, FluidRegulator_MV, FluidRegulator_HV, FluidRegulator_EV, FluidRegulator_IV, FluidFilter, CuringOven, Machine_Multi_Assemblyline, Machine_Multi_DieselEngine;
|
||||
|
||||
public static final ItemList[]
|
||||
DYE_ONLY_ITEMS = {Color_00, Color_01, Color_02, Color_03, Color_04, Color_05, Color_06, Color_07, Color_08, Color_09, Color_10, Color_11, Color_12, Color_13, Color_14, Color_15}, SPRAY_CAN_DYES = {Spray_Color_00, Spray_Color_01, Spray_Color_02, Spray_Color_03, Spray_Color_04, Spray_Color_05, Spray_Color_06, Spray_Color_07, Spray_Color_08, Spray_Color_09, Spray_Color_10, Spray_Color_11, Spray_Color_12, Spray_Color_13, Spray_Color_14, Spray_Color_15}, SPRAY_CAN_DYES_USED = {Spray_Color_Used_00, Spray_Color_Used_01, Spray_Color_Used_02, Spray_Color_Used_03, Spray_Color_Used_04, Spray_Color_Used_05, Spray_Color_Used_06, Spray_Color_Used_07, Spray_Color_Used_08, Spray_Color_Used_09, Spray_Color_Used_10, Spray_Color_Used_11, Spray_Color_Used_12, Spray_Color_Used_13, Spray_Color_Used_14, Spray_Color_Used_15}, TRANSFORMERS = {Transformer_LV_ULV, Transformer_MV_LV, Transformer_HV_MV, Transformer_EV_HV, Transformer_IV_EV, Transformer_LuV_IV, Transformer_ZPM_LuV, Transformer_UV_ZPM, Transformer_MAX_UV}, MACHINE_HULLS = {Hull_ULV, Hull_LV, Hull_MV, Hull_HV, Hull_EV, Hull_IV, Hull_LuV, Hull_ZPM, Hull_UV, Hull_MAX}, HATCHES_DYNAMO = {Hatch_Dynamo_ULV, Hatch_Dynamo_LV, Hatch_Dynamo_MV, Hatch_Dynamo_HV, Hatch_Dynamo_EV, Hatch_Dynamo_IV, Hatch_Dynamo_LuV, Hatch_Dynamo_ZPM, Hatch_Dynamo_UV, Hatch_Dynamo_MAX}, HATCHES_ENERGY = {Hatch_Energy_ULV, Hatch_Energy_LV, Hatch_Energy_MV, Hatch_Energy_HV, Hatch_Energy_EV, Hatch_Energy_IV, Hatch_Energy_LuV, Hatch_Energy_ZPM, Hatch_Energy_UV, Hatch_Energy_MAX}, HATCHES_INPUT = {Hatch_Input_ULV, Hatch_Input_LV, Hatch_Input_MV, Hatch_Input_HV, Hatch_Input_EV, Hatch_Input_IV, Hatch_Input_LuV, Hatch_Input_ZPM, Hatch_Input_UV, Hatch_Input_MAX}, HATCHES_INPUT_BUS = {Hatch_Input_Bus_ULV, Hatch_Input_Bus_LV, Hatch_Input_Bus_MV, Hatch_Input_Bus_HV, Hatch_Input_Bus_EV, Hatch_Input_Bus_IV, Hatch_Input_Bus_LuV, Hatch_Input_Bus_ZPM, Hatch_Input_Bus_UV, Hatch_Input_Bus_MAX}, HATCHES_OUTPUT = {Hatch_Output_ULV, Hatch_Output_LV, Hatch_Output_MV, Hatch_Output_HV, Hatch_Output_EV, Hatch_Output_IV, Hatch_Output_LuV, Hatch_Output_ZPM, Hatch_Output_UV, Hatch_Output_MAX}, HATCHES_OUTPUT_BUS = {Hatch_Output_Bus_ULV, Hatch_Output_Bus_LV, Hatch_Output_Bus_MV, Hatch_Output_Bus_HV, Hatch_Output_Bus_EV, Hatch_Output_Bus_IV, Hatch_Output_Bus_LuV, Hatch_Output_Bus_ZPM, Hatch_Output_Bus_UV, Hatch_Output_Bus_MAX}, HATCHES_MUFFLER = {Hatch_Muffler_LV, Hatch_Muffler_LV, Hatch_Muffler_MV, Hatch_Muffler_HV, Hatch_Muffler_EV, Hatch_Muffler_IV, Hatch_Muffler_LuV, Hatch_Muffler_ZPM, Hatch_Muffler_UV, Hatch_Muffler_MAX};
|
||||
|
|
|
@ -6,8 +6,10 @@ 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.items.GT_MetaGenerated_Tool;
|
||||
import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch;
|
||||
import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Dynamo;
|
||||
import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Turbo;
|
||||
import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_MultiBlockBase;
|
||||
import gregtech.api.objects.GT_RenderedTexture;
|
||||
import gregtech.api.util.GT_Recipe;
|
||||
|
@ -22,6 +24,9 @@ import java.util.ArrayList;
|
|||
import java.util.Collection;
|
||||
|
||||
public class GT_MetaTileEntity_DieselEngine extends GT_MetaTileEntity_MultiBlockBase {
|
||||
protected int fuelConsumption = 0;
|
||||
protected int fuelRemaining = 0;
|
||||
|
||||
public GT_MetaTileEntity_DieselEngine(int aID, String aName, String aNameRegional) {
|
||||
super(aID, aName, aNameRegional);
|
||||
}
|
||||
|
@ -61,24 +66,37 @@ public class GT_MetaTileEntity_DieselEngine extends GT_MetaTileEntity_MultiBlock
|
|||
|
||||
@Override
|
||||
public boolean checkRecipe(ItemStack aStack) {
|
||||
ArrayList<GT_MetaTileEntity_Hatch_Turbo> tHatches = mTurboHatches;
|
||||
ArrayList<FluidStack> tFluids = getStoredFluids();
|
||||
Collection<GT_Recipe> tRecipeList = GT_Recipe.GT_Recipe_Map.sDieselFuels.mRecipeList;
|
||||
int baseEUt = requiresTurboHatch() ? 8192 : 2048;
|
||||
|
||||
if(tFluids.size() > 0 && tRecipeList != null) {
|
||||
for (FluidStack hatchFluid1 : tFluids) { //Loops through hatches
|
||||
for(GT_Recipe aFuel : tRecipeList) { //Loops through diesel fuel recipes
|
||||
FluidStack tLiquid;
|
||||
if ((tLiquid = GT_Utility.getFluidForFilledItem(aFuel.getRepresentativeInput(0), true)) != null) {
|
||||
if (hatchFluid1.isFluidEqual(tLiquid)) { //Has a diesel fluid
|
||||
System.out.println("Fuel Value: "+aFuel.mSpecialValue); //For testing, needs to be removed
|
||||
tLiquid.amount = baseEUt / aFuel.mSpecialValue; //Calc fuel consumption
|
||||
depleteInput(tLiquid); //Deplete that amount
|
||||
mProgresstime = 1;
|
||||
mMaxProgresstime = 1;
|
||||
mEfficiencyIncrease = 10;
|
||||
mEUt = mEfficiency <= 2000 ? 0 : baseEUt * (mEfficiency / 10000); //Output 0 if startup is 20% or less
|
||||
return true;
|
||||
if(tHatches.size() > 0) {
|
||||
if(tHatches.get(0).getStackInSlot(0) != null) {
|
||||
ItemStack hatchStack = tHatches.get(0).getStackInSlot(0);
|
||||
if(hatchStack.getItem() instanceof GT_MetaGenerated_Tool) { //Has a GT tool
|
||||
GT_MetaGenerated_Tool hatchTool = (GT_MetaGenerated_Tool)tHatches.get(0).getStackInSlot(0).getItem();
|
||||
|
||||
//TODO Better method to detect turbine item. This will do for testing.
|
||||
int baseEUt = GT_MetaGenerated_Tool.getPrimaryMaterial(hatchStack).mDurability > 0 ? 8192 : 2048; //Choose base output
|
||||
|
||||
if(tFluids.size() > 0 && tRecipeList != null) { //Does input hatch have a diesel fuel?
|
||||
for (FluidStack hatchFluid1 : tFluids) { //Loops through hatches
|
||||
for(GT_Recipe aFuel : tRecipeList) { //Loops through diesel fuel recipes
|
||||
FluidStack tLiquid;
|
||||
if ((tLiquid = GT_Utility.getFluidForFilledItem(aFuel.getRepresentativeInput(0), true)) != null) { //Create fluidstack from current recipe
|
||||
if (hatchFluid1.isFluidEqual(tLiquid)) { //Has a diesel fluid
|
||||
System.out.println("Fuel Value: "+aFuel.mSpecialValue); //For testing, needs to be removed
|
||||
fuelConsumption = tLiquid.amount = baseEUt / aFuel.mSpecialValue; //Calc fuel consumption
|
||||
depleteInput(tLiquid); //Deplete that amount
|
||||
fuelRemaining = hatchFluid1.amount; //Record available fuel
|
||||
this.mProgresstime = 1;
|
||||
this.mMaxProgresstime = 1;
|
||||
this.mEfficiencyIncrease = 10;
|
||||
this.mEUt = mEfficiency < 2000 ? 0 : (int)(baseEUt * ((float)mEfficiency / 10000)); //Output 0 if startup is less than 20%
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -112,10 +130,6 @@ public class GT_MetaTileEntity_DieselEngine extends GT_MetaTileEntity_MultiBlock
|
|||
if (getBaseMetaTileEntity().getBlock(tX + (tSide == 5 ? k : tSide == 4 ? -k : i), tY + j, tZ + (tSide == 2 ? -k : tSide == 3 ? k : i)) == getCasingBlock() && getBaseMetaTileEntity().getMetaID(tX + (tSide == 5 ? k : tSide == 4 ? -k : i), tY + j, tZ + (tSide == 2 ? -k : tSide == 3 ? k : i)) == getCasingMeta()) {
|
||||
} else if (!addMufflerToMachineList(getBaseMetaTileEntity().getIGregTechTileEntity(tX + (tSide == 5 ? 2 : tSide == 4 ? -2 : 0), tY + 1, tZ + (tSide == 3 ? 2 : tSide == 2 ? -2 : 0)), getCasingTextureIndex())) {
|
||||
return false; //Fail if no muffler top middle back
|
||||
} else if (!requiresTurboHatch() && addTurboToMachineList(getBaseMetaTileEntity().getIGregTechTileEntity(tX + (tSide == 5 ? k : tSide == 4 ? -k : i), tY + j, tZ + (tSide == 2 ? -k : tSide == 3 ? k : i)), getCasingTextureIndex())) {
|
||||
return false; //Fail if has turbo hatch and !requiresTurboHatch()
|
||||
} else if (requiresTurboHatch() && !addTurboToMachineList(getBaseMetaTileEntity().getIGregTechTileEntity(tX + (tSide == 5 ? k : tSide == 4 ? -k : i), tY + j, tZ + (tSide == 2 ? -k : tSide == 3 ? k : i)), getCasingTextureIndex())) {
|
||||
return false; //Fail if does not have turbo hatch and requiresTurboHatch()
|
||||
} else if (!addToMachineList(getBaseMetaTileEntity().getIGregTechTileEntity(tX + (tSide == 5 ? k : tSide == 4 ? -k : i), tY + j, tZ + (tSide == 2 ? -k : tSide == 3 ? k : i)))) {
|
||||
return false;
|
||||
}
|
||||
|
@ -144,10 +158,6 @@ public class GT_MetaTileEntity_DieselEngine extends GT_MetaTileEntity_MultiBlock
|
|||
return true;
|
||||
}
|
||||
|
||||
public boolean requiresTurboHatch() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public Block getCasingBlock() {
|
||||
return GregTech_API.sBlockCasings4;
|
||||
}
|
||||
|
@ -177,7 +187,7 @@ public class GT_MetaTileEntity_DieselEngine extends GT_MetaTileEntity_MultiBlock
|
|||
}
|
||||
|
||||
private boolean addToMachineList(IGregTechTileEntity tTileEntity) {
|
||||
return ((addTurboToMachineList(tTileEntity, getCasingTextureIndex()) && requiresTurboHatch()) || (addMaintenanceToMachineList(tTileEntity, getCasingTextureIndex())) || (addInputToMachineList(tTileEntity, getCasingTextureIndex())) || (addOutputToMachineList(tTileEntity, getCasingTextureIndex())) || (addMufflerToMachineList(tTileEntity, getCasingTextureIndex())));
|
||||
return ((addTurboToMachineList(tTileEntity, getCasingTextureIndex()) || (addMaintenanceToMachineList(tTileEntity, getCasingTextureIndex())) || (addInputToMachineList(tTileEntity, getCasingTextureIndex())) || (addOutputToMachineList(tTileEntity, getCasingTextureIndex())) || (addMufflerToMachineList(tTileEntity, getCasingTextureIndex()))));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -222,9 +232,11 @@ public class GT_MetaTileEntity_DieselEngine extends GT_MetaTileEntity_MultiBlock
|
|||
@Override
|
||||
public String[] getInfoData() {
|
||||
return new String[]{
|
||||
"Diesel Engine",
|
||||
"Current Output: "+mEUt+" EU/t",
|
||||
"Current Efficiency: "+(mEfficiency/100)+"%"};
|
||||
"Diesel Engine",
|
||||
"Current Output: "+mEUt+" EU/t",
|
||||
"Fuel Consumption: "+fuelConsumption+"L/t",
|
||||
"Fuel Remaining: "+fuelRemaining+" Litres",
|
||||
"Current Efficiency: "+(mEfficiency/100)+"%"};
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -1,49 +0,0 @@
|
|||
package gregtech.common.tileentities.machines.multi;
|
||||
|
||||
import gregtech.api.interfaces.metatileentity.IMetaTileEntity;
|
||||
import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
|
||||
|
||||
public class GT_MetaTileEntity_DieselEngineTurbo extends GT_MetaTileEntity_DieselEngine {
|
||||
public GT_MetaTileEntity_DieselEngineTurbo(int aID, String aName, String aNameRegional) {
|
||||
super(aID, aName, aNameRegional);
|
||||
}
|
||||
public GT_MetaTileEntity_DieselEngineTurbo(String aName) {
|
||||
super(aName);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] getDescription() {
|
||||
return new String[]{
|
||||
"Controller Block for the Large Diesel Engine",
|
||||
"Size: 3x3x4",
|
||||
"Controller (front centered)",
|
||||
"3x3x4 of Stable Titanium Casing (hollow, Min 24!)",
|
||||
"2x Titanium Pipe Casing Block inside the Hollow Casing",
|
||||
"1x Input Hatch (one of the Casings)",
|
||||
"1x Maintenance Hatch (one of the Casings)",
|
||||
"1x Muffler Hatch (top middle back)",
|
||||
"1x Dynamo Hatch (back centered)",
|
||||
"Engine Intake Casings not obstructed (only air blocks)"};
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean requiresTurboHatch() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) {
|
||||
return new GT_MetaTileEntity_DieselEngineTurbo(this.mName);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] getInfoData() {
|
||||
return new String[]{
|
||||
"Large Diesel Engine",
|
||||
"Current Output: " + mEUt + " EU/t",
|
||||
|
||||
"Efficiency: " + (float) mEfficiency / 100 + "%",
|
||||
"EfficiencyRaw: " + mEfficiency //For testing only, needs to be removed
|
||||
};
|
||||
}
|
||||
}
|
|
@ -1038,9 +1038,6 @@ public class GT_Loader_MetaTileEntities
|
|||
|
||||
ItemList.Machine_Multi_DieselEngine.set(new GT_MetaTileEntity_DieselEngine(1171, "multimachine.dieselengine", "Diesel Engine").getStackForm(1L));
|
||||
GT_ModHandler.addCraftingRecipe(ItemList.Machine_Multi_DieselEngine.get(1L, new Object[0]), GT_ModHandler.RecipeBits.DISMANTLEABLE | GT_ModHandler.RecipeBits.NOT_REMOVABLE | GT_ModHandler.RecipeBits.REVERSIBLE | GT_ModHandler.RecipeBits.BUFFERED, new Object[]{"WCW", "EME", "WCW", 'M', ItemList.Hull_IV, 'W', ItemList.Casing_Assembler, 'E', OrePrefixes.circuit.get(Materials.Ultimate), 'C', ItemList.Robot_Arm_IV});
|
||||
|
||||
ItemList.Machine_Multi_TurboDieselEngine.set(new GT_MetaTileEntity_DieselEngineTurbo(1172, "multimachine.turbodieselengine", "Turbo Diesel Engine").getStackForm(1L));
|
||||
GT_ModHandler.addCraftingRecipe(ItemList.Machine_Multi_TurboDieselEngine.get(1L, new Object[0]), GT_ModHandler.RecipeBits.DISMANTLEABLE | GT_ModHandler.RecipeBits.NOT_REMOVABLE | GT_ModHandler.RecipeBits.REVERSIBLE | GT_ModHandler.RecipeBits.BUFFERED, new Object[]{"WCW", "EME", "WCW", 'M', ItemList.Hull_IV, 'W', ItemList.Casing_Assembler, 'E', OrePrefixes.circuit.get(Materials.Ultimate), 'C', ItemList.Robot_Arm_IV});
|
||||
}
|
||||
|
||||
private static void run4() {
|
||||
|
|
Loading…
Reference in a new issue