diff options
Diffstat (limited to 'src')
3 files changed, 109 insertions, 21 deletions
diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GregtechMeta_MultiBlockBase.java b/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GregtechMeta_MultiBlockBase.java index c2d3331128..ea73a836b4 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GregtechMeta_MultiBlockBase.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GregtechMeta_MultiBlockBase.java @@ -244,12 +244,14 @@ GT_MetaTileEntity_MultiBlockBase { long tVoltage = getMaxInputVoltage(); byte tTier = (byte) Math.max(1, GT_Utility.getTier(tVoltage)); + Logger.WARNING("Running checkRecipeGeneric(0)"); GT_Recipe tRecipe = this.getRecipeMap().findRecipe( getBaseMetaTileEntity(), mLastRecipe, false, gregtech.api.enums.GT_Values.V[tTier], aFluidInputs, aItemInputs); + Logger.WARNING("Running checkRecipeGeneric(1)"); // Remember last recipe - an optimization for findRecipe() this.mLastRecipe = tRecipe; diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/misc/GMTE_AmazonPackager.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/misc/GMTE_AmazonPackager.java index 00d383551c..c81983ac79 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/misc/GMTE_AmazonPackager.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/misc/GMTE_AmazonPackager.java @@ -10,14 +10,18 @@ import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.metatileentity.IMetaTileEntity; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.interfaces.tileentity.IHasWorldObjectAndCoords; +import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_InputBus; import gregtech.api.objects.GT_RenderedTexture; import gregtech.api.util.GT_ModHandler; import gregtech.api.util.GT_Recipe; import gregtech.api.util.GT_Utility; +import gtPlusPlus.api.objects.Logger; import gtPlusPlus.api.objects.data.AutoMap; import gtPlusPlus.api.objects.minecraft.ItemStackData; import gtPlusPlus.core.block.ModBlocks; +import gtPlusPlus.core.lib.CORE; +import gtPlusPlus.core.util.minecraft.ItemUtils; import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base.GregtechMeta_MultiBlockBase; import net.minecraftforge.common.util.ForgeDirection; import net.minecraftforge.fluids.FluidStack; @@ -52,7 +56,21 @@ public class GMTE_AmazonPackager extends GregtechMeta_MultiBlockBase { return new String[]{ "Controller Block for the Amazon Warehouse", "This Multiblock is used for EXTREME packaging requirements", - "" + "Dust Schematics are inserted into the input busses", + "If inserted into the controller, it is shared across all busses", + "1x, 2x, 3x & Other Schematics are to be placed into the controller GUI slot", + "Uncomparably fast compared to a single packager of the same tier", + "Only uses 75% of the eu/t normally required", + "Processes five items per voltage tier", + "Size: 3x3x3 (Hollow)", + "Controller (front centered)", + "1x Input Bus (anywhere)", + "1x Output Bus (anywhere)", + "1x Energy Hatch (anywhere)", + "1x Maintenance Hatch (anywhere)", + "1x Muffler (anywhere)", + "Supply Depot. Casings for the rest (10 at least!)", + CORE.GT_Tooltip }; } @@ -64,30 +82,90 @@ public class GMTE_AmazonPackager extends GregtechMeta_MultiBlockBase { @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.getIndexFromPage(2, 4)], 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.getIndexFromPage(2, 1)], 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.getIndexFromPage(2, 4)]}; + return new ITexture[]{Textures.BlockIcons.CASING_BLOCKS[TAE.getIndexFromPage(2, 1)]}; } - - public GT_Recipe.GT_Recipe_Map getRecipeList() { + @Override + public GT_Recipe.GT_Recipe_Map getRecipeMap() { return GT_Recipe.GT_Recipe_Map.sBoxinatorRecipes; } + public void sortInputBusses() { + for (GT_MetaTileEntity_Hatch_InputBus h : this.mInputBusses) { + h.updateSlots(); + } + } + @Override - public boolean checkRecipe(ItemStack aStack) { - ArrayList<ItemStack> tItems = getStoredInputs(); - AutoMap<ItemStackData> mCompleted = new AutoMap<ItemStackData>(); - for (ItemStack tInputItem : tItems) { - if (tInputItem != null) { - mCompleted.put(new ItemStackData(tInputItem)); - checkRecipe(tInputItem, getGUIItemStack()); + public boolean checkRecipe(ItemStack aStack) { + + boolean h[] = new boolean[mInputBusses.size()]; + int count = 0; + for (GT_MetaTileEntity_Hatch_InputBus tBus : mInputBusses) { + ArrayList<ItemStack> tBusItems = new ArrayList<ItemStack>(); + tBus.mRecipeMap = getRecipeMap(); + if (isValidMetaTileEntity(tBus)) { + for (int i = tBus.getBaseMetaTileEntity().getSizeInventory() - 1; i >= 0; i--) { + if (tBus.getBaseMetaTileEntity().getStackInSlot(i) != null) + tBusItems.add(tBus.getBaseMetaTileEntity().getStackInSlot(i)); + } } + + if (this.getGUIItemStack() != null) { + tBusItems.add(this.getGUIItemStack()); + } + + ArrayList<FluidStack> tFluids = getStoredFluids(); + ItemStack[] tItemInputs = tBusItems.toArray(new ItemStack[tBusItems.size()]); + FluidStack[] tFluidInputs = tFluids.toArray(new FluidStack[tFluids.size()]); + boolean state = checkRecipeGeneric(tItemInputs, tFluidInputs, 5 * GT_Utility.getTier(this.getMaxInputVoltage()), 75, 500, 10000); + if (state) { + h[count++] = true; + continue; + } + else { + AutoMap<ItemStackData> mCompleted = new AutoMap<ItemStackData>(); + AutoMap<ItemStackData> mSchematics = new AutoMap<ItemStackData>(); + for (ItemStack tInputItem : tBusItems) { + if (tInputItem != null) { + if (ItemList.Schematic_1by1.isStackEqual((Object) tInputItem) || ItemList.Schematic_2by2.isStackEqual((Object) tInputItem) || ItemList.Schematic_3by3.isStackEqual((Object) tInputItem)) { + mSchematics.put(new ItemStackData(tInputItem)); + } + } + } + if (mSchematics.size() > 0) { + for (ItemStackData g : mSchematics) { + for (ItemStack tInputItem : tBusItems) { + if (tInputItem != null) { + mCompleted.put(new ItemStackData(tInputItem)); + checkRecipe(tInputItem, g.getStack()); + } + } + } + } + + if (mCompleted != null && mCompleted.size() > 0) { + h[count++] = true; + continue; + } + else { + h[count++] = false; + continue; + } + } + } - return mCompleted != null && mCompleted.size() > 0; + for (boolean b : h) { + if (!b) { + return false; + } + } + return true; } public boolean checkRecipe(ItemStack inputStack, ItemStack schematicStack) { @@ -96,24 +174,29 @@ public class GMTE_AmazonPackager extends GregtechMeta_MultiBlockBase { ItemStack tOutputStack; if (ItemList.Schematic_1by1.isStackEqual((Object) schematicStack)&& inputStack.stackSize >= 1) { tOutputStack = GT_ModHandler.getRecipeOutput(new ItemStack[]{inputStack}); - if (tOutputStack != null && this.addOutput(tOutputStack)) { + if (tOutputStack != null && this.allowPutStack(tOutputStack, schematicStack)) { final ItemStack input = inputStack; --input.stackSize; this.mEUt = 32 * (1 << this.mTier - 1) * (1 << this.mTier - 1); - this.mMaxProgresstime = 16 / (1 << this.mTier - 1); + //this.mMaxProgresstime = 16 / (1 << this.mTier - 1); + this.mMaxProgresstime = 2; + this.addOutput(tOutputStack); + updateSlots(); return true; } return false; - } else if (ItemList.Schematic_2by2.isStackEqual((Object) schematicStack) && inputStack.stackSize >= 4) { tOutputStack = GT_ModHandler.getRecipeOutput(new ItemStack[]{inputStack, inputStack, null, inputStack, inputStack}); - if (tOutputStack != null && this.addOutput(tOutputStack)) { + if (tOutputStack != null && this.allowPutStack(tOutputStack, schematicStack)) { final ItemStack input2 = inputStack; input2.stackSize -= 4; this.mEUt = 32 * (1 << this.mTier - 1) * (1 << this.mTier - 1); - this.mMaxProgresstime = 32 / (1 << this.mTier - 1); + //this.mMaxProgresstime = 32 / (1 << this.mTier - 1); + this.mMaxProgresstime = 4; + this.addOutput(tOutputStack); + updateSlots(); return true; } return false; @@ -122,11 +205,14 @@ public class GMTE_AmazonPackager extends GregtechMeta_MultiBlockBase { tOutputStack = GT_ModHandler.getRecipeOutput(new ItemStack[]{inputStack, inputStack, inputStack, inputStack, inputStack, inputStack, inputStack, inputStack, inputStack}); - if (tOutputStack != null && this.addOutput(tOutputStack)) { + if (tOutputStack != null && this.allowPutStack(tOutputStack, schematicStack)) { final ItemStack input3 = inputStack; input3.stackSize -= 9; this.mEUt = 32 * (1 << this.mTier - 1) * (1 << this.mTier - 1); - this.mMaxProgresstime = 64 / (1 << this.mTier - 1); + //this.mMaxProgresstime = 64 / (1 << this.mTier - 1); + this.mMaxProgresstime = 6; + this.addOutput(tOutputStack); + updateSlots(); return true; } return false; @@ -135,7 +221,7 @@ public class GMTE_AmazonPackager extends GregtechMeta_MultiBlockBase { return false; } - public boolean allowPutStack(final IGregTechTileEntity aBaseMetaTileEntity, final int aIndex, final byte aSide, final ItemStack aStack, ItemStack schematicStack) { + public boolean allowPutStack(final ItemStack aStack, ItemStack schematicStack) { //If Schematic Static is not 1x1, 2x2, 3x3 if (!ItemList.Schematic_1by1.isStackEqual((Object) schematicStack) && !ItemList.Schematic_2by2.isStackEqual((Object) schematicStack) && !ItemList.Schematic_3by3.isStackEqual((Object) schematicStack)) { return GT_Recipe.GT_Recipe_Map.sBoxinatorRecipes.containsInput(aStack); diff --git a/src/resources/assets/miscutils/textures/blocks/TileEntities/CASING_AMAZON.png b/src/resources/assets/miscutils/textures/blocks/TileEntities/CASING_AMAZON.png Binary files differindex 82a6663366..88d5cb9c72 100644 --- a/src/resources/assets/miscutils/textures/blocks/TileEntities/CASING_AMAZON.png +++ b/src/resources/assets/miscutils/textures/blocks/TileEntities/CASING_AMAZON.png |