diff options
Diffstat (limited to 'src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi')
13 files changed, 2515 insertions, 2966 deletions
diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMTE_NuclearReactor.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMTE_NuclearReactor.java index 102b79111f..4f893cc556 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMTE_NuclearReactor.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMTE_NuclearReactor.java @@ -1,126 +1,200 @@ package gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi; -import java.util.ArrayList; -import java.util.Arrays; - -import org.apache.commons.lang3.ArrayUtils; - 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.metatileentity.implementations.GT_MetaTileEntity_MultiBlockBase; import gregtech.api.objects.GT_RenderedTexture; -import gregtech.api.util.*; +import gregtech.api.util.GT_Config; +import gregtech.api.util.GT_Recipe; +import gregtech.api.util.GT_Utility; +import gregtech.api.util.Recipe_GT; import gtPlusPlus.core.block.ModBlocks; import gtPlusPlus.core.lib.CORE; import gtPlusPlus.core.util.Utils; import gtPlusPlus.core.util.item.ItemUtils; import gtPlusPlus.xmod.gregtech.api.gui.GUI_MultiMachine; + +import java.util.ArrayList; +import java.util.Arrays; + 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 org.apache.commons.lang3.ArrayUtils; + public class GregtechMTE_NuclearReactor extends GT_MetaTileEntity_MultiBlockBase { - public static int sUUAperUUM = 1; - public static int sUUASpeedBonus = 4; - public static int sDurationMultiplier = 3215; - public static boolean sRequiresUUA = false; - private static Block IC2Glass = Block.getBlockFromItem(ItemUtils.getItem("IC2:blockAlloyGlass")); - // public FluidStack mFluidOut = Materials.UUMatter.getFluid(1L); - private int recipeCounter = 0; + public static int sUUAperUUM = 1; + public static int sUUASpeedBonus = 4; + public static int sDurationMultiplier = 3215; + public static boolean sRequiresUUA = false; + private int recipeCounter = 0; + private static Block IC2Glass = Block.getBlockFromItem(ItemUtils.getItem("IC2:blockAlloyGlass")); + //public FluidStack mFluidOut = Materials.UUMatter.getFluid(1L); - public GregtechMTE_NuclearReactor(final int aID, final String aName, final String aNameRegional) { + public GregtechMTE_NuclearReactor(int aID, String aName, String aNameRegional) { super(aID, aName, aNameRegional); } - public GregtechMTE_NuclearReactor(final String aName) { + public GregtechMTE_NuclearReactor(String aName) { super(aName); } @Override - public boolean checkMachine(final IGregTechTileEntity aBaseMetaTileEntity, final ItemStack aStack) { - final int xDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetX * 2; - final int zDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetZ * 2; - for (int i = -3; i < 3; i++) { + public String[] getDescription() { + return new String[]{ + "Controller Block for the Nuclear Reactor", + "Produces heat from Radioactive beta decay.", + "Size(WxHxD): 5x4x5, Controller (Bottom center)", + "3x1x3 Matter Generation Coils (Inside bottom 5x1x5 layer)", + "9x Matter Generation Coils (Centered 3x1x3 area in Bottom layer)", + "1x Input Hatch (Any bottom layer casing)", + "1x Output Hatch (Any bottom layer casing)", + "1x Maintenance Hatch (Any bottom layer casing)", + "1x Muffler Hatch (Centered 3x1x3 area in Top layer)", + "1x Energy Hatch (Any bottom layer casing)", + "24x IC2 Reinforced Glass for the walls", + "Matter Fabricator Casings for the edges & top (40 at least!)", + CORE.GT_Tooltip}; + } + + @Override + 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[66], + new GT_RenderedTexture(aActive ? Textures.BlockIcons.OVERLAY_FRONT_LARGE_BOILER_ACTIVE : Textures.BlockIcons.OVERLAY_FRONT_LARGE_BOILER)}; + } + return new ITexture[]{Textures.BlockIcons.CASING_BLOCKS[66]}; + } + + @Override + public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { + return new GUI_MultiMachine(aPlayerInventory, aBaseMetaTileEntity, getLocalName(), "MatterFabricator.png"); + } + + @Override + public void onConfigLoad(GT_Config aConfig) { + } + + @Override + public boolean checkRecipe(ItemStack aStack) { + ArrayList<FluidStack> tFluidList = getStoredFluids(); + for (int i = 0; i < tFluidList.size() - 1; i++) { + for (int j = i + 1; j < tFluidList.size(); j++) { + if (GT_Utility.areFluidsEqual((FluidStack) tFluidList.get(i), (FluidStack) tFluidList.get(j))) { + if (((FluidStack) tFluidList.get(i)).amount >= ((FluidStack) tFluidList.get(j)).amount) { + tFluidList.remove(j--); + } else { + tFluidList.remove(i--); + break; + } + } + } + } + + long tVoltage = getMaxInputVoltage(); + byte tTier = (byte) Math.max(1, GT_Utility.getTier(tVoltage)); + FluidStack[] tFluids = (FluidStack[]) Arrays.copyOfRange(tFluidList.toArray(new FluidStack[tFluidList.size()]), 0, tFluidList.size()); + if (tFluids.length > 0) { + for(int i = 0;i<tFluids.length;i++){ + GT_Recipe tRecipe = Recipe_GT.Gregtech_Recipe_Map.sMatterFab2Recipes.findRecipe(getBaseMetaTileEntity(), false, gregtech.api.enums.GT_Values.V[tTier], new FluidStack[]{tFluids[i]}, new ItemStack[]{}); + if (tRecipe != null) { + if (tRecipe.isRecipeInputEqual(true, tFluids, new ItemStack[]{})) { + this.mEfficiency = (10000 - (getIdealStatus() - getRepairStatus()) * 1000); + this.mEfficiencyIncrease = 10000; + if (tRecipe.mEUt <= 16) { + this.mEUt = (tRecipe.mEUt * (1 << tTier - 1) * (1 << tTier - 1)); + this.mMaxProgresstime = ((tRecipe.mDuration/**sDurationMultiplier*/) / (1 << tTier - 1)); + } else { + this.mEUt = tRecipe.mEUt; + this.mMaxProgresstime = (tRecipe.mDuration/**sDurationMultiplier*/); + while (this.mEUt <= gregtech.api.enums.GT_Values.V[(tTier - 1)]) { + this.mEUt *= 4; + this.mMaxProgresstime /= 2; + } + } + if (this.mEUt > 0) { + this.mEUt = (-this.mEUt); + } + this.mMaxProgresstime = Math.max(1, this.mMaxProgresstime); + this.mOutputItems = new ItemStack[]{tRecipe.getOutput(0)}; + this.mOutputFluids = tRecipe.mFluidOutputs.clone(); + ArrayUtils.reverse(mOutputFluids); + recipeCounter++; + updateSlots(); + //Utils.LOG_INFO("Recipes Finished: "+recipeCounter); + return true; + } + } + else { + Utils.LOG_INFO("Invalid Recipe"); + } + } + } + return false; + } + + @Override + public boolean checkMachine(IGregTechTileEntity aBaseMetaTileEntity, ItemStack aStack) { + int xDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetX * 2; + int zDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetZ * 2; + for (int i = -3; i < 4; i++) { for (int j = -3; j < 4; j++) { - for (int h = 0; h < 3; h++) { - final IGregTechTileEntity tTileEntity = aBaseMetaTileEntity.getIGregTechTileEntityOffset(xDir + i, - h, zDir + j); + for (int h = 0; h < 4; h++) { + IGregTechTileEntity tTileEntity = aBaseMetaTileEntity.getIGregTechTileEntityOffset(xDir + i, h, zDir + j); - if (i != -3 && i != 3 && j != -3 && j != 3) {// Reactor - // Floor/Roof - // inner 7x7 - if (h == 0 || h == 4) {// Reactor Floor & Roof (Inner - // 7x7) + muffler x4 - if (!this.addMufflerToMachineList(tTileEntity, 66)) { - if (aBaseMetaTileEntity.getBlockOffset(xDir + i, h, - zDir + j) != ModBlocks.blockCasingsMisc) { - Utils.LOG_INFO( - "Reactor Casings Missing from one of the top layers inner 3x3."); + if ((i != -3 && i != 3) && (j != -3 && j != 3)) {// Reactor Floor/Roof inner 7x7 + if (h == 0 || h == 4) {// Reactor Floor & Roof (Inner 7x7) + muffler x4 + if ((!addMufflerToMachineList(tTileEntity, 66))) { + if (aBaseMetaTileEntity.getBlockOffset(xDir + i, h, zDir + j) != ModBlocks.blockCasingsMisc) { + Utils.LOG_INFO("Matter Fabricator Casings Missing from one of the top layers inner 3x3."); return false; } if (aBaseMetaTileEntity.getMetaIDOffset(xDir + i, h, zDir + j) != 12) { - Utils.LOG_INFO( - "Reactor Casings Missing from one of the top layers inner 3x3."); + Utils.LOG_INFO("Matter Fabricator Casings Missing from one of the top layers inner 3x3."); return false; } } - } - else {// Inside 6 layers, mostly air - if (i != -1 && i != 1 && j != -1 && j != 1) {// Reactor - // Floor/Roof - // inner - // 5x5 + } else {// Inside 6 layers, mostly air + if ((i != -1 && i != 1) && (j != -1 && j != 1)) {// Reactor Floor/Roof inner 5x5 if (!aBaseMetaTileEntity.getAirOffset(xDir + i, h, zDir + j)) { Utils.LOG_INFO("Make sure the inner 3x3 of the Multiblock is Air."); return false; } } - else { // carbon moderation rods are at 1,1 & -1,-1 - // & 1,-1 & -1,1 - if (aBaseMetaTileEntity.getBlockOffset(xDir + i, h, - zDir + j) != ModBlocks.blockCasingsMisc) { - Utils.LOG_INFO( - "Reactor Casings Missing from one of the top layers inner 3x3."); + else { //carbon moderation rods are at 1,1 & -1,-1 & 1,-1 & -1,1 + if (aBaseMetaTileEntity.getBlockOffset(xDir + i, h, zDir + j) != ModBlocks.blockCasingsMisc) { + Utils.LOG_INFO("Matter Fabricator Casings Missing from one of the top layers inner 3x3."); return false; } if (aBaseMetaTileEntity.getMetaIDOffset(xDir + i, h, zDir + j) != 12) { - Utils.LOG_INFO( - "Reactor Casings Missing from one of the top layers inner 3x3."); + Utils.LOG_INFO("Matter Fabricator Casings Missing from one of the top layers inner 3x3."); return false; } - } + } } } // End Inner Workings else {// Reactor Exterior if (h == 1) { - if ((i == -3 || i == 3) && (j == -3 || j == 3)) { - if (aBaseMetaTileEntity.getBlockOffset(xDir + i, h, - zDir + j) != ModBlocks.blockCasingsMisc) { - Block temp = aBaseMetaTileEntity.getBlockOffset(xDir + i, h, zDir + j); - Utils.LOG_INFO( - "Reactor Casings Missing from one of the corners in the second layer. Block: "+temp.getLocalizedName() - +" x:"+(aBaseMetaTileEntity.getXCoord()+xDir+i) - +" y:"+(aBaseMetaTileEntity.getYCoord()+h) - +" z:"+(aBaseMetaTileEntity.getZCoord()+zDir+j) - ); + if ((i == -3 || i == 3) && (j == -3 || j == 3)){ + if (aBaseMetaTileEntity.getBlockOffset(xDir + i, h, zDir + j) != ModBlocks.blockCasingsMisc) { + Utils.LOG_INFO("Matter Fabricator Casings Missing from one of the corners in the second layer."); return false; } if (aBaseMetaTileEntity.getMetaIDOffset(xDir + i, h, zDir + j) != 12) { - Utils.LOG_INFO( - "Reactor Casings Missing from one of the corners in the second layer. Meta"); + Utils.LOG_INFO("Matter Fabricator Casings Missing from one of the corners in the second layer."); return false; } } - else if ((i != -3 || i != 3) && (j != -3 || j != 3)) { - if (aBaseMetaTileEntity.getBlockOffset(xDir + i, h, - zDir + j) != ModBlocks.blockCasingsMisc) { + else if ((i != -3 || i != 3) && (j != -3 || j != 3)){ + if (aBaseMetaTileEntity.getBlockOffset(xDir + i, h, zDir + j) != ModBlocks.blockCasingsMisc) { Utils.LOG_INFO("Glass Casings Missing from somewhere in the second layer."); return false; } @@ -131,23 +205,19 @@ public class GregtechMTE_NuclearReactor extends GT_MetaTileEntity_MultiBlockBase } } if (h == 2) { - if ((i == -3 || i == 3) && (j == -3 || j == 3)) { - if (aBaseMetaTileEntity.getBlockOffset(xDir + i, h, - zDir + j) != ModBlocks.blockCasingsMisc) { - Utils.LOG_INFO( - "Reactor Casings Missing from one of the corners in the third layer."); + if ((i == -3 || i == 3) && (j == -3 || j == 3)){ + if (aBaseMetaTileEntity.getBlockOffset(xDir + i, h, zDir + j) != ModBlocks.blockCasingsMisc) { + Utils.LOG_INFO("Matter Fabricator Casings Missing from one of the corners in the third layer."); return false; } if (aBaseMetaTileEntity.getMetaIDOffset(xDir + i, h, zDir + j) != 12) { - Utils.LOG_INFO( - "Reactor Casings Missing from one of the corners in the third layer."); + Utils.LOG_INFO("Matter Fabricator Casings Missing from one of the corners in the third layer."); return false; } } - else if ((i != -3 || i != 3) && (j != -3 || j != 3)) { - if (aBaseMetaTileEntity.getBlockOffset(xDir + i, h, - zDir + j) != ModBlocks.blockCasingsMisc) { + else if ((i != -3 || i != 3) && (j != -3 || j != 3)){ + if (aBaseMetaTileEntity.getBlockOffset(xDir + i, h, zDir + j) != ModBlocks.blockCasingsMisc) { Utils.LOG_INFO("Glass Casings Missing from somewhere in the second layer."); return false; } @@ -158,15 +228,12 @@ public class GregtechMTE_NuclearReactor extends GT_MetaTileEntity_MultiBlockBase } } if (h == 3) { - if (aBaseMetaTileEntity.getBlockOffset(xDir + i, h, - zDir + j) != ModBlocks.blockCasingsMisc) { - Utils.LOG_INFO( - "Reactor Casings Missing from one of the edges on the top layer."); + if (aBaseMetaTileEntity.getBlockOffset(xDir + i, h, zDir + j) != ModBlocks.blockCasingsMisc) { + Utils.LOG_INFO("Matter Fabricator Casings Missing from one of the edges on the top layer."); return false; } if (aBaseMetaTileEntity.getMetaIDOffset(xDir + i, h, zDir + j) != 12) { - Utils.LOG_INFO( - "Reactor Casings Missing from one of the edges on the top layer."); + Utils.LOG_INFO("Matter Fabricator Casings Missing from one of the edges on the top layer."); return false; } } @@ -181,143 +248,38 @@ public class GregtechMTE_NuclearReactor extends GT_MetaTileEntity_MultiBlockBase } @Override - public boolean checkRecipe(final ItemStack aStack) { - final ArrayList<FluidStack> tFluidList = this.getStoredFluids(); - for (int i = 0; i < tFluidList.size() - 1; i++) { - for (int j = i + 1; j < tFluidList.size(); j++) { - if (GT_Utility.areFluidsEqual(tFluidList.get(i), tFluidList.get(j))) { - if (tFluidList.get(i).amount >= tFluidList.get(j).amount) { - tFluidList.remove(j--); - } - else { - tFluidList.remove(i--); - break; - } - } - } - } - - final long tVoltage = this.getMaxInputVoltage(); - final byte tTier = (byte) Math.max(1, GT_Utility.getTier(tVoltage)); - final FluidStack[] tFluids = Arrays.copyOfRange(tFluidList.toArray(new FluidStack[tFluidList.size()]), 0, - tFluidList.size()); - if (tFluids.length > 0) { - for (int i = 0; i < tFluids.length; i++) { - final GT_Recipe tRecipe = Recipe_GT.Gregtech_Recipe_Map.sMatterFab2Recipes.findRecipe( - this.getBaseMetaTileEntity(), false, gregtech.api.enums.GT_Values.V[tTier], new FluidStack[] { - tFluids[i] - }, new ItemStack[] {}); - if (tRecipe != null) { - if (tRecipe.isRecipeInputEqual(true, tFluids, new ItemStack[] {})) { - this.mEfficiency = 10000 - (this.getIdealStatus() - this.getRepairStatus()) * 1000; - this.mEfficiencyIncrease = 10000; - if (tRecipe.mEUt <= 16) { - this.mEUt = tRecipe.mEUt * (1 << tTier - 1) * (1 << tTier - 1); - this.mMaxProgresstime = tRecipe.mDuration / (1 << tTier - 1); - } - else { - this.mEUt = tRecipe.mEUt; - this.mMaxProgresstime = tRecipe.mDuration; - while (this.mEUt <= gregtech.api.enums.GT_Values.V[tTier - 1]) { - this.mEUt *= 4; - this.mMaxProgresstime /= 2; - } - } - if (this.mEUt > 0) { - this.mEUt = -this.mEUt; - } - this.mMaxProgresstime = Math.max(1, this.mMaxProgresstime); - this.mOutputItems = new ItemStack[] { - tRecipe.getOutput(0) - }; - this.mOutputFluids = tRecipe.mFluidOutputs.clone(); - ArrayUtils.reverse(this.mOutputFluids); - this.recipeCounter++; - this.updateSlots(); - // Utils.LOG_INFO("Recipes Finished: "+recipeCounter); - return true; - } - } - else { - Utils.LOG_INFO("Invalid Recipe"); - } - } - } - return false; - } - - @Override - public boolean explodesOnComponentBreak(final ItemStack aStack) { - return false; - } - - @Override - public int getAmountOfOutputs() { - return 1; + public boolean isCorrectMachinePart(ItemStack aStack) { + return true; } @Override - public Object getClientGUI(final int aID, final InventoryPlayer aPlayerInventory, - final IGregTechTileEntity aBaseMetaTileEntity) { - return new GUI_MultiMachine(aPlayerInventory, aBaseMetaTileEntity, this.getLocalName(), "MatterFabricator.png"); + public int getMaxEfficiency(ItemStack aStack) { + return 10000; } @Override - public int getDamageToComponent(final ItemStack aStack) { + public int getPollutionPerTick(ItemStack aStack) { return 0; } @Override - public String[] getDescription() { - return new String[] { - "Controller Block for the Nuclear Reactor", "Produces heat from Radioactive beta decay.", - "Size(WxHxD): 5x4x5, Controller (Bottom center)", - "3x1x3 Matter Generation Coils (Inside bottom 5x1x5 layer)", - "9x Matter Generation Coils (Centered 3x1x3 area in Bottom layer)", - "1x Input Hatch (Any bottom layer casing)", "1x Output Hatch (Any bottom layer casing)", - "1x Maintenance Hatch (Any bottom layer casing)", "1x Muffler Hatch (Centered 3x1x3 area in Top layer)", - "1x Energy Hatch (Any bottom layer casing)", "24x IC2 Reinforced Glass for the walls", - "Reactor Casings for the edges, bottom & top (40 at least!)", CORE.GT_Tooltip - }; - } - - @Override - public int getMaxEfficiency(final ItemStack aStack) { - return 10000; - } - - @Override - public int getPollutionPerTick(final ItemStack aStack) { + public int getDamageToComponent(ItemStack aStack) { return 0; } @Override - public ITexture[] getTexture(final IGregTechTileEntity aBaseMetaTileEntity, final byte aSide, final byte aFacing, - final byte aColorIndex, final boolean aActive, final boolean aRedstone) { - if (aSide == aFacing) { - return new ITexture[] { - Textures.BlockIcons.CASING_BLOCKS[66], - new GT_RenderedTexture(aActive ? Textures.BlockIcons.OVERLAY_FRONT_LARGE_BOILER_ACTIVE - : Textures.BlockIcons.OVERLAY_FRONT_LARGE_BOILER) - }; - } - return new ITexture[] { - Textures.BlockIcons.CASING_BLOCKS[66] - }; + public int getAmountOfOutputs() { + return 1; } @Override - public boolean isCorrectMachinePart(final ItemStack aStack) { - return true; + public boolean explodesOnComponentBreak(ItemStack aStack) { + return false; } @Override - public IMetaTileEntity newMetaEntity(final IGregTechTileEntity aTileEntity) { + public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { return new GregtechMTE_NuclearReactor(this.mName); } - @Override - public void onConfigLoad(final GT_Config aConfig) { - } - }
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_AlloyBlastSmelter.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_AlloyBlastSmelter.java index 2d9512ce2f..bb7327857a 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_AlloyBlastSmelter.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_AlloyBlastSmelter.java @@ -1,8 +1,5 @@ package gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi; -import java.util.ArrayList; -import java.util.Arrays; - import gregtech.api.enums.Textures; import gregtech.api.gui.GT_GUIContainer_MultiMachine; import gregtech.api.interfaces.ITexture; @@ -10,242 +7,226 @@ 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.*; +import gregtech.api.util.GT_Recipe; +import gregtech.api.util.GT_Utility; +import gregtech.api.util.Recipe_GT; import gtPlusPlus.core.block.ModBlocks; import gtPlusPlus.core.util.Utils; + +import java.util.ArrayList; +import java.util.Arrays; + import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.item.ItemStack; import net.minecraftforge.common.util.ForgeDirection; import net.minecraftforge.fluids.FluidStack; -public class GregtechMetaTileEntity_AlloyBlastSmelter extends GT_MetaTileEntity_MultiBlockBase { - private int mHeatingCapacity = 0; - - public GregtechMetaTileEntity_AlloyBlastSmelter(final int aID, final String aName, final String aNameRegional) { - super(aID, aName, aNameRegional); - } - - public GregtechMetaTileEntity_AlloyBlastSmelter(final String aName) { - super(aName); - } - - @Override - public boolean checkMachine(final IGregTechTileEntity aBaseMetaTileEntity, final ItemStack aStack) { - final int xDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetX; - final int zDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetZ; - - // this.mHeatingCapacity = 0; - if (!aBaseMetaTileEntity.getAirOffset(xDir, 1, zDir)) { - return false; - } - if (!aBaseMetaTileEntity.getAirOffset(xDir, 2, zDir)) { - return false; - } - this.addMufflerToMachineList(aBaseMetaTileEntity.getIGregTechTileEntityOffset(xDir, 3, zDir), 72); - - final byte tUsedMeta = aBaseMetaTileEntity.getMetaIDOffset(xDir + 1, 2, zDir); - - this.mHeatingCapacity = 20000; - - for (int i = -1; i < 2; i++) { - for (int j = -1; j < 2; j++) { - if (i != 0 || j != 0) { - if (aBaseMetaTileEntity.getBlockOffset(xDir + i, 2, zDir + j) != ModBlocks.blockCasingsMisc) { - return false; - } - if (aBaseMetaTileEntity.getMetaIDOffset(xDir + i, 2, zDir + j) != 14) { - return false; - } - if (aBaseMetaTileEntity.getBlockOffset(xDir + i, 1, zDir + j) != ModBlocks.blockCasingsMisc) { - return false; - } - if (aBaseMetaTileEntity.getMetaIDOffset(xDir + i, 1, zDir + j) != 14) { - return false; - } - if (aBaseMetaTileEntity.getBlockOffset(xDir + i, 3, zDir + j) != ModBlocks.blockCasingsMisc) { - return false; - } - if (aBaseMetaTileEntity.getMetaIDOffset(xDir + i, 3, zDir + j) != 15) { - return false; - } - } - } - } - for (int i = -1; i < 2; i++) { - for (int j = -1; j < 2; j++) { - if (xDir + i != 0 || zDir + j != 0) { - final IGregTechTileEntity tTileEntity = aBaseMetaTileEntity.getIGregTechTileEntityOffset(xDir + i, - 0, zDir + j); - if (!this.addMaintenanceToMachineList(tTileEntity, 72) - && !this.addInputToMachineList(tTileEntity, 72) - && !this.addOutputToMachineList(tTileEntity, 72) - && !this.addEnergyInputToMachineList(tTileEntity, 72)) { - if (aBaseMetaTileEntity.getBlockOffset(xDir + i, 0, zDir + j) != ModBlocks.blockCasingsMisc) { - return false; - } - if (aBaseMetaTileEntity.getMetaIDOffset(xDir + i, 0, zDir + j) != 15) { - return false; - } - } - } - } - } - this.mHeatingCapacity += 100 * (GT_Utility.getTier(this.getMaxInputVoltage()) - 2); - return true; - } - - @Override - public boolean checkRecipe(final ItemStack aStack) { - final ArrayList<ItemStack> tInputList = this.getStoredInputs(); - for (int i = 0; i < tInputList.size() - 1; i++) { - for (int j = i + 1; j < tInputList.size(); j++) { - if (GT_Utility.areStacksEqual(tInputList.get(i), tInputList.get(j))) { - if (tInputList.get(i).stackSize >= tInputList.get(j).stackSize) { - tInputList.remove(j--); - } - else { - tInputList.remove(i--); - break; - } - } - } - } - final ItemStack[] tInputs = Arrays.copyOfRange(tInputList.toArray(new ItemStack[tInputList.size()]), 0, 2); - - final ArrayList<FluidStack> tFluidList = this.getStoredFluids(); - for (int i = 0; i < tFluidList.size() - 1; i++) { - for (int j = i + 1; j < tFluidList.size(); j++) { - if (GT_Utility.areFluidsEqual(tFluidList.get(i), tFluidList.get(j))) { - if (tFluidList.get(i).amount >= tFluidList.get(j).amount) { - tFluidList.remove(j--); - } - else { - tFluidList.remove(i--); - break; - } - } - } - } - final FluidStack[] tFluids = Arrays.copyOfRange(tFluidList.toArray(new FluidStack[tInputList.size()]), 0, 1); - if (tInputList.size() > 1) { - final long tVoltage = this.getMaxInputVoltage(); - final byte tTier = (byte) Math.max(1, GT_Utility.getTier(tVoltage)); - final GT_Recipe tRecipe = Recipe_GT.Gregtech_Recipe_Map.sAlloyBlastSmelterRecipes.findRecipe( - this.getBaseMetaTileEntity(), false, gregtech.api.enums.GT_Values.V[tTier], tFluids, tInputs); - if (tRecipe != null && this.mHeatingCapacity >= tRecipe.mSpecialValue - && tRecipe.isRecipeInputEqual(true, tFluids, tInputs)) { - Utils.LOG_WARNING("Found some Valid Inputs."); - this.mEfficiency = 10000 - (this.getIdealStatus() - this.getRepairStatus()) * 1000; - this.mEfficiencyIncrease = 10000; - if (tRecipe.mEUt <= 16) { - this.mEUt = tRecipe.mEUt * (1 << tTier - 1) * (1 << tTier - 1); - this.mMaxProgresstime = tRecipe.mDuration / (1 << tTier - 1); - } - else { - this.mEUt = tRecipe.mEUt; - this.mMaxProgresstime = tRecipe.mDuration; - while (this.mEUt <= gregtech.api.enums.GT_Values.V[tTier - 1]) { - this.mEUt *= 4; - this.mMaxProgresstime /= 2; - } - } - if (this.mEUt > 0) { - this.mEUt = -this.mEUt; - } - this.mMaxProgresstime = Math.max(1, this.mMaxProgresstime); - this.mOutputFluids = new FluidStack[] { - tRecipe.getFluidOutput(0) - }; - this.updateSlots(); - return true; - } - } - Utils.LOG_WARNING("Failed to find some Valid Inputs."); - return false; - } - - @Override - public boolean explodesOnComponentBreak(final ItemStack aStack) { - return false; - } - - @Override - public int getAmountOfOutputs() { - return 2; - } - - @Override - public Object getClientGUI(final int aID, final InventoryPlayer aPlayerInventory, - final IGregTechTileEntity aBaseMetaTileEntity) { - return new GT_GUIContainer_MultiMachine(aPlayerInventory, aBaseMetaTileEntity, this.getLocalName(), - "ElectricBlastFurnace.png"); - } - - @Override - public int getDamageToComponent(final ItemStack aStack) { - return 0; - } - - @Override +public class GregtechMetaTileEntity_AlloyBlastSmelter + extends GT_MetaTileEntity_MultiBlockBase { + private int mHeatingCapacity = 0; + + public GregtechMetaTileEntity_AlloyBlastSmelter(int aID, String aName, String aNameRegional) { + super(aID, aName, aNameRegional); + } + + public GregtechMetaTileEntity_AlloyBlastSmelter(String aName) { + super(aName); + } + + @Override + public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { + return new GregtechMetaTileEntity_AlloyBlastSmelter(this.mName); + } + + @Override public String[] getDescription() { - return new String[] { - "Controller Block for the Alloy Blast Smelter", // Outputs 144mb - // fluid for - // every - // inputStack.stackSize; - // Time to use - // those hot - // metals. - "Size: 3x3x4 (Hollow)", "Controller (front middle at bottom)", - "16x Blast Smelter Heat Containment Coils (two middle Layers, hollow)", "1x Input bus (one of bottom)", - "1x Output Hatch (one of bottom)", "1x Energy Hatch (one of bottom)", - "1x Maintenance Hatch (one of bottom)", "1x Muffler Hatch (top middle)", - "Blast Smelter Casings for the rest" - }; - } - - @Override - public int getMaxEfficiency(final ItemStack aStack) { - return 10000; - } - - @Override - public int getPollutionPerTick(final ItemStack aStack) { - return 10; - } - - @Override + return new String[]{ + "Controller Block for the Alloy Blast Smelter", //Outputs 144mb fluid for every inputStack.stackSize; Time to use those hot metals. + "Size: 3x3x4 (Hollow)", + "Controller (front middle at bottom)", + "16x Blast Smelter Heat Containment Coils (two middle Layers, hollow)", + "1x Input bus (one of bottom)", + "1x Output Hatch (one of bottom)", + "1x Energy Hatch (one of bottom)", + "1x Maintenance Hatch (one of bottom)", + "1x Muffler Hatch (top middle)", + "Blast Smelter Casings for the rest"}; + } + + @Override + 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[72], new GT_RenderedTexture(aActive ? Textures.BlockIcons.OVERLAY_FRONT_ELECTRIC_BLAST_FURNACE_ACTIVE : Textures.BlockIcons.OVERLAY_FRONT_ELECTRIC_BLAST_FURNACE)}; + } + return new ITexture[]{Textures.BlockIcons.CASING_BLOCKS[72]}; + } + + @Override + public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { + return new GT_GUIContainer_MultiMachine(aPlayerInventory, aBaseMetaTileEntity, getLocalName(), "ElectricBlastFurnace.png"); + } + + @Override public GT_Recipe.GT_Recipe_Map getRecipeMap() { - return Recipe_GT.Gregtech_Recipe_Map.sAlloyBlastSmelterRecipes; - } - - @Override - public ITexture[] getTexture(final IGregTechTileEntity aBaseMetaTileEntity, final byte aSide, final byte aFacing, - final byte aColorIndex, final boolean aActive, final boolean aRedstone) { - if (aSide == aFacing) { - return new ITexture[] { - Textures.BlockIcons.CASING_BLOCKS[72], - new GT_RenderedTexture(aActive ? Textures.BlockIcons.OVERLAY_FRONT_ELECTRIC_BLAST_FURNACE_ACTIVE - : Textures.BlockIcons.OVERLAY_FRONT_ELECTRIC_BLAST_FURNACE) - }; - } - return new ITexture[] { - Textures.BlockIcons.CASING_BLOCKS[72] - }; - } - - @Override - public boolean isCorrectMachinePart(final ItemStack aStack) { - return true; - } - - @Override - public boolean isFacingValid(final byte aFacing) { - return aFacing > 1; - } - - @Override - public IMetaTileEntity newMetaEntity(final IGregTechTileEntity aTileEntity) { - return new GregtechMetaTileEntity_AlloyBlastSmelter(this.mName); - } + return Recipe_GT.Gregtech_Recipe_Map.sAlloyBlastSmelterRecipes; + } + + @Override + public boolean isCorrectMachinePart(ItemStack aStack) { + return true; + } + + @Override + public boolean isFacingValid(byte aFacing) { + return aFacing > 1; + } + + @Override + public boolean checkRecipe(ItemStack aStack) { + ArrayList<ItemStack> tInputList = getStoredInputs(); + for (int i = 0; i < tInputList.size() - 1; i++) { + for (int j = i + 1; j < tInputList.size(); j++) { + if (GT_Utility.areStacksEqual((ItemStack) tInputList.get(i), (ItemStack) tInputList.get(j))) { + if (((ItemStack) tInputList.get(i)).stackSize >= ((ItemStack) tInputList.get(j)).stackSize) { + tInputList.remove(j--); + } else { + tInputList.remove(i--); + break; + } + } |
