Basically a rewrite

This commit is contained in:
Muramasa 2016-05-20 05:36:32 +01:00
parent 4a59d0efbd
commit 8880eb8d6d
12 changed files with 451 additions and 243 deletions

View file

@ -552,7 +552,7 @@ public enum ItemList implements IItemContainer {
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,
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,
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,
Hatch_Maintenance,
Hatch_Maintenance, Hatch_Turbo,
Battery_Buffer_1by1_ULV, Battery_Buffer_1by1_LV, Battery_Buffer_1by1_MV, Battery_Buffer_1by1_HV, Battery_Buffer_1by1_EV, Battery_Buffer_1by1_IV, Battery_Buffer_1by1_LuV, Battery_Buffer_1by1_ZPM, Battery_Buffer_1by1_UV, Battery_Buffer_1by1_MAX,
Battery_Buffer_2by2_ULV, Battery_Buffer_2by2_LV, Battery_Buffer_2by2_MV, Battery_Buffer_2by2_HV, Battery_Buffer_2by2_EV, Battery_Buffer_2by2_IV, Battery_Buffer_2by2_LuV, Battery_Buffer_2by2_ZPM, Battery_Buffer_2by2_UV, Battery_Buffer_2by2_MAX,
@ -628,7 +628,6 @@ public enum ItemList implements IItemContainer {
LargeSteamTurbine, LargeGasTurbine, LargeHPSteamTurbine, LargePlasmaTurbine,
Ingot_Heavy1, Ingot_Heavy2, Ingot_Heavy3,
Pump_LV, Pump_MV, Pump_HV, Pump_EV, Pump_IV,
Teleporter, Cover_NeedsMaintainance, Casing_Turbine, Casing_Turbine1, Casing_Turbine2, Casing_Turbine3,
MobRep_LV, MobRep_MV, MobRep_HV, MobRep_EV, MobRep_IV, Cover_PlayerDetector, Machine_Multi_HeatExchanger,
Block_BronzePlate, Block_IridiumTungstensteel, Block_Plascrete, Block_TungstenSteelReinforced,
Honeycomb, Charcoal_Pile, Block_BrittleCharcoal, Seismic_Prospector, OilDrill, AdvancedMiner2, PyrolyseOven, OilCracker, Crop_Drop_UUMBerry, Crop_Drop_UUABerry, Empty_Board_Basic, Empty_Board_Elite,
@ -638,7 +637,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_LargeDieselEngine;
FluidRegulator_LV, FluidRegulator_MV, FluidRegulator_HV, FluidRegulator_EV, FluidRegulator_IV, FluidFilter, CuringOven, Machine_Multi_Assemblyline, Machine_Multi_DieselEngine, Machine_Multi_TurboDieselEngine;
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};

File diff suppressed because one or more lines are too long

View file

@ -0,0 +1,16 @@
package gregtech.api.gui;
import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
import net.minecraft.entity.player.InventoryPlayer;
public class GT_Container_TurboHatch extends GT_ContainerMetaTile_Machine {
public GT_Container_TurboHatch(InventoryPlayer aInventoryPlayer, IGregTechTileEntity aTileEntity) {
super(aInventoryPlayer, aTileEntity);
}
@Override
public void addSlots(InventoryPlayer aInventoryPlayer) {
addSlotToContainer(new GT_Slot_Holo(mTileEntity, 0, 80, 35, false, false, 1));
}
}

View file

@ -0,0 +1,27 @@
package gregtech.api.gui;
import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
import net.minecraft.entity.player.InventoryPlayer;
import static gregtech.api.enums.GT_Values.RES_PATH_GUI;
public class GT_GUIContainer_TurboHatch extends GT_GUIContainerMetaTile_Machine {
public GT_GUIContainer_TurboHatch(InventoryPlayer aInventoryPlayer, IGregTechTileEntity aTileEntity) {
super(new GT_Container_TurboHatch(aInventoryPlayer, aTileEntity), RES_PATH_GUI + "Maintenance.png");
}
@Override
protected void drawGuiContainerForegroundLayer(int par1, int par2) {
fontRendererObj.drawString("Turbo Hatch", 8, 4, 4210752);
fontRendererObj.drawString("Insert small turbine rotor.", 8, 12, 4210752);
}
@Override
protected void drawGuiContainerBackgroundLayer(float par1, int par2, int par3) {
super.drawGuiContainerBackgroundLayer(par1, par2, par3);
int x = (width - xSize) / 2;
int y = (height - ySize) / 2;
drawTexturedModalRect(x, y, 0, 0, xSize, ySize);
}
}

View file

@ -0,0 +1,95 @@
package gregtech.api.metatileentity.implementations;
import gregtech.api.enums.Textures;
import gregtech.api.gui.GT_Container_TurboHatch;
import gregtech.api.gui.GT_GUIContainer_TurboHatch;
import gregtech.api.interfaces.ITexture;
import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
import gregtech.api.metatileentity.MetaTileEntity;
import gregtech.api.objects.GT_RenderedTexture;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
public class GT_MetaTileEntity_Hatch_Turbo extends GT_MetaTileEntity_Hatch {
public GT_MetaTileEntity_Hatch_Turbo(int aID, String aName, String aNameRegional, int aTier) {
super(aID, aName, aNameRegional, aTier, 1, "For maintaining Multiblocks");
}
public GT_MetaTileEntity_Hatch_Turbo(String aName, int aTier, String aDescription, ITexture[][][] aTextures) {
super(aName, aTier, 1, aDescription, aTextures);
}
@Override
public String[] getDescription() {
return new String[]{mDescription, "Cannot be shared between Multiblocks!"};
}
@Override
public ITexture[] getTexturesActive(ITexture aBaseTexture) {
return new ITexture[]{aBaseTexture, new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_MAINTENANCE)};
}
@Override
public ITexture[] getTexturesInactive(ITexture aBaseTexture) {
return new ITexture[]{aBaseTexture, new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_MAINTENANCE), new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_DUCTTAPE)};
}
@Override
public void initDefaultModes(NBTTagCompound aNBT) {
getBaseMetaTileEntity().setActive(true);
}
@Override
public boolean isSimpleMachine() {
return true;
}
@Override
public boolean isFacingValid(byte aFacing) {
return true;
}
@Override
public boolean isAccessAllowed(EntityPlayer aPlayer) {
return true;
}
@Override
public boolean isValidSlot(int aIndex) {
return false;
}
@Override
public MetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) {
return new GT_MetaTileEntity_Hatch_Turbo(mName, mTier, mDescription, mTextures);
}
@Override
public boolean onRightclick(IGregTechTileEntity aBaseMetaTileEntity, EntityPlayer aPlayer, byte aSide, float aX, float aY, float aZ) {
if (aBaseMetaTileEntity.isClientSide()) return true;
if (aSide == aBaseMetaTileEntity.getFrontFacing()) aBaseMetaTileEntity.openGUI(aPlayer);
return true;
}
@Override
public Object getServerGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) {
return new GT_Container_TurboHatch(aPlayerInventory, aBaseMetaTileEntity);
}
@Override
public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) {
return new GT_GUIContainer_TurboHatch(aPlayerInventory, aBaseMetaTileEntity);
}
@Override
public boolean allowPullStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) {
return true;
}
@Override
public boolean allowPutStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) {
return true;
}
}

