package miscutil.gregtech.common.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_MultiBlockBase; import gregtech.api.objects.GT_RenderedTexture; import gregtech.api.util.GT_ModHandler; import gregtech.api.util.GT_Recipe; import gregtech.api.util.GT_Utility; import java.util.ArrayList; import miscutil.gregtech.api.util.GregtechRecipe; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.item.ItemStack; import net.minecraftforge.common.util.ForgeDirection; public class GregtechMetaTileEntityIndustrialCokeOven extends GT_MetaTileEntity_MultiBlockBase { private int mLevel = 0; public GregtechMetaTileEntityIndustrialCokeOven(int aID, String aName, String aNameRegional) { super(aID, aName, aNameRegional); } public GregtechMetaTileEntityIndustrialCokeOven(String aName) { super(aName); } public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { return new GregtechMetaTileEntityIndustrialCokeOven(this.mName); } public String[] getDescription() { return new String[]{"Smelts up to 6-18 Items at once", "Controller Block for the Multi Smelter", "Size: 3x3x3 (Hollow)", "Controller (front middle at bottom)", "8x Heating Coils (middle Layer, hollow)", "1x Input (one of bottom)", "1x Output (one of bottom)", "1x Energy Hatch (one of bottom)", "1x Maintenance Hatch (one of bottom)", "1x Muffler Hatch (top middle)", "Heat Proof Machine Casings for the rest"}; } 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[11], new GT_RenderedTexture(aActive ? Textures.BlockIcons.OVERLAY_FRONT_MULTI_SMELTER_ACTIVE : Textures.BlockIcons.OVERLAY_FRONT_MULTI_SMELTER)}; } return new ITexture[]{Textures.BlockIcons.CASING_BLOCKS[11]}; } public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { return new GT_GUIContainer_MultiMachine(aPlayerInventory, aBaseMetaTileEntity, getLocalName(), "MultiFurnace.png"); } public GT_Recipe.GT_Recipe_Map getRecipeMap() { return GregtechRecipe.Gregtech_Recipe_Map.sCokeOvenRecipes; } public boolean isCorrectMachinePart(ItemStack aStack) { return true; } public boolean isFacingValid(byte aFacing) { return aFacing > 1; } public boolean checkRecipe(ItemStack aStack) { ArrayList tInputList = getStoredInputs(); if (!tInputList.isEmpty()) { byte tTier = (byte) Math.max(1, GT_Utility.getTier(getMaxInputVoltage())); int j = 0; this.mOutputItems = new ItemStack[6 * this.mLevel]; for (int i = 0; (i < 100) && (j < this.mOutputItems.length); i++) { if (null != (this.mOutputItems[j] = GT_ModHandler.getSmeltingOutput((ItemStack) tInputList.get(i % tInputList.size()), true, null))) { j++; } } if (j > 0) { this.mEfficiency = (10000 - (getIdealStatus() - getRepairStatus()) * 1000); this.mEfficiencyIncrease = 10000; this.mEUt = (-4 * (1 << tTier - 1) * (1 << tTier - 1) * this.mLevel); this.mMaxProgresstime = Math.max(1, 512 / (1 << tTier - 1)); } updateSlots(); 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; this.mLevel = 0; if (!aBaseMetaTileEntity.getAirOffset(xDir, 1, zDir)) { return false; } addMufflerToMachineList(aBaseMetaTileEntity.getIGregTechTileEntityOffset(xDir, 2, zDir), 11); byte tUsedMeta = aBaseMetaTileEntity.getMetaIDOffset(xDir + 1, 1, zDir); switch (tUsedMeta) { case 12: this.mLevel = 1; break; case 13: this.mLevel = 2; break; case 14: this.mLevel = 3; break; default: return false; } for (int i = -1; i < 2; i++) { for (int j = -1; j < 2; j++) { if ((i != 0) || (j != 0)) { if (aBaseMetaTileEntity.getBlockOffset(xDir + i, 1, zDir + j) != GregTech_API.sBlockCasings1) { return false; } if (aBaseMetaTileEntity.getMetaIDOffset(xDir + i, 1, zDir + j) != tUsedMeta) { return false; } if (aBaseMetaTileEntity.getBlockOffset(xDir + i, 2, zDir + j) != GregTech_API.sBlockCasings1) { return false; } if (aBaseMetaTileEntity.getMetaIDOffset(xDir + i, 2, zDir + j) != 11) { return false; } } } } for (int i = -1; i < 2; i++) { for (int j = -1; j < 2; j++) { if ((xDir + i != 0) || (zDir + j != 0)) { IGregTechTileEntity tTileEntity = aBaseMetaTileEntity.getIGregTechTileEntityOffset(xDir + i, 0, zDir + j); if ((!addMaintenanceToMachineList(tTileEntity, 11)) && (!addInputToMachineList(tTileEntity, 11)) && (!addOutputToMachineList(tTileEntity, 11)) && (!addEnergyInputToMachineList(tTileEntity, 11))) { if (aBaseMetaTileEntity.getBlockOffset(xDir + i, 0, zDir + j) != GregTech_API.sBlockCasings1) { return false; } if (aBaseMetaTileEntity.getMetaIDOffset(xDir + i, 0, zDir + j) != 11) { return false; } } } } } return true; } public int getMaxEfficiency(ItemStack aStack) { return 10000; } public int getPollutionPerTick(ItemStack aStack) { return 20; } public int getDamageToComponent(ItemStack aStack) { return 0; } public int getAmountOfOutputs() { return 18; } public boolean explodesOnComponentBreak(ItemStack aStack) { return false; } }