diff options
Diffstat (limited to 'src/main/java/gregtech/common/tileentities')
-rw-r--r-- | src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_LargeDieselGenerator.java | 192 |
1 files changed, 192 insertions, 0 deletions
diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_LargeDieselGenerator.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_LargeDieselGenerator.java new file mode 100644 index 0000000000..1b8919f6f2 --- /dev/null +++ b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_LargeDieselGenerator.java @@ -0,0 +1,192 @@ +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_Hatch_Input; +import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Output; +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.FluidStack; + +import java.util.ArrayList; +import java.util.Collection; + +public class GT_MetaTileEntity_LargeDieselGenerator extends GT_MetaTileEntity_MultiBlockBase { + + private static boolean controller; + public GT_MetaTileEntity_Hatch_Input mInputHotFluidHatch; + public GT_MetaTileEntity_Hatch_Output mOutputColdFluidHatch; + public boolean superheated = false; + private float water; + + public GT_MetaTileEntity_LargeDieselGenerator(int aID, String aName, String aNameRegional) { + super(aID, aName, aNameRegional); + } + public GT_MetaTileEntity_LargeDieselGenerator(String aName) { + super(aName); + } + + public String[] getDescription() { + return new String[]{ + "Controller Block for the Heat Exchanger", + "Size: 3x3x4", + "Controller (front middle at bottom)", + "3x3x4 of Stable Titanium Casing (hollow, Min 24!)", + "2 Titanium Pipe Casing Blocks inside the Hollow Casing", + "1x Distillated Water Input (one of the Casings)", + "min 1 Steam Output (one of the Casings)", + "1x Maintenance Hatch (one of the Casings)", + "1x Hot Fluid Input (botton Center)", + "1x Cold Fluid Output (top Center)"}; + } + + 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(), "LargeHeatExchanger.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; + + boolean hasLubricant = false; + int baseEUt = 4096; + + if(tFluids.size() > 0 && tRecipeList != null) { + for (FluidStack hatchFluid : tFluids) { + if(hatchFluid.isFluidEqual(Materials.Lubricant.getFluid(1L))) { + hasLubricant = true; + } + } + for (FluidStack hatchFluid : 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 (hatchFluid.isFluidEqual(tLiquid) && hasLubricant) { + tLiquid.amount = 5; + depleteInput(tLiquid); + depleteInput(Materials.Lubricant.getFluid(1L)); + this.mProgresstime = 1; + this.mMaxProgresstime = 1; + this.mEfficiencyIncrease = 5; + this.mEUt = (2048 * (aFuel.mSpecialValue / 100) * getCasingMulti()) * (mEfficiency / 1000); + System.out.println("Eff Value: " + mEfficiency); + System.out.println("Fuel Value: " + aFuel.mSpecialValue); + System.out.println("EU/t : " + mEUt); + return true; + } + } + } + } + } + return false; + } + + public boolean checkMachine(IGregTechTileEntity aBaseMetaTileEntity, ItemStack aStack) { + int xDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetX; + int zDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetZ; + if (!aBaseMetaTileEntity.getAirOffset(xDir, 0, zDir)) { + 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)) && (!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 int getCasingMulti() { + return 2; + } + + 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 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_LargeDieselGenerator(this.mName); + } + + @Override + public String[] getInfoData() { + return new String[]{ + "Diesel Engine", + "Current Output: " + mEUt + " EU/t" + }; + } +} |