View file

@ -46,6 +46,7 @@ public abstract class GT_MetaTileEntity_MultiBlockBase extends MetaTileEntity {
public ArrayList<GT_MetaTileEntity_Hatch_Muffler> mMufflerHatches = new ArrayList<GT_MetaTileEntity_Hatch_Muffler>();
public ArrayList<GT_MetaTileEntity_Hatch_Energy> mEnergyHatches = new ArrayList<GT_MetaTileEntity_Hatch_Energy>();
public ArrayList<GT_MetaTileEntity_Hatch_Maintenance> mMaintenanceHatches = new ArrayList<GT_MetaTileEntity_Hatch_Maintenance>();
public ArrayList<GT_MetaTileEntity_Hatch_Turbo> mTurboHatches = new ArrayList<GT_MetaTileEntity_Hatch_Turbo>();
public GT_MetaTileEntity_MultiBlockBase(int aID, String aName, String aNameRegional) {
super(aID, aName, aNameRegional, 2);
@ -195,6 +196,7 @@ public abstract class GT_MetaTileEntity_MultiBlockBase extends MetaTileEntity {
mEnergyHatches.clear();
mMufflerHatches.clear();
mMaintenanceHatches.clear();
mTurboHatches.clear();
mMachine = checkMachine(aBaseMetaTileEntity, mInventory[1]);
}
if (mStartUpCheck < 0) {
@ -483,6 +485,7 @@ public abstract class GT_MetaTileEntity_MultiBlockBase extends MetaTileEntity {
for (MetaTileEntity tTileEntity : mMufflerHatches) tTileEntity.getBaseMetaTileEntity().doExplosion(V[8]);
for (MetaTileEntity tTileEntity : mEnergyHatches) tTileEntity.getBaseMetaTileEntity().doExplosion(V[8]);
for (MetaTileEntity tTileEntity : mMaintenanceHatches) tTileEntity.getBaseMetaTileEntity().doExplosion(V[8]);
for (MetaTileEntity tTileEntity : mTurboHatches) tTileEntity.getBaseMetaTileEntity().doExplosion(V[8]);
getBaseMetaTileEntity().doExplosion(V[8]);
}
@ -699,6 +702,8 @@ public abstract class GT_MetaTileEntity_MultiBlockBase extends MetaTileEntity {
return mMaintenanceHatches.add((GT_MetaTileEntity_Hatch_Maintenance) aMetaTileEntity);
if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Muffler)
return mMufflerHatches.add((GT_MetaTileEntity_Hatch_Muffler) aMetaTileEntity);
if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Turbo)
return mTurboHatches.add((GT_MetaTileEntity_Hatch_Turbo) aMetaTileEntity);
return false;
}
@ -713,6 +718,17 @@ public abstract class GT_MetaTileEntity_MultiBlockBase extends MetaTileEntity {
return false;
}
public boolean addTurboToMachineList(IGregTechTileEntity aTileEntity, int aBaseCasingIndex) {
if (aTileEntity == null) return false;
IMetaTileEntity aMetaTileEntity = aTileEntity.getMetaTileEntity();
if (aMetaTileEntity == null) return false;
if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Turbo) {
((GT_MetaTileEntity_Hatch) aMetaTileEntity).mMachineBlock = (byte) aBaseCasingIndex;
return mTurboHatches.add((GT_MetaTileEntity_Hatch_Turbo) aMetaTileEntity);
}
return false;
}
public boolean addEnergyInputToMachineList(IGregTechTileEntity aTileEntity, int aBaseCasingIndex) {
if (aTileEntity == null) {
return false;

View file

@ -36,6 +36,7 @@ public class GT_Block_Casings4
GT_LanguageManager.addStringLocalization(getUnlocalizedName() + ".10.name", "Stainless Steel Turbine Casing");
GT_LanguageManager.addStringLocalization(getUnlocalizedName() + ".11.name", "Titanium Turbine Casing");
GT_LanguageManager.addStringLocalization(getUnlocalizedName() + ".12.name", "Tungstensteel Turbine Casing");
GT_LanguageManager.addStringLocalization(getUnlocalizedName() + ".13.name", "Engine Intake Casing");
ItemList.Casing_RobustTungstenSteel.set(new ItemStack(this, 1, 0));
ItemList.Casing_CleanStainlessSteel.set(new ItemStack(this, 1, 1));
@ -48,6 +49,7 @@ public class GT_Block_Casings4
ItemList.Casing_Turbine1.set(new ItemStack(this, 1, 10));
ItemList.Casing_Turbine2.set(new ItemStack(this, 1, 11));
ItemList.Casing_Turbine3.set(new ItemStack(this, 1, 12));
ItemList.Casing_EngineIntake.set(new ItemStack(this, 1, 13));
}
public IIcon getIcon(int aSide, int aMeta) {
@ -79,7 +81,7 @@ public class GT_Block_Casings4
case 12:
return Textures.BlockIcons.MACHINE_CASING_ROBUST_TUNGSTENSTEEL.getIcon();
case 13:
return Textures.BlockIcons.MACHINE_CASING_ROBUST_TUNGSTENSTEEL.getIcon();
return Textures.BlockIcons.MACHINE_CASING_ENGINE_INTAKE.getIcon();
case 14:
return Textures.BlockIcons.MACHINE_CASING_ROBUST_TUNGSTENSTEEL.getIcon();
case 15:

View file

@ -0,0 +1,234 @@
package gregtech.common.tileentities.machines.multi;
import gregtech.api.GregTech_API;
import gregtech.api.enums.Textures;
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.metatileentity.implementations.GT_MetaTileEntity_Hatch;
import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Dynamo;
import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_MultiBlockBase;
import gregtech.api.objects.GT_RenderedTexture;
import gregtech.api.util.GT_Recipe;
import gregtech.api.util.GT_Utility;
import net.minecraft.block.Block;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraftforge.fluids.FluidStack;
import java.util.ArrayList;
import java.util.Collection;
public class GT_MetaTileEntity_DieselEngine extends GT_MetaTileEntity_MultiBlockBase {
public GT_MetaTileEntity_DieselEngine(int aID, String aName, String aNameRegional) {
super(aID, aName, aNameRegional);
}
public GT_MetaTileEntity_DieselEngine(String aName) {
super(aName);
}
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)"};
}
public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) {
if (aSide == aFacing) {
return new ITexture[]{Textures.BlockIcons.CASING_BLOCKS[50], new GT_RenderedTexture(aActive ? Textures.BlockIcons.OVERLAY_FRONT_LARGE_BOILER_ACTIVE : Textures.BlockIcons.OVERLAY_FRONT_LARGE_BOILER)};
}
return new ITexture[]{Textures.BlockIcons.CASING_BLOCKS[50]};
}
@Override
public boolean isCorrectMachinePart(ItemStack aStack) {
return getMaxEfficiency(aStack) > 0;
}
public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) {
return new GT_GUIContainer_MultiMachine(aPlayerInventory, aBaseMetaTileEntity, getLocalName(), "LargeDieselEngine.png");
}
@Override
public boolean checkRecipe(ItemStack aStack) {
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;
}
}
}
}
}
return false;
}
@Override
public boolean checkMachine(IGregTechTileEntity aBaseMetaTileEntity, ItemStack aStack) {
byte tSide = getBaseMetaTileEntity().getBackFacing();
int tX = getBaseMetaTileEntity().getXCoord();
int tY = getBaseMetaTileEntity().getYCoord();
int tZ = getBaseMetaTileEntity().getZCoord();
if(getBaseMetaTileEntity().getBlockAtSideAndDistance(tSide, 1) != getGearboxBlock() && getBaseMetaTileEntity().getBlockAtSideAndDistance(tSide, 2) != getGearboxBlock()) {
return false;
}
if(getBaseMetaTileEntity().getMetaIDAtSideAndDistance(tSide, 1) != getGearboxMeta() && getBaseMetaTileEntity().getMetaIDAtSideAndDistance(tSide, 2) != getGearboxMeta()) {
return false;
}
for (byte i = -1; i < 2; i = (byte) (i + 1)) {
for (byte j = -1; j < 2; j = (byte) (j + 1)) {
if ((i != 0) || (j != 0)) {
for (byte k = 0; k < 4; k = (byte) (k + 1)) {
Block frontAir = getBaseMetaTileEntity().getBlock(tX - (tSide == 5 ? 1 : tSide == 4 ? -1 : i), tY + j, tZ - (tSide == 2 ? -1 : tSide == 3 ? 1 : i));
if(!(frontAir.getUnlocalizedName().equalsIgnoreCase("tile.air") || frontAir.getUnlocalizedName().equalsIgnoreCase("tile.railcraft.residual.heat"))) {
return false; //Fail if vent blocks are obstructed
}
if (((i == 0) || (j == 0)) && ((k == 1) || (k == 2))) {
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;
}
} else if (k == 0) {
if(!(getBaseMetaTileEntity().getBlock(tX + (tSide == 5 ? k : tSide == 4 ? -k : i), tY + j, tZ + (tSide == 2 ? -k : tSide == 3 ? k : i)) == getIntakeBlock() && getBaseMetaTileEntity().getMetaID(tX + (tSide == 5 ? k : tSide == 4 ? -k : i), tY + j, tZ + (tSide == 2 ? -k : tSide == 3 ? k : i)) == getIntakeMeta())) {
return false;
}
} else 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 {
return false;
}
}
}
}
}
this.mDynamoHatches.clear();
IGregTechTileEntity tTileEntity = getBaseMetaTileEntity().getIGregTechTileEntityAtSideAndDistance(getBaseMetaTileEntity().getBackFacing(), 3);
if ((tTileEntity != null) && (tTileEntity.getMetaTileEntity() != null)) {
if ((tTileEntity.getMetaTileEntity() instanceof GT_MetaTileEntity_Hatch_Dynamo)) {
this.mDynamoHatches.add((GT_MetaTileEntity_Hatch_Dynamo) tTileEntity.getMetaTileEntity());
((GT_MetaTileEntity_Hatch) tTileEntity.getMetaTileEntity()).mMachineBlock = getCasingTextureIndex();
} else {
return false;
}
}
return true;
}
public boolean requiresTurboHatch() {
return false;
}
public Block getCasingBlock() {
return GregTech_API.sBlockCasings4;
}
public byte getCasingMeta() {
return 2;
}
public Block getIntakeBlock() {
return GregTech_API.sBlockCasings4;
}
public byte getIntakeMeta() {
return 13;
}
public Block getGearboxBlock() {
return GregTech_API.sBlockCasings2;
}
public byte getGearboxMeta() {
return 4;
}
public byte getCasingTextureIndex() {
return 50;
}
private boolean addToMachineList(IGregTechTileEntity tTileEntity) {
return ((addTurboToMachineList(tTileEntity, getCasingTextureIndex()) && requiresTurboHatch()) || (addMaintenanceToMachineList(tTileEntity, getCasingTextureIndex())) || (addInputToMachineList(tTileEntity, getCasingTextureIndex())) || (addOutputToMachineList(tTileEntity, getCasingTextureIndex())) || (addMufflerToMachineList(tTileEntity, getCasingTextureIndex())));
}
@Override
public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) {
return new GT_MetaTileEntity_DieselEngine(this.mName);
}
@Override
public void saveNBTData(NBTTagCompound aNBT) {
super.saveNBTData(aNBT);
}
@Override
public void loadNBTData(NBTTagCompound aNBT) {
super.loadNBTData(aNBT);
}
@Override
public int getDamageToComponent(ItemStack aStack) {
return 1;
}
public int getMaxEfficiency(ItemStack aStack) {
return 10000;
}
@Override
public int getPollutionPerTick(ItemStack aStack) {
return 0;
}
@Override
public int getAmountOfOutputs() {
return 0;
}
@Override
public boolean explodesOnComponentBreak(ItemStack aStack) {
return true;
}
@Override
public String[] getInfoData() {
return new String[]{
"Diesel Engine",
"Current Output: "+mEUt+" EU/t",
"Current Efficiency: "+(mEfficiency/100)+"%"};
}
@Override
public boolean isGivingInformation() {
return true;
}
}

