From 12b7dfffcbdc23c0905fe614249ad74f87ef5152 Mon Sep 17 00:00:00 2001 From: Draknyte1 Date: Wed, 13 Jul 2016 16:49:29 +1000 Subject: + Added the Industrial Electrolyzer --- src/Java/miscutil/core/handler/COMPAT_HANDLER.java | 2 + .../gregtech/GregtechIndustrialElectrolyzer.java | 27 +++ .../xmod/gregtech/api/enums/GregtechItemList.java | 7 +- .../common/blocks/GregtechMetaCasingBlocks.java | 7 +- ...egtechMetaTileEntityIndustrialElectrolyzer.java | 256 +++++++++++++++++++++ ...GregtechMetaTileEntityIndustrialPlatePress.java | 122 ++++++---- 6 files changed, 374 insertions(+), 47 deletions(-) create mode 100644 src/Java/miscutil/core/handler/registration/gregtech/GregtechIndustrialElectrolyzer.java create mode 100644 src/Java/miscutil/core/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntityIndustrialElectrolyzer.java diff --git a/src/Java/miscutil/core/handler/COMPAT_HANDLER.java b/src/Java/miscutil/core/handler/COMPAT_HANDLER.java index 9b56389f7f..2e72a4a09d 100644 --- a/src/Java/miscutil/core/handler/COMPAT_HANDLER.java +++ b/src/Java/miscutil/core/handler/COMPAT_HANDLER.java @@ -23,6 +23,7 @@ import miscutil.core.handler.registration.gregtech.GregtechConduits; import miscutil.core.handler.registration.gregtech.GregtechEnergyBuffer; import miscutil.core.handler.registration.gregtech.GregtechIndustrialCentrifuge; import miscutil.core.handler.registration.gregtech.GregtechIndustrialCokeOven; +import miscutil.core.handler.registration.gregtech.GregtechIndustrialElectrolyzer; import miscutil.core.handler.registration.gregtech.GregtechIndustrialPlatePress; import miscutil.core.handler.registration.gregtech.GregtechIronBlastFurnace; import miscutil.core.handler.registration.gregtech.GregtechRocketFuelGenerator; @@ -87,6 +88,7 @@ public class COMPAT_HANDLER { GregtechIndustrialCokeOven.run(); GregtechIndustrialPlatePress.run(); GregtechRocketFuelGenerator.run(); + GregtechIndustrialElectrolyzer.run(); } } diff --git a/src/Java/miscutil/core/handler/registration/gregtech/GregtechIndustrialElectrolyzer.java b/src/Java/miscutil/core/handler/registration/gregtech/GregtechIndustrialElectrolyzer.java new file mode 100644 index 0000000000..ae71e5375e --- /dev/null +++ b/src/Java/miscutil/core/handler/registration/gregtech/GregtechIndustrialElectrolyzer.java @@ -0,0 +1,27 @@ +package miscutil.core.handler.registration.gregtech; + +import miscutil.core.util.Utils; +import miscutil.core.xmod.gregtech.api.enums.GregtechItemList; +import miscutil.core.xmod.gregtech.common.tileentities.machines.multi.GregtechMetaTileEntityIndustrialElectrolyzer; + +public class GregtechIndustrialElectrolyzer +{ + + + + public static void run() + { + if (miscutil.core.lib.LoadedMods.Gregtech){ + Utils.LOG_INFO("MiscUtils: Gregtech5u Content | Registering Industrial Electrolyzer Multiblock."); + run1(); + } + + } + + private static void run1() + { + //Industrial Electrolyzer Multiblock + GregtechItemList.Industrial_Electrolyzer.set(new GregtechMetaTileEntityIndustrialElectrolyzer(796, "industrialcentrifuge.controller.tier.single", "Industrial Electrolyzer Controller").getStackForm(1L)); + + } +} \ No newline at end of file diff --git a/src/Java/miscutil/core/xmod/gregtech/api/enums/GregtechItemList.java b/src/Java/miscutil/core/xmod/gregtech/api/enums/GregtechItemList.java index 93e547c01a..2d3628b469 100644 --- a/src/Java/miscutil/core/xmod/gregtech/api/enums/GregtechItemList.java +++ b/src/Java/miscutil/core/xmod/gregtech/api/enums/GregtechItemList.java @@ -81,7 +81,7 @@ public enum GregtechItemList implements GregtechItemContainer { Circuit_Parts_Wiring_IV, Circuit_Parts_Wiring_LuV, Circuit_Parts_Wiring_ZPM, //Unused Machine Casings - Casing_MaterialPress, Casing_U2, Casing_U3, Casing_U4, Casing_U5, Casing_U6, Casing_U7, + Casing_MaterialPress, Casing_Electrolyzer, Casing_U3, Casing_U4, Casing_U5, Casing_U6, Casing_U7, //Unused Machine Coils Casing_Coil_U1, Casing_Coil_U2, Casing_Coil_U3, Casing_Coil_U4, @@ -89,7 +89,10 @@ public enum GregtechItemList implements GregtechItemContainer { Shape_Extruder_WindmillShaft, //Batteries - Battery_RE_EV_Sodium; + Battery_RE_EV_Sodium, + + //Industrial Electrolyzer + Industrial_Electrolyzer; public static final GregtechItemList[] DYE_ONLY_ITEMS = { diff --git a/src/Java/miscutil/core/xmod/gregtech/common/blocks/GregtechMetaCasingBlocks.java b/src/Java/miscutil/core/xmod/gregtech/common/blocks/GregtechMetaCasingBlocks.java index 88d609ec11..36859624b3 100644 --- a/src/Java/miscutil/core/xmod/gregtech/common/blocks/GregtechMetaCasingBlocks.java +++ b/src/Java/miscutil/core/xmod/gregtech/common/blocks/GregtechMetaCasingBlocks.java @@ -30,7 +30,7 @@ extends GregtechMetaCasingBlocksAbstract { GT_LanguageManager.addStringLocalization(getUnlocalizedName() + ".2.name", "Heat Resistant Coke Oven Casing"); GT_LanguageManager.addStringLocalization(getUnlocalizedName() + ".3.name", "Heat Proof Coke Oven Casing"); GT_LanguageManager.addStringLocalization(getUnlocalizedName() + ".4.name", "Material Press Machine Casing"); - GT_LanguageManager.addStringLocalization(getUnlocalizedName() + ".5.name", "Unused Casing"); + GT_LanguageManager.addStringLocalization(getUnlocalizedName() + ".5.name", "Electrolyzer Casing"); GT_LanguageManager.addStringLocalization(getUnlocalizedName() + ".6.name", "Unused Casing"); GT_LanguageManager.addStringLocalization(getUnlocalizedName() + ".7.name", "Unused Casing"); GT_LanguageManager.addStringLocalization(getUnlocalizedName() + ".8.name", "Unused Casing"); @@ -46,7 +46,7 @@ extends GregtechMetaCasingBlocksAbstract { GregtechItemList.Casing_CokeOven_Coil1.set(new ItemStack(this, 1, 2)); GregtechItemList.Casing_CokeOven_Coil2.set(new ItemStack(this, 1, 3)); GregtechItemList.Casing_MaterialPress.set(new ItemStack(this, 1, 4)); - GregtechItemList.Casing_U2.set(new ItemStack(this, 1, 5)); + GregtechItemList.Casing_Electrolyzer.set(new ItemStack(this, 1, 5)); GregtechItemList.Casing_U3.set(new ItemStack(this, 1, 6)); GregtechItemList.Casing_U4.set(new ItemStack(this, 1, 7)); GregtechItemList.Casing_U5.set(new ItemStack(this, 1, 8)); @@ -78,6 +78,9 @@ extends GregtechMetaCasingBlocksAbstract { //Material Press Casings case 4: return Textures.BlockIcons.MACHINE_CASING_STABLE_TITANIUM.getIcon(); + //Electrolyzer Casings + case 5: + return Textures.BlockIcons.MACHINE_CASING_FUSION_2.getIcon(); //Iron Blast Fuance Textures case 10: return Textures.BlockIcons.MACHINE_CASING_SOLID_STEEL.getIcon(); diff --git a/src/Java/miscutil/core/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntityIndustrialElectrolyzer.java b/src/Java/miscutil/core/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntityIndustrialElectrolyzer.java new file mode 100644 index 0000000000..e95a682b92 --- /dev/null +++ b/src/Java/miscutil/core/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntityIndustrialElectrolyzer.java @@ -0,0 +1,256 @@ +package miscutil.core.xmod.gregtech.common.tileentities.machines.multi; + +import static miscutil.core.xmod.gregtech.common.blocks.GregtechMetaCasingBlocks.GTID; +import gregtech.api.GregTech_API; +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.GT_Recipe; +import gregtech.api.util.GT_Utility; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; + +import miscutil.core.block.ModBlocks; +import miscutil.core.xmod.gregtech.api.gui.GUI_MultiMachine; +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 GregtechMetaTileEntityIndustrialElectrolyzer +extends GT_MetaTileEntity_MultiBlockBase { + public GregtechMetaTileEntityIndustrialElectrolyzer(int aID, String aName, String aNameRegional) { + super(aID, aName, aNameRegional); + } + + public GregtechMetaTileEntityIndustrialElectrolyzer(String aName) { + super(aName); + } + + @Override + public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { + return new GregtechMetaTileEntityIndustrialElectrolyzer(this.mName); + } + + @Override + public String[] getDescription() { + return new String[]{"Controller Block for the Industrial Electrolyzer", + "Size: 3x3x3 (Hollow)", + "Controller (front centered)", + "1x Input Bus (anywhere)", + "1x Output Bus (anywhere)", + "1x Input Hatch (anywhere)", + "1x Output Hatch (anywhere)", + "1x Energy Hatch (anywhere)", + "1x Maintenance Hatch (anywhere)", + "1x Muffler (anywhere)", + "Electrolyzer Casings for the rest (16 at least!)"}; + } + + @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[GTID+5], new GT_RenderedTexture(aActive ? Textures.BlockIcons.STEAM_TURBINE_SIDE_ACTIVE : Textures.BlockIcons.STEAM_TURBINE_SIDE)}; + } + return new ITexture[]{Textures.BlockIcons.CASING_BLOCKS[GTID+5]}; + } + + @Override + public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { + return new GUI_MultiMachine(aPlayerInventory, aBaseMetaTileEntity, getLocalName(), "CokeOven.png"); + } + + @Override + public GT_Recipe.GT_Recipe_Map getRecipeMap() { + return GT_Recipe.GT_Recipe_Map.sElectrolyzerRecipes; + } + + @Override + public boolean isCorrectMachinePart(ItemStack aStack) { + return true; + } + + @Override + public boolean isFacingValid(byte aFacing) { + return aFacing > 1; + } + + ArrayList tInputList = getStoredInputs(); + GT_Recipe mLastRecipe; + + @Override + public boolean checkRecipe(ItemStack aStack) { //TODO - Add Check to make sure Fluid output isn't full + 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() > 0) { + long tVoltage = getMaxInputVoltage(); + byte tTier = (byte) Math.max(1, GT_Utility.getTier(tVoltage)); + GT_Recipe tRecipe = GT_Recipe.GT_Recipe_Map.sElectrolyzerRecipes.findRecipe(getBaseMetaTileEntity(), false, gregtech.api.enums.GT_Values.V[tTier], tFluids, tInputs); + if ((tRecipe != null) && (7500 >= tRecipe.mSpecialValue) && (tRecipe.isRecipeInputEqual(true, tFluids, tInputs))) { + 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); + + ItemStack[] tOut = new ItemStack[tRecipe.mOutputs.length]; + for (int h = 0; h < tRecipe.mOutputs.length; h++) { + tOut[h] = tRecipe.getOutput(h).copy(); + tOut[h].stackSize = 0; + } + FluidStack tFOut = null; + 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 (getBaseMetaTileEntity().getRandomNumber(10000) < tRecipe.getOutputChance(f)) + tOut[f].stackSize += tRecipe.mOutputs[f].stackSize; + } + } + } + if (tFOut != null) { + int tSize = tFOut.amount; + tFOut.amount = tSize * 1; + } + + 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) { + ItemStack tmp = tOut[f].copy(); + tmp.stackSize = tmp.getMaxStackSize(); + tOut[f].stackSize = tOut[f].stackSize - tOut[f].getMaxStackSize(); + overStacks.add(tmp); + } + } + } + if (overStacks.size() > 0) { + ItemStack[] tmp = new ItemStack[overStacks.size()]; + tmp = overStacks.toArray(tmp); + tOut = ArrayUtils.addAll(tOut, tmp); + } + 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}; + updateSlots(); + + /* this.mOutputItems = new ItemStack[]{tRecipe.getOutput(0), tRecipe.getOutput(1)}; + updateSlots();*/ + return true; + } + } + return false; + } + + @Override + public void startSoundLoop(byte aIndex, double aX, double aY, double aZ) { + super.startSoundLoop(aIndex, aX, aY, aZ); + if (aIndex == 20) { + GT_Utility.doSoundAtClient((String) GregTech_API.sSoundList.get(Integer.valueOf(5)), 10, 1.0F, aX, aY, aZ); + } + } + + @Override + public boolean checkMachine(IGregTechTileEntity aBaseMetaTileEntity, ItemStack aStack) { + int xDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetX; + int zDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetZ; + if (!aBaseMetaTileEntity.getAirOffset(xDir, 0, zDir)) { + return false; + } + int tAmount = 0; + for (int i = -1; i < 2; i++) { + for (int j = -1; j < 2; j++) { + for (int h = -1; h < 2; h++) { + if ((h != 0) || (((xDir + i != 0) || (zDir + j != 0)) && ((i != 0) || (j != 0)))) { + IGregTechTileEntity tTileEntity = aBaseMetaTileEntity.getIGregTechTileEntityOffset(xDir + i, h, zDir + j); + if ((!addMaintenanceToMachineList(tTileEntity, 62)) && (!addMufflerToMachineList(tTileEntity, 62)) && (!addInputToMachineList(tTileEntity, 62)) && (!addOutputToMachineList(tTileEntity, 62)) && (!addEnergyInputToMachineList(tTileEntity, 62))) { + Block tBlock = aBaseMetaTileEntity.getBlockOffset(xDir + i, h, zDir + j); + byte tMeta = aBaseMetaTileEntity.getMetaIDOffset(xDir + i, h, zDir + j); + if (((tBlock != ModBlocks.blockCasingsMisc) || (tMeta != 5))) { + return false; + } + tAmount++; + } + } + } + } + } + return tAmount >= 16; + } + + @Override + public int getMaxEfficiency(ItemStack aStack) { + return 10000; + } + + @Override + public int getPollutionPerTick(ItemStack aStack) { + return 0; + } + + @Override + public int getDamageToComponent(ItemStack aStack) { + return 0; + } + + @Override + public int getAmountOfOutputs() { + return 1; + } + + @Override + public boolean explodesOnComponentBreak(ItemStack aStack) { + return false; + } +} diff --git a/src/Java/miscutil/core/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntityIndustrialPlatePress.java b/src/Java/miscutil/core/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntityIndustrialPlatePress.java index 92d6203b9b..1b9113c401 100644 --- a/src/Java/miscutil/core/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntityIndustrialPlatePress.java +++ b/src/Java/miscutil/core/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntityIndustrialPlatePress.java @@ -1,6 +1,7 @@ package miscutil.core.xmod.gregtech.common.tileentities.machines.multi; import static miscutil.core.xmod.gregtech.common.blocks.GregtechMetaCasingBlocks.GTID; +import gregtech.api.GregTech_API; import gregtech.api.enums.Textures; import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.metatileentity.IMetaTileEntity; @@ -11,12 +12,15 @@ import gregtech.api.util.GT_Recipe; import gregtech.api.util.GT_Utility; import java.util.ArrayList; +import java.util.Arrays; import miscutil.core.block.ModBlocks; import miscutil.core.xmod.gregtech.api.gui.GUI_MultiMachine; +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 GregtechMetaTileEntityIndustrialPlatePress extends GT_MetaTileEntity_MultiBlockBase { @@ -38,10 +42,11 @@ extends GT_MetaTileEntity_MultiBlockBase { return new String[]{"Controller Block for the Material Press", "Size: 3x3x3 (Hollow)", "Controller (front centered)", - "1x Input (anywhere)", - "1x Output (anywhere)", + "1x Input Bus (anywhere)", + "1x Output Bus (anywhere)", "1x Energy Hatch (anywhere)", "1x Maintenance Hatch (anywhere)", + "1x Muffler (anywhere)", "Material Press Machine Casings for the rest (16 at least!)"}; } @@ -73,42 +78,74 @@ extends GT_MetaTileEntity_MultiBlockBase { return aFacing > 1; } - @Override - public boolean checkRecipe(ItemStack aStack) { - ArrayList tInputList = getStoredInputs(); - for (ItemStack tInput : tInputList) { - long tVoltage = getMaxInputVoltage(); - byte tTier = (byte) Math.max(1, GT_Utility.getTier(tVoltage)); - - GT_Recipe tRecipe = GT_Recipe.GT_Recipe_Map.sBenderRecipes.findRecipe(getBaseMetaTileEntity(), false, gregtech.api.enums.GT_Values.V[tTier], null, new ItemStack[]{tInput}); - if (tRecipe != null) { - if (tRecipe.isRecipeInputEqual(true, null, new ItemStack[]{tInput})) { - 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.mOutputItems = new ItemStack[]{tRecipe.getOutput(0)}; - updateSlots(); - return true; - } - } - } - return false; - } + @Override + public boolean checkRecipe(ItemStack aStack) { //TODO - Add Check to make sure Item output isn't full + 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() > 0) { + long tVoltage = getMaxInputVoltage(); + byte tTier = (byte) Math.max(1, GT_Utility.getTier(tVoltage)); + GT_Recipe tRecipe = GT_Recipe.GT_Recipe_Map.sBenderRecipes.findRecipe(getBaseMetaTileEntity(), false, gregtech.api.enums.GT_Values.V[tTier], tFluids, tInputs); + if ((tRecipe != null) && (2500 >= tRecipe.mSpecialValue) && (tRecipe.isRecipeInputEqual(true, tFluids, tInputs))) { + 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.mOutputItems = new ItemStack[]{tRecipe.getOutput(0), tRecipe.getOutput(1)}; + updateSlots(); + return true; + } + } + return false; + } + @Override + public void startSoundLoop(byte aIndex, double aX, double aY, double aZ) { + super.startSoundLoop(aIndex, aX, aY, aZ); + if (aIndex == 20) { + GT_Utility.doSoundAtClient((String) GregTech_API.sSoundList.get(Integer.valueOf(5)), 10, 1.0F, aX, aY, aZ); + } + } @Override public boolean checkMachine(IGregTechTileEntity aBaseMetaTileEntity, ItemStack aStack) { @@ -120,14 +157,13 @@ extends GT_MetaTileEntity_MultiBlockBase { int tAmount = 0; for (int i = -1; i < 2; i++) { for (int j = -1; j < 2; j++) { - for (int h = -1; h < 3; h++) { + for (int h = -1; h < 2; h++) { if ((h != 0) || (((xDir + i != 0) || (zDir + j != 0)) && ((i != 0) || (j != 0)))) { IGregTechTileEntity tTileEntity = aBaseMetaTileEntity.getIGregTechTileEntityOffset(xDir + i, h, zDir + j); - if ((!addMaintenanceToMachineList(tTileEntity, GTID+4)) && (!addInputToMachineList(tTileEntity, GTID+4)) && (!addOutputToMachineList(tTileEntity, GTID+4)) && (!addEnergyInputToMachineList(tTileEntity, GTID+4))) { - if (aBaseMetaTileEntity.getBlockOffset(xDir + i, h, zDir + j) != ModBlocks.blockCasingsMisc) { - return false; - } - if (aBaseMetaTileEntity.getMetaIDOffset(xDir + i, h, zDir + j) != 1) { + if ((!addMaintenanceToMachineList(tTileEntity, 61)) && (!addMufflerToMachineList(tTileEntity, 61)) && (!addInputToMachineList(tTileEntity, 61)) && (!addOutputToMachineList(tTileEntity, 61)) && (!addEnergyInputToMachineList(tTileEntity, 61))) { + Block tBlock = aBaseMetaTileEntity.getBlockOffset(xDir + i, h, zDir + j); + byte tMeta = aBaseMetaTileEntity.getMetaIDOffset(xDir + i, h, zDir + j); + if (((tBlock != ModBlocks.blockCasingsMisc) || (tMeta != 4))) { return false; } tAmount++; -- cgit