From cd9ab98391dd7baaba4106e69823f4040d91e052 Mon Sep 17 00:00:00 2001 From: Jordan Byrne Date: Sat, 3 Mar 2018 19:14:29 +1000 Subject: + Added Multi-Use Casings. + Added Recipe for Multi-Machine and Multi-Use Casings. % Improved Multi-Machine Manual. $ Made Multi-Machine functional, disabled mode 3. --- src/Java/gregtech/api/enums/TAE.java | 7 ++ src/Java/gtPlusPlus/core/config/ConfigHandler.java | 7 +- src/Java/gtPlusPlus/core/handler/BookHandler.java | 8 +- .../gtPlusPlus/core/handler/COMPAT_HANDLER.java | 1 + src/Java/gtPlusPlus/core/lib/CORE.java | 2 + .../gtPlusPlus/core/recipe/RECIPES_Machines.java | 23 +++++ .../xmod/gregtech/api/enums/GregtechItemList.java | 5 +- .../common/blocks/GregtechMetaCasingBlocks3.java | 4 +- .../blocks/textures/CasingTextureHandler3.java | 2 +- ...gtechMetaTileEntity_IndustrialMultiMachine.java | 101 ++++++++++++++++----- .../gregtech/GregtechIndustrialMultiMachine.java | 25 +++++ 11 files changed, 149 insertions(+), 36 deletions(-) create mode 100644 src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechIndustrialMultiMachine.java diff --git a/src/Java/gregtech/api/enums/TAE.java b/src/Java/gregtech/api/enums/TAE.java index 8f262ad121..0abc5db38a 100644 --- a/src/Java/gregtech/api/enums/TAE.java +++ b/src/Java/gregtech/api/enums/TAE.java @@ -94,4 +94,11 @@ public class TAE { } return (64+ID); } + + public static int getIndexFromPage(int page, int blockMeta) { + int id = 64; + id += (page == 0 ? 0 : page == 1 ? 16 : page == 2 ? 32 : page == 3 ? 48 : page == 4 ? 64 : 0); + id += blockMeta; + return id; + } } diff --git a/src/Java/gtPlusPlus/core/config/ConfigHandler.java b/src/Java/gtPlusPlus/core/config/ConfigHandler.java index 40205d904d..e41698844f 100644 --- a/src/Java/gtPlusPlus/core/config/ConfigHandler.java +++ b/src/Java/gtPlusPlus/core/config/ConfigHandler.java @@ -146,10 +146,11 @@ public class ConfigHandler { enableMultiblock_IndustrialCuttingMachine = config.getBoolean("enableMultiblock_IndustrialCuttingMachine", "gregtech", true, "Very fast and efficient Cutting Machine."); enableMultiblock_IndustrialFishingPort = config.getBoolean("enableMultiblock_IndustrialFishingPort", - "gregtech", true, "Fish the seas, except on land."); - + "gregtech", true, "Fish the seas, except on land."); enableMultiblock_IndustrialExtrudingMachine = config.getBoolean("enableMultiblock_IndustrialExtrudingMachine", - "gregtech", true, "Very fast and efficient Extruding Machine."); + "gregtech", true, "Very fast and efficient Extruding Machine."); + enableMultiblock_IndustrialMultiMachine = config.getBoolean("enableMultiblock_IndustrialMultiMachine", + "gregtech", true, "Can run recipes for 9 different types of machines."); // Options rfPerEU = config.getInt("rfUsedPerEUForUniversalBatteries", "configurables", 4, 1, 1000, diff --git a/src/Java/gtPlusPlus/core/handler/BookHandler.java b/src/Java/gtPlusPlus/core/handler/BookHandler.java index d0e04fccc8..51bba5152f 100644 --- a/src/Java/gtPlusPlus/core/handler/BookHandler.java +++ b/src/Java/gtPlusPlus/core/handler/BookHandler.java @@ -78,12 +78,12 @@ public class BookHandler { book_MultiMachineManual = writeBookTemplate( "Manual_Multi_Machine", "Multi Machine Manual", "Alkalus", new String[] {"This Multiblock, depending upon the mode used, can function as a variety of different machines. The idea behind this, was that most of these machines are rather niche compared to any others, as such, not used often.", - "The Mode can be set by using a Screwdriver on the controller block. Each mode allows the use of Numbered Circuits, to allow a different machine 'type' for each input bus.", + "To build, you need to construct a hollow 3x3x3 structure made from Multi-Use casings. Any Casing can be substituted out with an Input Hatch/Bus, an Output Hatch/Bus, Maint. Hatch or Energy Injector Hatch", + "The Mode can be set by using a Screwdriver on the controller block. Each mode allows the use of Numbered Circuits, to allow a different machine 'type' for each input bus. Mode 3 is currently disabled, as each machine requires special handling.", "[Metal Work] Mode A - Allows the multiblock to function as a Compressor, a Lathe or an Electro-Magnet. To allow a hatch to run in Compressor mode, insert a No. 20 circuit. For Lathe, use No. 21 and for Electro-Magnet use No. 22.", "[Fluid Work] Mode B - Allows the multiblock to function as a Fermenter, a Distillery or an Extractor. To allow a hatch to run in Fermenter mode, insert a No. 20 circuit. For Distillery, use No. 21 and for Extractor use No. 22.", - "[Misc. Work] Mode C - Allows the multiblock to function as a Laser Engraver, a Replicator or an Autoclave. To allow a hatch to run in Laser Engraver mode, insert a No. 20 circuit. For Autoclave, use No. 21 and for Replicator use No. 22.", - "", - "",}); + "[Misc. Work] Mode C - Allows the multiblock to function as a Laser Engraver, a Replicator or an Autoclave. To allow a hatch to run in Laser Engraver mode, insert a No. 20 circuit. For Autoclave, use No. 21 and for Replicator use No. 22. DISABLED.", + }); } diff --git a/src/Java/gtPlusPlus/core/handler/COMPAT_HANDLER.java b/src/Java/gtPlusPlus/core/handler/COMPAT_HANDLER.java index 2d23fd592b..17ff73e059 100644 --- a/src/Java/gtPlusPlus/core/handler/COMPAT_HANDLER.java +++ b/src/Java/gtPlusPlus/core/handler/COMPAT_HANDLER.java @@ -104,6 +104,7 @@ public class COMPAT_HANDLER { GregtechIndustrialFishPond.run(); GregtechTieredChunkloaders.run(); GregtechIndustrialExtruder.run(); + GregtechIndustrialMultiMachine.run(); //New Horizons Content NewHorizonsAccelerator.run(); diff --git a/src/Java/gtPlusPlus/core/lib/CORE.java b/src/Java/gtPlusPlus/core/lib/CORE.java index 283f45f920..d5d1e467a7 100644 --- a/src/Java/gtPlusPlus/core/lib/CORE.java +++ b/src/Java/gtPlusPlus/core/lib/CORE.java @@ -214,6 +214,7 @@ public class CORE { public static boolean enableMultiblock_IndustrialCuttingMachine = true; public static boolean enableMultiblock_IndustrialFishingPort = true; public static boolean enableMultiblock_IndustrialExtrudingMachine = true; + public static boolean enableMultiblock_IndustrialMultiMachine = true; //Visuals public static boolean enableTreeFarmerParticles = true; @@ -224,6 +225,7 @@ public class CORE { + } public static class Everglades{ diff --git a/src/Java/gtPlusPlus/core/recipe/RECIPES_Machines.java b/src/Java/gtPlusPlus/core/recipe/RECIPES_Machines.java index adaa2b4609..e600ac81a1 100644 --- a/src/Java/gtPlusPlus/core/recipe/RECIPES_Machines.java +++ b/src/Java/gtPlusPlus/core/recipe/RECIPES_Machines.java @@ -1134,6 +1134,29 @@ public class RECIPES_Machines { GregtechItemList.Industrial_FishingPond.get(1)); } + + + + if (CORE.ConfigSwitches.enableMultiblock_IndustrialMultiMachine){ + ItemStack plate = ALLOY.STABALLOY.getPlate(1); + ItemStack o_Compressor = ItemList.Machine_HV_Compressor.get(1); + ItemStack o_Lathe = ItemList.Machine_HV_Lathe.get(1); + ItemStack o_Electromagnet = ItemList.Machine_HV_Polarizer.get(1); + ItemStack o_Fermenter = ItemList.Machine_HV_Fermenter.get(1); + ItemStack o_Distillery = ItemList.Machine_HV_Distillery.get(1); + ItemStack o_Extractor = ItemList.Machine_HV_Extractor.get(1); + RecipeUtils.recipeBuilder( + plate, CI.craftingToolHammer_Hard, plate, + "plateStainlessSteel", "frameGtZirconiumCarbide", "plateStainlessSteel", + plate, CI.craftingToolWrench, plate, + GregtechItemList.Casing_Multi_Use.get(Casing_Amount)); + + RecipeUtils.recipeBuilder( + o_Compressor, o_Lathe, o_Electromagnet, + plate, ItemUtils.getSimpleStack(ModBlocks.blockProjectTable), plate, + o_Fermenter, o_Distillery, o_Extractor, + GregtechItemList.Industrial_MultiMachine.get(1)); + } //Wireless Chargers RecipeUtils.addShapedGregtechRecipe( CI.emitter_LV, CI.circuitTier1, CI.emitter_LV, diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/enums/GregtechItemList.java b/src/Java/gtPlusPlus/xmod/gregtech/api/enums/GregtechItemList.java index aa9c96b615..2a8583acaf 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/api/enums/GregtechItemList.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/api/enums/GregtechItemList.java @@ -295,7 +295,10 @@ public enum GregtechItemList implements GregtechItemContainer { GT_Chunkloader_HV, GT_Chunkloader_EV, GT_Chunkloader_IV, //Large Extruder - Industrial_Extruder, Casing_Extruder, + Industrial_Extruder, Casing_Extruder, + + //Multi-Machine + Industrial_MultiMachine, Casing_Multi_Use, diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/blocks/GregtechMetaCasingBlocks3.java b/src/Java/gtPlusPlus/xmod/gregtech/common/blocks/GregtechMetaCasingBlocks3.java index 242eea4b71..32977ab39a 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/blocks/GregtechMetaCasingBlocks3.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/blocks/GregtechMetaCasingBlocks3.java @@ -23,7 +23,7 @@ extends GregtechMetaCasingBlocksAbstract { } GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".0.name", "Aquatic Casing"); GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".1.name", "Inconel Reinforced Casing"); - GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".2.name", "Placeholder"); + GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".2.name", "Multi-Use Casing"); GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".3.name", "Placeholder"); GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".4.name", "Placeholder"); GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".5.name", "Placeholder"); @@ -39,7 +39,7 @@ extends GregtechMetaCasingBlocksAbstract { GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".15.name", "Placeholder"); GregtechItemList.Casing_FishPond.set(new ItemStack(this, 1, 0)); GregtechItemList.Casing_Extruder.set(new ItemStack(this, 1, 1)); - //GregtechItemList.Casing_Refinery_Structural.set(new ItemStack(this, 1, 2)); + GregtechItemList.Casing_Multi_Use.set(new ItemStack(this, 1, 2)); //GregtechItemList.Casing_Refinery_Internal.set(new ItemStack(this, 1, 3)); //GregtechItemList.Casing_WashPlant.set(new ItemStack(this, 1, 4)); //GregtechItemList.Casing_Sifter.set(new ItemStack(this, 1, 5)); diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/blocks/textures/CasingTextureHandler3.java b/src/Java/gtPlusPlus/xmod/gregtech/common/blocks/textures/CasingTextureHandler3.java index 67e66a1842..885e351186 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/blocks/textures/CasingTextureHandler3.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/blocks/textures/CasingTextureHandler3.java @@ -15,7 +15,7 @@ public class CasingTextureHandler3 { return TexturesGtBlock.TEXTURE_METAL_PANEL_D.getIcon(); //Coke Oven Casing Tier 1 case 2: - return TexturesGtBlock._PlaceHolder.getIcon(); + return TexturesGtBlock.TEXTURE_METAL_PANEL_C.getIcon(); //Coke Oven Casing Tier 2 case 3: return TexturesGtBlock._PlaceHolder.getIcon(); diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_IndustrialMultiMachine.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_IndustrialMultiMachine.java index f3aba8c5d5..993ae6d131 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_IndustrialMultiMachine.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_IndustrialMultiMachine.java @@ -8,6 +8,7 @@ import java.util.List; import org.apache.commons.lang3.ArrayUtils; import net.minecraft.block.Block; +import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.inventory.IInventory; import net.minecraft.item.ItemStack; @@ -16,7 +17,7 @@ import gregtech.api.enums.*; import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.metatileentity.IMetaTileEntity; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Output; +import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_InputBus; import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_OutputBus; import gregtech.api.objects.GT_RenderedTexture; import gregtech.api.util.GT_OreDictUnificator; @@ -31,6 +32,7 @@ import gtPlusPlus.core.lib.CORE; import gtPlusPlus.core.recipe.common.CI; import gtPlusPlus.core.util.Utils; import gtPlusPlus.core.util.minecraft.ItemUtils; +import gtPlusPlus.core.util.minecraft.PlayerUtils; import gtPlusPlus.xmod.gregtech.api.gui.GUI_MultiMachine; import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base.GregtechMeta_MultiBlockBase; import net.minecraftforge.common.util.ForgeDirection; @@ -74,23 +76,16 @@ extends GregtechMeta_MultiBlockBase { "Processes two items per voltage tier", "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)", - "Multi-Use Casings for the rest (16 at least!)", + "Read Multi-Machine Manual for extra information", CORE.GT_Tooltip}; } @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[TAE.GTPP_INDEX(5)], new GT_RenderedTexture(aActive ? Textures.BlockIcons.OVERLAY_FRONT_VACUUM_FREEZER_ACTIVE : Textures.BlockIcons.OVERLAY_FRONT_VACUUM_FREEZER)}; + return new ITexture[]{Textures.BlockIcons.CASING_BLOCKS[getTextureIndex()], new GT_RenderedTexture(aActive ? Textures.BlockIcons.OVERLAY_FRONT_VACUUM_FREEZER_ACTIVE : Textures.BlockIcons.OVERLAY_FRONT_VACUUM_FREEZER)}; } - return new ITexture[]{Textures.BlockIcons.CASING_BLOCKS[TAE.GTPP_INDEX(5)]}; + return new ITexture[]{Textures.BlockIcons.CASING_BLOCKS[getTextureIndex()]}; } @Override @@ -110,7 +105,31 @@ extends GregtechMeta_MultiBlockBase { @Override public boolean checkRecipe(final ItemStack aStack) { - return checkRecipeGeneric(2*Utils.calculateVoltageTier(this.getMaxInputVoltage()), 90, 180); + ArrayList tFluids = getStoredFluids(); + Logger.INFO("1"); + for (GT_MetaTileEntity_Hatch_InputBus tBus : mInputBusses) { + ArrayList tBusItems = new ArrayList(); + tBus.mRecipeMap = getRecipeMap(); + Logger.INFO("2"); + if (isValidMetaTileEntity(tBus)) { + Logger.INFO("3"); + for (int i = tBus.getBaseMetaTileEntity().getSizeInventory() - 1; i >= 0; i--) { + if (tBus.getBaseMetaTileEntity().getStackInSlot(i) != null) + tBusItems.add(tBus.getBaseMetaTileEntity().getStackInSlot(i)); + } + } + + Object[] tempArray = tFluids.toArray(new FluidStack[] {}); + FluidStack[] properArray; + properArray = ((tempArray != null && tempArray.length > 0) ? (FluidStack[]) tempArray : new FluidStack[] {}); + + Logger.INFO("4"); + if (checkRecipeGeneric(tBusItems.toArray(new ItemStack[]{}), properArray, + (2*Utils.calculateVoltageTier(this.getMaxInputVoltage())), 80, 250, 10000)) return true; + } + return false; + + //return checkRecipeGeneric(2*Utils.calculateVoltageTier(this.getMaxInputVoltage()), 90, 180); } @Override @@ -126,7 +145,7 @@ extends GregtechMeta_MultiBlockBase { for (int h = -1; h < 2; h++) { if ((h != 0) || ((((xDir + i) != 0) || ((zDir + j) != 0)) && ((i != 0) || (j != 0)))) { final IGregTechTileEntity tTileEntity = aBaseMetaTileEntity.getIGregTechTileEntityOffset(xDir + i, h, zDir + j); - if ((!this.addMaintenanceToMachineList(tTileEntity, TAE.GTPP_INDEX(5))) && (!this.addMufflerToMachineList(tTileEntity, TAE.GTPP_INDEX(5))) && (!this.addInputToMachineList(tTileEntity, TAE.GTPP_INDEX(5))) && (!this.addOutputToMachineList(tTileEntity, TAE.GTPP_INDEX(5))) && (!this.addEnergyInputToMachineList(tTileEntity, TAE.GTPP_INDEX(5)))) { + if ((!this.addMaintenanceToMachineList(tTileEntity, getTextureIndex())) && (!this.addMufflerToMachineList(tTileEntity, getTextureIndex())) && (!this.addInputToMachineList(tTileEntity, getTextureIndex())) && (!this.addOutputToMachineList(tTileEntity, getTextureIndex())) && (!this.addEnergyInputToMachineList(tTileEntity, getTextureIndex()))) { final Block tBlock = aBaseMetaTileEntity.getBlockOffset(xDir + i, h, zDir + j); final byte tMeta = aBaseMetaTileEntity.getMetaIDOffset(xDir + i, h, zDir + j); if (((tBlock != ModBlocks.blockCasings3Misc) || (tMeta != 2))) { @@ -138,7 +157,7 @@ extends GregtechMeta_MultiBlockBase { } } } - return tAmount >= 16; + return tAmount >= 8; } @Override @@ -151,6 +170,10 @@ extends GregtechMeta_MultiBlockBase { return 50; } + public int getTextureIndex() { + return TAE.getIndexFromPage(2, 2); + } + @Override public int getAmountOfOutputs() { return 1; @@ -227,24 +250,32 @@ extends GregtechMeta_MultiBlockBase { ItemStack[] aItemInputs, FluidStack[] aFluidInputs, int aMaxParallelRecipes, int aEUPercent, int aSpeedBonusPercent, int aOutputChanceRoll) { + // Based on the Processing Array. A bit overkill, but very flexible. + // Get Circuit info for this recipe. + ItemStack tCircuit = getCircuit(aItemInputs); + int tCircuitID = getCircuitID(tCircuit); + + Logger.INFO("Mode: "+tCircuitID); + + // Time to Defer to Special Handling if it's in replicator mode. + if (tCircuitID == MODE_REPLICATOR) { + return checkReplicatorRecipe(aItemInputs, aFluidInputs, aMaxParallelRecipes, aEUPercent, aSpeedBonusPercent, aOutputChanceRoll); + } + // Reset outputs and progress stats this.mEUt = 0; this.mMaxProgresstime = 0; this.mOutputItems = new ItemStack[]{}; this.mOutputFluids = new FluidStack[]{}; + + long tVoltage = getMaxInputVoltage(); byte tTier = (byte) Math.max(1, GT_Utility.getTier(tVoltage)); - //Get Circuit info for this recipe. - ItemStack tCircuit = getCircuit(aItemInputs); - int tCircuitID = getCircuitID(tCircuit); - if (tCircuitID == MODE_REPLICATOR) { - return checkReplicatorRecipe(aItemInputs, aFluidInputs, aMaxParallelRecipes, aEUPercent, aSpeedBonusPercent, aOutputChanceRoll); - } GT_Recipe tRecipe = this.getRecipeMap(tCircuit).findRecipe( getBaseMetaTileEntity(), this.mLastRecipeExtended[tCircuitID], false, @@ -256,12 +287,19 @@ extends GregtechMeta_MultiBlockBase { this.mLastRecipeExtended[tCircuitID] = tRecipe; if (tRecipe == null) { - Logger.WARNING("BAD RETURN - 1"); + Logger.INFO("BAD RETURN - 1|"+tCircuitID); + + if (aItemInputs.length > 0) { + Logger.INFO("Input Items: "+ItemUtils.getArrayStackNames(aItemInputs)); + } + if (aFluidInputs.length > 0) { + Logger.INFO("Input Fluids: "+ItemUtils.getFluidArrayStackNames(aFluidInputs)); + } return false; } if (!this.canBufferOutputs(tRecipe, aMaxParallelRecipes)) { - Logger.WARNING("BAD RETURN - 2"); + Logger.INFO("BAD RETURN - 2|"+tCircuitID); return false; } @@ -287,7 +325,7 @@ extends GregtechMeta_MultiBlockBase { } if (parallelRecipes == 0) { - Logger.WARNING("BAD RETURN - 3"); + Logger.INFO("BAD RETURN - 3|"+tCircuitID); return false; } @@ -384,7 +422,7 @@ extends GregtechMeta_MultiBlockBase { // Play sounds (GT++ addition - GT multiblocks play no sounds) startProcess(); - Logger.WARNING("GOOD RETURN - 1"); + Logger.INFO("GOOD RETURN - 1|"+tCircuitID); return true; } @@ -516,7 +554,7 @@ extends GregtechMeta_MultiBlockBase { for (int r=0;r