View file

@ -0,0 +1,49 @@
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
};
}
}

View file

@ -1,236 +0,0 @@
package gregtech.common.tileentities.machines.multi;
import gregtech.api.GregTech_API;
import gregtech.api.enums.Materials;
import gregtech.api.enums.Textures;
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.metatileentity.implementations.GT_MetaTileEntity_MultiBlockBase;
import gregtech.api.objects.GT_RenderedTexture;
import gregtech.api.util.GT_Recipe;
import gregtech.api.util.GT_Utility;
import net.minecraft.block.Block;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.item.ItemStack;
import net.minecraftforge.common.util.ForgeDirection;
import net.minecraftforge.fluids.FluidRegistry;
import net.minecraftforge.fluids.FluidStack;
import java.util.ArrayList;
import java.util.Collection;
public class GT_MetaTileEntity_LargeDieselEngine extends GT_MetaTileEntity_MultiBlockBase {
boolean firstRun = true;
boolean hasLubricant = false;
boolean hasCoolant = false;
boolean hasOxygen = false;
public GT_MetaTileEntity_LargeDieselEngine(int aID, String aName, String aNameRegional) {
super(aID, aName, aNameRegional);
}
public GT_MetaTileEntity_LargeDieselEngine(String aName) {
super(aName);
}
public String[] getDescription() {
return new String[]{
"Controller Block for the Large Diesel Engine",
"Size: 3x3x3",
"Controller (front centered)",
"3x3x3 of Stable Titanium Casing (hollow, Min 24!)",
"1x Titanium Pipe Casing Block inside the Hollow Casing",
"3x Input Hatch (one of the Casings)",
"1x Maintenance Hatch (one of the Casings)",
"1x Muffler Hatch (one of the Casings)",
"1x Dynamo Hatch (back centered)"};
}
public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) {
if (aSide == aFacing) {
return new ITexture[]{Textures.BlockIcons.CASING_BLOCKS[50], new GT_RenderedTexture(aActive ? Textures.BlockIcons.OVERLAY_FRONT_LARGE_BOILER_ACTIVE : Textures.BlockIcons.OVERLAY_FRONT_LARGE_BOILER)};
}
return new ITexture[]{Textures.BlockIcons.CASING_BLOCKS[50]};
}
public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) {
return new GT_GUIContainer_MultiMachine(aPlayerInventory, aBaseMetaTileEntity, getLocalName(), "LargeDieselEngine.png");
}
public boolean isCorrectMachinePart(ItemStack aStack) {
return true;
}
public boolean isFacingValid(byte aFacing) {
return aFacing > 1;
}
public boolean checkRecipe(ItemStack aStack) {
ArrayList<FluidStack> tFluids = getStoredFluids();
Collection<GT_Recipe> tRecipeList = GT_Recipe.GT_Recipe_Map.sDieselFuels.mRecipeList;
hasLubricant = false;
hasCoolant = false;
hasOxygen = false;
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)) {
for (FluidStack hatchFluid2 : tFluids) {
if(hatchFluid2.isFluidEqual(Materials.Lubricant.getFluid(1L))) hasLubricant = true;
if(hatchFluid2.isFluidEqual(FluidRegistry.getFluidStack("ic2coolant", 1))) hasCoolant = true;
if(hatchFluid2.isFluidEqual(Materials.Oxygen.getGas(1L))) {
if(hatchFluid2.amount >= aFuel.mSpecialValue / 10) {
hasOxygen = true;
}
}
}
System.out.println("Fuel Value: "+aFuel.mSpecialValue);
//Deplete Oxygen
if(hasOxygen) depleteInput(Materials.Oxygen.getGas(aFuel.mSpecialValue / 10));
//Deplete coolant every IRL hour
//Create Maintenance issues every hour if there is no coolant
if(hasCoolant) {
int amount = hasOxygen ? 3 ^ (mEfficiency / 10000) : (mEfficiency / 10000);
if(firstRun) {
depleteInput(FluidRegistry.getFluidStack("ic2coolant", amount));
} else if(mRuntime % 720 == 0) {
depleteInput(FluidRegistry.getFluidStack("ic2coolant", amount));
}
} else {
doRandomMaintenanceDamage();
}
//Deplete Lubricant every 12096 ticks or 10.08 minutes (Every 1000L should last an IRL week)
if(hasLubricant) {
if(firstRun) {
depleteInput(Materials.Lubricant.getFluid(1L));
} else if(mRuntime % 12096 == 0) {
depleteInput(Materials.Lubricant.getFluid(1L));
}
} else {
//Negative Effect?
}
tLiquid.amount = 1;
depleteInput(tLiquid);
mProgresstime = 1;
mMaxProgresstime = 1;
mEfficiencyIncrease = 10;
int baseEUt = 768;
mEUt = (baseEUt + (aFuel.mSpecialValue * 10) * mEfficiency / 10000);
return true;
}
}
}
}
}
return false;
}
@Override
public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) {
if (mProgresstime > 0 && firstRun) {
firstRun = false;
try {
//Implement Achievement
//GT_Mod.instance.achievements.issueAchievement(aBaseMetaTileEntity.getWorld().getPlayerEntityByName(aBaseMetaTileEntity.getOwnerName()), "extremepressure");
} catch (Exception e) {
}
}
super.onPostTick(aBaseMetaTileEntity, aTick);
}
public boolean checkMachine(IGregTechTileEntity aBaseMetaTileEntity, ItemStack aStack) {
int xDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetX;
int zDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetZ;
if (aBaseMetaTileEntity.getBlockOffset(xDir, 0, zDir) != getPipeBlock()) {
return false;
}
if (aBaseMetaTileEntity.getMetaIDOffset(xDir, 0, zDir) != getPipeMeta()) {
return false;
}
int tAmount = 0;
for (int i = -1; i < 2; i++) {
for (int j = -1; j < 2; j++) {
for (int h = -1; h < 2; h++) {
if ((h != 0) || (((xDir + i != 0) || (zDir + j != 0)) && ((i != 0) || (j != 0)))) {
IGregTechTileEntity tTileEntity = aBaseMetaTileEntity.getIGregTechTileEntityOffset(xDir + i, h, zDir + j);
if ((!addMaintenanceToMachineList(tTileEntity, 50)) && (!addMufflerToMachineList(tTileEntity, 50)) && (!addInputToMachineList(tTileEntity, 50)) && (!addInputToMachineList(tTileEntity, 50)) && (!addInputToMachineList(tTileEntity, 50)) && (!addInputToMachineList(tTileEntity, 50)) && (!addOutputToMachineList(tTileEntity, 50)) && (!addDynamoToMachineList(tTileEntity, 50))) {
Block tBlock = aBaseMetaTileEntity.getBlockOffset(xDir + i, h, zDir + j);
byte tMeta = aBaseMetaTileEntity.getMetaIDOffset(xDir + i, h, zDir + j);
if (((tBlock != GregTech_API.sBlockCasings4) || (tMeta != 2))) {
return false;
}
tAmount++;
}
}
}
}
}
return tAmount >= 16;
}
public Block getCasingBlock() {
return GregTech_API.sBlockCasings4;
}
public byte getCasingMeta() {
return 2;
}
public byte getCasingTextureIndex() {
return 50;
}
public Block getPipeBlock() {
return GregTech_API.sBlockCasings2;
}
public byte getPipeMeta() {
return 14;
}
public int getMaxEfficiency(ItemStack aStack) {
return hasOxygen ? 14500 : 10000;
}
public int getPollutionPerTick(ItemStack aStack) {
return 0;
}
public int getDamageToComponent(ItemStack aStack) {
return 0;
}
public int getAmountOfOutputs() {
return 1;
}
public boolean explodesOnComponentBreak(ItemStack aStack) {
return false;
}
public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) {
return new GT_MetaTileEntity_LargeDieselEngine(this.mName);
}
@Override
public String[] getInfoData() {
return new String[]{
"Large Diesel Engine",
"Efficiency: " + (float) mEfficiency / 100 + "%",
"EfficiencyRaw: " + mEfficiency,
"Current Output: " + mEUt + " EU/t"
};
}
}

