From cbe0e497be8e466c380a5b4fa781b314ede9ada3 Mon Sep 17 00:00:00 2001 From: Draknyte1 Date: Sun, 6 Nov 2016 19:32:27 +1000 Subject: Revert "$ Cleaned up the entire project." This reverts commit 0669f5eb9d5029a8b94ec552171b0837605f7747. # Conflicts: # src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMTE_NuclearReactor.java # src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_MassFabricator.java Revert "% Cleaned up Imports." This reverts commit 3654052fb63a571c5eaca7f20714b87c17f7e966. --- .../machines/multi/GregtechMTE_NuclearReactor.java | 354 +++++----- .../GregtechMetaTileEntity_AlloyBlastSmelter.java | 445 ++++++------ ...regtechMetaTileEntity_IndustrialCentrifuge.java | 360 +++++----- .../GregtechMetaTileEntity_IndustrialCokeOven.java | 486 +++++++------ ...gtechMetaTileEntity_IndustrialElectrolyzer.java | 355 +++++----- ...GregtechMetaTileEntity_IndustrialMacerator.java | 353 +++++----- ...regtechMetaTileEntity_IndustrialPlatePress.java | 290 ++++---- .../GregtechMetaTileEntity_IndustrialSinter.java | 336 ++++----- .../GregtechMetaTileEntity_IndustrialWireMill.java | 294 ++++---- .../GregtechMetaTileEntity_IronBlastFurnace.java | 778 +++++++++------------ .../GregtechMetaTileEntity_MassFabricator.java | 547 +++++++-------- .../multi/GregtechMetaTileEntity_MultiTank.java | 609 ++++++++-------- ...chMetaTileEntity_PowerSubStationController.java | 274 +++----- 13 files changed, 2515 insertions(+), 2966 deletions(-) (limited to 'src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi') 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 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 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 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 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 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 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; + } + } + } + } + ItemStack[] tInputs = (ItemStack[]) Arrays.copyOfRange(tInputList.toArray(new ItemStack[tInputList.size()]), 0, 2); + + ArrayList 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; + } + } + } + } + FluidStack[] tFluids = (FluidStack[]) Arrays.copyOfRange(tFluidList.toArray(new FluidStack[tInputList.size()]), 0, 1); + if (tInputList.size() > 1) { + long tVoltage = getMaxInputVoltage(); + byte tTier = (byte) Math.max(1, GT_Utility.getTier(tVoltage)); + GT_Recipe tRecipe = Recipe_GT.Gregtech_Recipe_Map.sAlloyBlastSmelterRecipes.findRecipe(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 - (getIdealStatus() - 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)}; + updateSlots(); + return true; + } + } + Utils.LOG_WARNING("Failed to find some Valid Inputs."); + return false; + } + + @Override + public boolean checkMachine(IGregTechTileEntity aBaseMetaTileEntity, ItemStack aStack) { + int xDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetX; + 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; + } + addMufflerToMachineList(aBaseMetaTileEntity.getIGregTechTileEntityOffset(xDir, 3, zDir), 72); + + 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)) { + IGregTechTileEntity tTileEntity = aBaseMetaTileEntity.getIGregTechTileEntityOffset(xDir + i, 0, zDir + j); + if ((!addMaintenanceToMachineList(tTileEntity, 72)) && (!addInputToMachineList(tTileEntity, 72)) && (!addOutputToMachineList(tTileEntity, 72)) && (!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(getMaxInputVoltage()) - 2); + return true; + } + + @Override + public int getMaxEfficiency(ItemStack aStack) { + return 10000; + } + + @Override + public int getPollutionPerTick(ItemStack aStack) { + return 10; + } + + @Override + public int getDamageToComponent(ItemStack aStack) { + return 0; + } + + @Override + public int getAmountOfOutputs() { + return 2; + } + + @Override + public boolean explodesOnComponentBreak(ItemStack aStack) { + return false; + } } diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_IndustrialCentrifuge.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_IndustrialCentrifuge.java index db857a782d..0838bdefbd 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_IndustrialCentrifuge.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_IndustrialCentrifuge.java @@ -1,10 +1,5 @@ package gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi; -import java.util.ArrayList; -import java.util.List; - -import org.apache.commons.lang3.ArrayUtils; - import gregtech.api.GregTech_API; import gregtech.api.enums.Textures; import gregtech.api.interfaces.ITexture; @@ -21,137 +16,111 @@ import gtPlusPlus.core.util.Utils; import gtPlusPlus.xmod.gregtech.api.gui.GUI_MultiMachine; import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base.GregtechMeta_MultiBlockBase; import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock.CustomIcon; + +import java.util.ArrayList; +import java.util.List; + 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; -public class GregtechMetaTileEntity_IndustrialCentrifuge extends GregtechMeta_MultiBlockBase { - private static boolean controller; - private static boolean isDisabled = false; - private static ITexture frontFace; - private static ITexture frontFaceActive; - private static CustomIcon GT9_5_Active = new CustomIcon("iconsets/LARGECENTRIFUGE_ACTIVE5"); - private static CustomIcon GT9_5 = new CustomIcon("iconsets/LARGECENTRIFUGE5"); - // public static double recipesComplete = 0; - - ArrayList tInputList = this.getStoredInputs(); +import org.apache.commons.lang3.ArrayUtils; - GT_Recipe mLastRecipe; +public class GregtechMetaTileEntity_IndustrialCentrifuge +extends GregtechMeta_MultiBlockBase { + private static boolean controller; + private static boolean isDisabled = false; + private static ITexture frontFace; + private static ITexture frontFaceActive; + private static CustomIcon GT9_5_Active = new CustomIcon("iconsets/LARGECENTRIFUGE_ACTIVE5"); + private static CustomIcon GT9_5 = new CustomIcon("iconsets/LARGECENTRIFUGE5"); + //public static double recipesComplete = 0; - public GregtechMetaTileEntity_IndustrialCentrifuge(final int aID, final String aName, final String aNameRegional) { + public GregtechMetaTileEntity_IndustrialCentrifuge(int aID, String aName, String aNameRegional) { super(aID, aName, aNameRegional); - GregtechMetaTileEntity_IndustrialCentrifuge.frontFaceActive = new GT_RenderedTexture( - GregtechMetaTileEntity_IndustrialCentrifuge.GT9_5_Active); - GregtechMetaTileEntity_IndustrialCentrifuge.frontFace = new GT_RenderedTexture( - GregtechMetaTileEntity_IndustrialCentrifuge.GT9_5); + frontFaceActive = new GT_RenderedTexture(GT9_5_Active); + frontFace = new GT_RenderedTexture(GT9_5); } - public GregtechMetaTileEntity_IndustrialCentrifuge(final String aName) { + public GregtechMetaTileEntity_IndustrialCentrifuge(String aName) { super(aName); } @Override - public boolean checkMachine(final IGregTechTileEntity aBaseMetaTileEntity, final ItemStack aStack) { - /* - * if (configSwitches.disableCentrifugeFormation){ EntityPlayerMP player - * = - * MinecraftServer.getServer().getConfigurationManager().func_152612_a( - * this.getBaseMetaTileEntity().getOwnerName()); if - * (!player.getEntityWorld().isRemote && isDisabled == false) - * PlayerUtils.messagePlayer(player, - * "This Multiblock is disabled via the config. [Only re-enable if you're bugtesting.]" - * ); isDisabled = true; return false; } - */ - final int xDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetX; - final int yDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetY; - final int zDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetZ; - // Utils.LOG_WARNING("X:"+xDir+" Y:"+yDir+" Z:"+zDir); - if (!aBaseMetaTileEntity.getAirOffset(xDir, 0, zDir)) { - return false; - } - int tAmount = 0; - for (int i = -1; i < 2; i++) { // X-Dir - for (int j = -1; j < 2; j++) { // Z-Dir - for (int h = -1; h < 2; h++) { // Y-Dir - if (h != 0 || (xDir + i != 0 || zDir + j != 0) && (i != 0 || j != 0)) { - - final IGregTechTileEntity tTileEntity = aBaseMetaTileEntity - .getIGregTechTileEntityOffset(xDir + i, h, zDir + j); - // Utils.LOG_WARNING("X:"+tTileEntity.getXCoord()+" - // Y:"+tTileEntity.getYCoord()+" - // Z:"+tTileEntity.getZCoord()); - if (!this.addMaintenanceToMachineList(tTileEntity, 57) - && !this.addInputToMachineList(tTileEntity, 57) - && !this.addOutputToMachineList(tTileEntity, 57) - && !this.addEnergyInputToMachineList(tTileEntity, 57)) { - - // Maintenance Hatch - if (tTileEntity != null && tTileEntity.getMetaTileEntity() != null) { - if (tTileEntity.getXCoord() == aBaseMetaTileEntity.getXCoord() - && tTileEntity.getYCoord() == aBaseMetaTileEntity.getYCoord() - && tTileEntity.getZCoord() == aBaseMetaTileEntity.getZCoord() + 2) { - if (tTileEntity - .getMetaTileEntity() instanceof GT_MetaTileEntity_Hatch_Maintenance) { - Utils.LOG_WARNING("MAINT HATCH IN CORRECT PLACE"); - this.mMaintenanceHatches.add( - (GT_MetaTileEntity_Hatch_Maintenance) tTileEntity.getMetaTileEntity()); - ((GT_MetaTileEntity_Hatch) tTileEntity.getMetaTileEntity()).mMachineBlock = this - .getCasingTextureIndex(); - } - else { - return false; - } - } - else { - Utils.LOG_WARNING("MAINT HATCH IN WRONG PLACE"); - } - } + public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { + return new GregtechMetaTileEntity_IndustrialCentrifuge(this.mName); + } - if (aBaseMetaTileEntity.getBlockOffset(xDir + i, h, - zDir + j) != ModBlocks.blockCasingsMisc) { - return false; - } - if (aBaseMetaTileEntity.getMetaIDOffset(xDir + i, h, zDir + j) != 0) { - return false; - } - tAmount++; + @Override + public String[] getDescription() { + return new String[]{ + "Controller Block for the Industrial Centrifuge", + "Size: 3x3x3 (Hollow)", + "Controller (Front Center) [Orange]", + "1x Maintenance Hatch (Rear Center) [Green]", + "The rest can be placed anywhere except the Front [Red]", + "1x Input Hatch", + "1x Output Hatch", + "1x Input Bus", + "1x Output Bus", + "1x [EV] Energy Hatch (Can be higher Tier) [Blue]", + "Centrifuge Casings for the rest (16 at least)", + CORE.GT_Tooltip}; + } - } - } - } - } - } - return tAmount >= 16; + + + @Override + public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) { + return new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[1][aColorIndex + 1], aFacing == aSide ? aActive ? frontFaceActive : frontFace : Textures.BlockIcons.CASING_BLOCKS[57]}; } + @Override - public boolean checkRecipe(final ItemStack aStack) { - /* - * if (!isCorrectMachinePart(mInventory[1])) { return false; } - */ + public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { + return new GUI_MultiMachine(aPlayerInventory, aBaseMetaTileEntity, getLocalName(), "IndustrialCentrifuge.png"); + } + + @Override + public GT_Recipe.GT_Recipe_Map getRecipeMap() { + return GT_Recipe.GT_Recipe_Map.sCentrifugeRecipes; + } + + @Override + public boolean isFacingValid(byte aFacing) { + return aFacing > 1; + } + + ArrayList tInputList = getStoredInputs(); + GT_Recipe mLastRecipe; + + @Override + public boolean checkRecipe(ItemStack aStack) { + /*if (!isCorrectMachinePart(mInventory[1])) { + return false; + }*/ Utils.LOG_WARNING("Centrifuge Debug - 1"); - final GT_Recipe.GT_Recipe_Map map = this.getRecipeMap(); + GT_Recipe.GT_Recipe_Map map = getRecipeMap(); if (map == null) { Utils.LOG_WARNING("Centrifuge Debug - False - No recipe map"); return false; } Utils.LOG_WARNING("Centrifuge Debug - 2"); - final ArrayList tInputList = this.getStoredInputs(); - final long tVoltage = this.getMaxInputVoltage(); - final byte tTier = (byte) Math.max(1, GT_Utility.getTier(tVoltage)); - Utils.LOG_WARNING("Centrifuge Debug - Tier variable: " + tTier); - final ItemStack[] tInputs = tInputList.toArray(new ItemStack[tInputList.size()]); - final ArrayList tFluidList = this.getStoredFluids(); - final FluidStack[] tFluids = tFluidList.toArray(new FluidStack[tFluidList.size()]); + ArrayList tInputList = getStoredInputs(); + long tVoltage = getMaxInputVoltage(); + byte tTier = (byte) Math.max(1, GT_Utility.getTier(tVoltage)); + Utils.LOG_WARNING("Centrifuge Debug - Tier variable: "+tTier); + ItemStack[] tInputs = (ItemStack[]) tInputList.toArray(new ItemStack[tInputList.size()]); + ArrayList tFluidList = getStoredFluids(); + FluidStack[] tFluids = (FluidStack[]) tFluidList.toArray(new FluidStack[tFluidList.size()]); if (tInputList.size() > 0 || tFluids.length > 0) { - final GT_Recipe tRecipe = map.findRecipe(this.getBaseMetaTileEntity(), this.mLastRecipe, false, - gregtech.api.enums.GT_Values.V[tTier], tFluids, tInputs); + GT_Recipe tRecipe = map.findRecipe(getBaseMetaTileEntity(), mLastRecipe, false, gregtech.api.enums.GT_Values.V[tTier], tFluids, tInputs); if (tRecipe != null) { Utils.LOG_WARNING("Recipe was not invalid"); - this.mLastRecipe = tRecipe; + mLastRecipe = tRecipe; this.mEUt = 0; this.mOutputItems = null; this.mOutputFluids = null; @@ -162,34 +131,29 @@ public class GregtechMetaTileEntity_IndustrialCentrifuge extends GregtechMeta_Mu } this.mMaxProgresstime = tRecipe.mDuration; - this.mEfficiency = 10000 - (this.getIdealStatus() - this.getRepairStatus()) * 1000; + this.mEfficiency = (10000 - (getIdealStatus() - getRepairStatus()) * 1000); this.mEfficiencyIncrease = 10000; - Utils.LOG_WARNING("Centrifuge Debug - 2 - Max Progress Time: " + this.mMaxProgresstime); + Utils.LOG_WARNING("Centrifuge Debug - 2 - Max Progress Time: "+this.mMaxProgresstime); if (tRecipe.mEUt <= 16) { Utils.LOG_WARNING("Centrifuge Debug - Using < 16eu/t"); - this.mEUt = tRecipe.mEUt * (1 << tTier - 1) * (1 << tTier - 1); - this.mMaxProgresstime = tRecipe.mDuration / (1 << tTier - 1); - Utils.LOG_WARNING("Centrifuge Debug - 3.1 - Max Progress Time: " + this.mMaxProgresstime + " EU/t" - + this.mEUt + " Obscure GT Value " + gregtech.api.enums.GT_Values.V[tTier - 1]); - } - else { + this.mEUt = (tRecipe.mEUt * (1 << tTier - 1) * (1 << tTier - 1)); + this.mMaxProgresstime = (tRecipe.mDuration / (1 << tTier - 1)); + Utils.LOG_WARNING("Centrifuge Debug - 3.1 - Max Progress Time: "+this.mMaxProgresstime+" EU/t"+this.mEUt + " Obscure GT Value "+gregtech.api.enums.GT_Values.V[(tTier - 1)]); + } else { Utils.LOG_WARNING("Centrifuge Debug - using > 16eu/t"); this.mEUt = tRecipe.mEUt; this.mMaxProgresstime = tRecipe.mDuration; - Utils.LOG_WARNING("Centrifuge Debug - 3.2 - Max Progress Time: " + this.mMaxProgresstime + " EU/t" - + this.mEUt + " Obscure GT Value " + gregtech.api.enums.GT_Values.V[tTier - 1]); - while (this.mEUt <= gregtech.api.enums.GT_Values.V[tTier - 1]) { + Utils.LOG_WARNING("Centrifuge Debug - 3.2 - Max Progress Time: "+this.mMaxProgresstime+" EU/t"+this.mEUt + " Obscure GT Value "+gregtech.api.enums.GT_Values.V[(tTier - 1)]); + while (this.mEUt <= gregtech.api.enums.GT_Values.V[(tTier - 1)]) { this.mEUt *= 4; this.mMaxProgresstime /= 2; - Utils.LOG_WARNING("Centrifuge Debug - 4 - Max Progress Time: " + this.mMaxProgresstime + " EU/t" - + this.mEUt); + Utils.LOG_WARNING("Centrifuge Debug - 4 - Max Progress Time: "+this.mMaxProgresstime+" EU/t"+this.mEUt); } } this.mEUt *= 1; if (this.mEUt > 0) { - this.mEUt = -this.mEUt; - Utils.LOG_WARNING( - "Centrifuge Debug - 5 - Max Progress Time: " + this.mMaxProgresstime + " EU/t" + this.mEUt); + this.mEUt = (-this.mEUt); + Utils.LOG_WARNING("Centrifuge Debug - 5 - Max Progress Time: "+this.mMaxProgresstime+" EU/t"+this.mEUt); } ItemStack[] tOut = new ItemStack[tRecipe.mOutputs.length]; for (int h = 0; h < tRecipe.mOutputs.length; h++) { @@ -197,34 +161,30 @@ public class GregtechMetaTileEntity_IndustrialCentrifuge extends GregtechMeta_Mu tOut[h].stackSize = 0; } FluidStack tFOut = null; - if (tRecipe.getFluidOutput(0) != null) { - tFOut = tRecipe.getFluidOutput(0).copy(); - } + if (tRecipe.getFluidOutput(0) != null) tFOut = tRecipe.getFluidOutput(0).copy(); for (int f = 0; f < tOut.length; f++) { if (tRecipe.mOutputs[f] != null && tOut[f] != null) { for (int g = 0; g < 1; g++) { - if (this.getBaseMetaTileEntity().getRandomNumber(10000) < tRecipe.getOutputChance(f)) { + if (getBaseMetaTileEntity().getRandomNumber(10000) < tRecipe.getOutputChance(f)) tOut[f].stackSize += tRecipe.mOutputs[f].stackSize; - } } } } if (tFOut != null) { - final int tSize = tFOut.amount; + int tSize = tFOut.amount; tFOut.amount = tSize * 6; } this.mMaxProgresstime = Math.max(1, this.mMaxProgresstime); this.mMaxProgresstime /= 4; - if (this.mMaxProgresstime <= 0) { + if (this.mMaxProgresstime <= 0){ this.mMaxProgresstime++; } - Utils.LOG_WARNING( - "Centrifuge Debug - 6 - Max Progress Time: " + this.mMaxProgresstime + " EU/t" + this.mEUt); - final List overStacks = new ArrayList(); + Utils.LOG_WARNING("Centrifuge Debug - 6 - Max Progress Time: "+this.mMaxProgresstime+" EU/t"+this.mEUt); + List overStacks = new ArrayList(); for (int f = 0; f < tOut.length; f++) { if (tOut[f].getMaxStackSize() < tOut[f].stackSize) { while (tOut[f].getMaxStackSize() < tOut[f].stackSize) { - final ItemStack tmp = tOut[f].copy(); + ItemStack tmp = tOut[f].copy(); tmp.stackSize = tmp.getMaxStackSize(); tOut[f].stackSize = tOut[f].stackSize - tOut[f].getMaxStackSize(); overStacks.add(tmp); @@ -236,18 +196,14 @@ public class GregtechMetaTileEntity_IndustrialCentrifuge extends GregtechMeta_Mu tmp = overStacks.toArray(tmp); tOut = ArrayUtils.addAll(tOut, tmp); } - final List tSList = new ArrayList(); - for (final ItemStack tS : tOut) { - if (tS.stackSize > 0) { - tSList.add(tS); - } + List tSList = new ArrayList(); + for (ItemStack tS : tOut) { + if (tS.stackSize > 0) tSList.add(tS); } tOut = tSList.toArray(new ItemStack[tSList.size()]); this.mOutputItems = tOut; - this.mOutputFluids = new FluidStack[] { - tFOut - }; - this.updateSlots(); + this.mOutputFluids = new FluidStack[]{tFOut}; + updateSlots(); Utils.LOG_WARNING("Centrifuge: True"); return true; } @@ -256,20 +212,11 @@ public class GregtechMetaTileEntity_IndustrialCentrifuge extends GregtechMeta_Mu return false; } - @Override - public boolean explodesOnComponentBreak(final ItemStack aStack) { - return false; - } - - @Override - public int getAmountOfOutputs() { - return 1; - } - @SuppressWarnings("static-method") public Block getCasingBlock() { return ModBlocks.blockCasingsMisc; } + @SuppressWarnings("static-method") public byte getCasingMeta() { return 0; @@ -281,66 +228,89 @@ public class GregtechMetaTileEntity_IndustrialCentrifuge extends GregtechMeta_Mu } @Override - public Object getClientGUI(final int aID, final InventoryPlayer aPlayerInventory, - final IGregTechTileEntity aBaseMetaTileEntity) { - return new GUI_MultiMachine(aPlayerInventory, aBaseMetaTileEntity, this.getLocalName(), - "IndustrialCentrifuge.png"); + public boolean checkMachine(IGregTechTileEntity aBaseMetaTileEntity, ItemStack aStack) { + /*if (configSwitches.disableCentrifugeFormation){ + EntityPlayerMP player = MinecraftServer.getServer().getConfigurationManager().func_152612_a(this.getBaseMetaTileEntity().getOwnerName()); + if (!player.getEntityWorld().isRemote && isDisabled == false) + PlayerUtils.messagePlayer(player, "This Multiblock is disabled via the config. [Only re-enable if you're bugtesting.]"); + isDisabled = true; + return false; + }*/ + int xDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetX; + int yDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetY; + int zDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetZ; + //Utils.LOG_WARNING("X:"+xDir+" Y:"+yDir+" Z:"+zDir); + if (!aBaseMetaTileEntity.getAirOffset(xDir, 0, zDir)) { + return false; + } + int tAmount = 0; + for (int i = -1; i < 2; i++) { //X-Dir + for (int j = -1; j < 2; j++) { //Z-Dir + for (int h = -1; h < 2; h++) { //Y-Dir + if ((h != 0) || (((xDir + i != 0) || (zDir + j != 0)) && ((i != 0) || (j != 0)))) { + + IGregTechTileEntity tTileEntity = aBaseMetaTileEntity.getIGregTechTileEntityOffset(xDir + i, h, zDir + j); + //Utils.LOG_WARNING("X:"+tTileEntity.getXCoord()+" Y:"+tTileEntity.getYCoord()+" Z:"+tTileEntity.getZCoord()); + if ((!addMaintenanceToMachineList(tTileEntity, 57)) && (!addInputToMachineList(tTileEntity, 57)) && (!addOutputToMachineList(tTileEntity, 57)) && (!addEnergyInputToMachineList(tTileEntity, 57))) { + + //Maintenance Hatch + if ((tTileEntity != null) && (tTileEntity.getMetaTileEntity() != null)) { + if (tTileEntity.getXCoord() == aBaseMetaTileEntity.getXCoord() && tTileEntity.getYCoord() == aBaseMetaTileEntity.getYCoord() && tTileEntity.getZCoord() == (aBaseMetaTileEntity.getZCoord()+2)) { + if ((tTileEntity.getMetaTileEntity() instanceof GT_MetaTileEntity_Hatch_Maintenance)) { + Utils.LOG_WARNING("MAINT HATCH IN CORRECT PLACE"); + this.mMaintenanceHatches.add((GT_MetaTileEntity_Hatch_Maintenance) tTileEntity.getMetaTileEntity()); + ((GT_MetaTileEntity_Hatch) tTileEntity.getMetaTileEntity()).mMachineBlock = getCasingTextureIndex(); + } else { + return false; + } + } + else { + Utils.LOG_WARNING("MAINT HATCH IN WRONG PLACE"); + } + } + + if (aBaseMetaTileEntity.getBlockOffset(xDir + i, h, zDir + j) != ModBlocks.blockCasingsMisc) { + return false; + } + if (aBaseMetaTileEntity.getMetaIDOffset(xDir + i, h, zDir + j) != 0) { + return false; + } + tAmount++; + + } + } + } + } + } + return tAmount >= 16; } - @Override - public String[] getDescription() { - return new String[] { - "Controller Block for the Industrial Centrifuge", "Size: 3x3x3 (Hollow)", - "Controller (Front Center) [Orange]", "1x Maintenance Hatch (Rear Center) [Green]", - "The rest can be placed anywhere except the Front [Red]", "1x Input Hatch", "1x Output Hatch", - "1x Input Bus", "1x Output Bus", "1x [EV] Energy Hatch (Can be higher Tier) [Blue]", - "Centrifuge Casings for the rest (16 at least)", CORE.GT_Tooltip - }; + @SuppressWarnings("static-method") + public boolean ignoreController(Block tTileEntity) { + if (!controller && tTileEntity == GregTech_API.sBlockMachines) { + return true; + } + return false; } @Override - public int getMaxEfficiency(final ItemStack aStack) { + public int getMaxEfficiency(ItemStack aStack) { return 10000; } @Override - public int getPollutionPerTick(final ItemStack aStack) { + public int getPollutionPerTick(ItemStack aStack) { return 0; } @Override - public GT_Recipe.GT_Recipe_Map getRecipeMap() { - return GT_Recipe.GT_Recipe_Map.sCentrifugeRecipes; + public int getAmountOfOutputs() { + return 1; } @Override - public ITexture[] getTexture(final IGregTechTileEntity aBaseMetaTileEntity, final byte aSide, final byte aFacing, - final byte aColorIndex, final boolean aActive, final boolean aRedstone) { - return new ITexture[] { - Textures.BlockIcons.MACHINE_CASINGS[1][aColorIndex + 1], - aFacing == aSide - ? aActive ? GregtechMetaTileEntity_IndustrialCentrifuge.frontFaceActive - : GregtechMetaTileEntity_IndustrialCentrifuge.frontFace - : Textures.BlockIcons.CASING_BLOCKS[57] - }; - } - - @SuppressWarnings("static-method") - public boolean ignoreController(final Block tTileEntity) { - if (!GregtechMetaTileEntity_IndustrialCentrifuge.controller && tTileEntity == GregTech_API.sBlockMachines) { - return true; - } + public boolean explodesOnComponentBreak(ItemStack aStack) { return false; } - @Override - public boolean isFacingValid(final byte aFacing) { - return aFacing > 1; - } - - @Override - public IMetaTileEntity newMetaEntity(final IGregTechTileEntity aTileEntity) { - return new GregtechMetaTileEntity_IndustrialCentrifuge(this.mName); - } - } \ No newline at end of file diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_IndustrialCokeOven.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_IndustrialCokeOven.java index 5d0ceb53e8..c2e2df7a8f 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_IndustrialCokeOven.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_IndustrialCokeOven.java @@ -1,284 +1,278 @@ package gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi; -import java.util.ArrayList; -import java.util.Arrays; - +import static gtPlusPlus.xmod.gregtech.common.blocks.GregtechMetaCasingBlocks.GTID; 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.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.lib.CORE; import gtPlusPlus.core.util.Utils; import gtPlusPlus.xmod.gregtech.api.gui.GUI_MultiMachine; import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base.GregtechMeta_MultiBlockBase; -import gtPlusPlus.xmod.gregtech.common.blocks.GregtechMetaCasingBlocks; + +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_IndustrialCokeOven extends GregtechMeta_MultiBlockBase { - private int mLevel = 0; - - public GregtechMetaTileEntity_IndustrialCokeOven(final int aID, final String aName, final String aNameRegional) { - super(aID, aName, aNameRegional); - } +public class GregtechMetaTileEntity_IndustrialCokeOven + extends GregtechMeta_MultiBlockBase { + private int mLevel = 0; - public GregtechMetaTileEntity_IndustrialCokeOven(final String aName) { - super(aName); - } + public GregtechMetaTileEntity_IndustrialCokeOven(int aID, String aName, String aNameRegional) { + super(aID, aName, aNameRegional); + } - @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; - int xr = aBaseMetaTileEntity.getXCoord(); - int yr = aBaseMetaTileEntity.getYCoord(); - int zr = aBaseMetaTileEntity.getZCoord(); - this.mLevel = 0; - if (!aBaseMetaTileEntity.getAirOffset(xDir, 1, zDir)) { - return false; - } - this.addMufflerToMachineList(aBaseMetaTileEntity.getIGregTechTileEntityOffset(xDir, 2, zDir), - GregtechMetaCasingBl