View file

@ -523,6 +523,9 @@ public class GT_Loader_MetaTileEntities
GT_ModHandler.addCraftingRecipe(ItemList.Locker_ZPM.get(1L, new Object[0]), GT_ModHandler.RecipeBits.DISMANTLEABLE | GT_ModHandler.RecipeBits.NOT_REMOVABLE | GT_ModHandler.RecipeBits.REVERSIBLE | GT_ModHandler.RecipeBits.BUFFERED, new Object[]{"T", "M", Character.valueOf('M'), ItemList.Battery_Buffer_2by2_ZPM, Character.valueOf('T'), OreDictNames.craftingChest});
GT_ModHandler.addCraftingRecipe(ItemList.Locker_UV.get(1L, new Object[0]), GT_ModHandler.RecipeBits.DISMANTLEABLE | GT_ModHandler.RecipeBits.NOT_REMOVABLE | GT_ModHandler.RecipeBits.REVERSIBLE | GT_ModHandler.RecipeBits.BUFFERED, new Object[]{"T", "M", Character.valueOf('M'), ItemList.Battery_Buffer_2by2_UV, Character.valueOf('T'), OreDictNames.craftingChest});
GT_ModHandler.addCraftingRecipe(ItemList.Locker_MAX.get(1L, new Object[0]), GT_ModHandler.RecipeBits.DISMANTLEABLE | GT_ModHandler.RecipeBits.NOT_REMOVABLE | GT_ModHandler.RecipeBits.REVERSIBLE | GT_ModHandler.RecipeBits.BUFFERED, new Object[]{"T", "M", Character.valueOf('M'), ItemList.Battery_Buffer_2by2_MAX, Character.valueOf('T'), OreDictNames.craftingChest});
ItemList.Hatch_Turbo.set(new GT_MetaTileEntity_Hatch_Turbo(700, "hatch.turbo", "Turbo Hatch", 1).getStackForm(1L));
GT_ModHandler.addCraftingRecipe(ItemList.Hatch_Turbo.get(1L, new Object[0]), GT_ModHandler.RecipeBits.DISMANTLEABLE | GT_ModHandler.RecipeBits.NOT_REMOVABLE | GT_ModHandler.RecipeBits.REVERSIBLE | GT_ModHandler.RecipeBits.BUFFERED, new Object[]{"dwx", "hMc", "fsr", Character.valueOf('M'), ItemList.Hull_LV});
}
private static void run2() {
@ -1033,8 +1036,11 @@ public class GT_Loader_MetaTileEntities
ItemList.Machine_Multi_Assemblyline.set(new GT_MetaTileEntity_AssemblyLine(1170, "multimachine.assemblyline", "Assemblyline").getStackForm(1L));
GT_ModHandler.addCraftingRecipe(ItemList.Machine_Multi_Assemblyline.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_LargeDieselEngine.set(new GT_MetaTileEntity_LargeDieselEngine(1171, "multimachine.dieselengine", "Large Diesel Engine").getStackForm(1L));
GT_ModHandler.addCraftingRecipe(ItemList.Machine_Multi_LargeDieselEngine.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_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() {

Binary file not shown.

After

Width:  |  Height:  |  Size: 610 B