diff options
author | Alkalus <draknyte1@hotmail.com> | 2017-09-13 09:31:19 +1000 |
---|---|---|
committer | Alkalus <draknyte1@hotmail.com> | 2017-09-13 09:31:19 +1000 |
commit | 53b16ceecf633f0a95f82e047dc78bf581bd440e (patch) | |
tree | 746172df105f569b58b01fa51ed841810c944603 /src/Java/gtPlusPlus/xmod | |
parent | 4d6b6fad4c86912b72ccbe6b01f8d68b48451c2b (diff) | |
download | GT5-Unofficial-53b16ceecf633f0a95f82e047dc78bf581bd440e.tar.gz GT5-Unofficial-53b16ceecf633f0a95f82e047dc78bf581bd440e.tar.bz2 GT5-Unofficial-53b16ceecf633f0a95f82e047dc78bf581bd440e.zip |
+ Made the Auto-Crafter use power in Crafting mode.
+ Added writeItemsToGtCraftingComponents to add disassembler info to itemstacks in NBTUtils.java
Diffstat (limited to 'src/Java/gtPlusPlus/xmod')
-rw-r--r-- | src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GT4Entity_AutoCrafter.java | 158 |
1 files changed, 87 insertions, 71 deletions
diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GT4Entity_AutoCrafter.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GT4Entity_AutoCrafter.java index 54c350ba36..8ea0db5e82 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GT4Entity_AutoCrafter.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GT4Entity_AutoCrafter.java @@ -402,101 +402,117 @@ extends GT_MetaTileEntity_MultiBlockBase //Read stored data from encrypter data stick. ItemStack storedData_Output[] = NBTUtils.readItemsFromNBT(aStack, "Output"); ItemStack storedData_Input[] = NBTUtils.readItemsFromNBT(aStack); - ItemStack loadedData[] = new ItemStack[9]; - if (storedData_Input.length >= 1){ - int number = 0; - for (ItemStack a : storedData_Input){ - if (a.getItem() == ModItems.ZZZ_Empty){ - Utils.LOG_INFO("Allocating free memory into crafting manager slot "+number+"."); - loadedData[number] = null; - //ContainerWorkbench.craftMatrix.setInventorySlotContents(number, null); - //ContainerWorkbench.craftMatrix.markDirty(); - } - else { - Utils.LOG_INFO("Downloading "+a.getDisplayName()+" into crafting manager slot "+number+"."); - loadedData[number] = a; - //ContainerWorkbench.craftMatrix.setInventorySlotContents(number, a); - //ContainerWorkbench.craftMatrix.markDirty(); + if (storedData_Output != null && storedData_Input != null){ + this.mEUt = 16 * (1 << this.mTier - 1) * (1 << this.mTier - 1); + this.mMaxProgresstime = (100-(8*this.mTier)); + + + + + ItemStack loadedData[] = new ItemStack[9]; + if (storedData_Input.length >= 1){ + int number = 0; + for (ItemStack a : storedData_Input){ + if (a.getItem() == ModItems.ZZZ_Empty){ + Utils.LOG_INFO("Allocating free memory into crafting manager slot "+number+"."); + loadedData[number] = null; + //ContainerWorkbench.craftMatrix.setInventorySlotContents(number, null); + //ContainerWorkbench.craftMatrix.markDirty(); + } + else { + Utils.LOG_INFO("Downloading "+a.getDisplayName()+" into crafting manager slot "+number+"."); + loadedData[number] = a; + //ContainerWorkbench.craftMatrix.setInventorySlotContents(number, a); + //ContainerWorkbench.craftMatrix.markDirty(); + } + number++; } - number++; } - } - if (storedData_Output.length >= 1){ - int number = 0; - for (ItemStack a : storedData_Output){ - if (a.getItem() == ModItems.ZZZ_Empty){ - Utils.LOG_INFO("Allocating free memory into crafting manager Output slot "+number+"."); + if (storedData_Output.length >= 1){ + int number = 0; + for (ItemStack a : storedData_Output){ + if (a.getItem() == ModItems.ZZZ_Empty){ + Utils.LOG_INFO("Allocating free memory into crafting manager Output slot "+number+"."); - //ContainerWorkbench.craftMatrix.setInventorySlotContents(number, null); - //ContainerWorkbench.craftMatrix.markDirty(); - } - else { - Utils.LOG_INFO("Downloading "+a.getDisplayName()+" into crafting manager Output slot "+number+"."); + //ContainerWorkbench.craftMatrix.setInventorySlotContents(number, null); + //ContainerWorkbench.craftMatrix.markDirty(); + } + else { + Utils.LOG_INFO("Downloading "+a.getDisplayName()+" into crafting manager Output slot "+number+"."); - //ContainerWorkbench.craftMatrix.setInventorySlotContents(number, a); - //ContainerWorkbench.craftMatrix.markDirty(); + //ContainerWorkbench.craftMatrix.setInventorySlotContents(number, a); + //ContainerWorkbench.craftMatrix.markDirty(); + } + number++; } - number++; } - } - boolean areInputsCorrect[] = new boolean[9]; - int counter=0; - for (ItemStack inputItem : loadedData){ - Utils.LOG_INFO("Required Input Iteration. Size: "+loadedData.length); - if (inputItem == null){ - Utils.LOG_INFO("Require Input was null setting to true. ["+counter+"]"); - areInputsCorrect[counter] = true; - } - else if (inputItem != null){ - //Check input busses for recipe components - for (GT_MetaTileEntity_Hatch_InputBus x : this.mInputBusses){ - Utils.LOG_INFO("Input Bus Iteration. Looking for "+inputItem.getDisplayName()); - if (x.mInventory.length > 0){ - for (ItemStack r : x.mInventory){ - if (r != null){ - Utils.LOG_INFO("Input Bus Inventory Iteration - Found:" +r.getDisplayName()); - if (GT_Utility.areStacksEqual(r, inputItem)){ - this.depleteInput(inputItem); - areInputsCorrect[counter] = true; - Utils.LOG_INFO("Require Input was found setting to true. ["+counter+"]"); + boolean areInputsCorrect[] = new boolean[9]; + int counter=0; + for (ItemStack inputItem : loadedData){ + Utils.LOG_INFO("Required Input Iteration. Size: "+loadedData.length); + if (inputItem == null){ + Utils.LOG_INFO("Require Input was null setting to true. ["+counter+"]"); + areInputsCorrect[counter] = true; + } + else if (inputItem != null){ + //Check input busses for recipe components + for (GT_MetaTileEntity_Hatch_InputBus x : this.mInputBusses){ + Utils.LOG_INFO("Input Bus Iteration. Looking for "+inputItem.getDisplayName()); + if (x.mInventory.length > 0){ + for (ItemStack r : x.mInventory){ + if (r != null){ + Utils.LOG_INFO("Input Bus Inventory Iteration - Found:" +r.getDisplayName()); + if (GT_Utility.areStacksEqual(r, inputItem)){ + this.depleteInput(inputItem); + areInputsCorrect[counter] = true; + Utils.LOG_INFO("Require Input was found setting to true. ["+counter+"]"); + } } } } } - } - } - counter++; - } - int mCorrectInputs=0; - for (boolean isValid : areInputsCorrect){ - if (isValid){ - mCorrectInputs++; + } + counter++; } - else { - Utils.LOG_INFO("Input in Slot "+mCorrectInputs+" was not valid."); + if (this.mTier > 5) { + this.mMaxProgresstime >>= this.mTier - 5; } - } - if (mCorrectInputs == 9){ - this.addOutput(storedData_Output[0]); - } + int mCorrectInputs=0; + for (boolean isValid : areInputsCorrect){ + if (isValid){ + mCorrectInputs++; + } + else { + //Utils.LOG_INFO("Input in Slot "+mCorrectInputs+" was not valid."); + } + } + if (mCorrectInputs == 9){ + ItemStack mOutputItem = storedData_Output[0]; + NBTUtils.writeItemsToGtCraftingComponents(mOutputItem, loadedData, true); + this.addOutput(mOutputItem); + } + else { + this.mMaxProgresstime = 0; + } - //if the are all found remove inputs - //if they are all found produce output + //if the are all found remove inputs + //if they are all found produce output - //Do Crafting - //Utils.LOG_INFO("Crafting Grid Size: "+ContainerWorkbench.craftMatrix.getSizeInventory()); - //Utils.LOG_INFO("Crafting Grid Result: "+ContainerWorkbench.craftResult.getSizeInventory()); - //Utils.LOG_INFO("Crafting Grid Result: "+ContainerWorkbench.craftResult.getStackInSlot(0)); + //Do Crafting + //Utils.LOG_INFO("Crafting Grid Size: "+ContainerWorkbench.craftMatrix.getSizeInventory()); + //Utils.LOG_INFO("Crafting Grid Result: "+ContainerWorkbench.craftResult.getSizeInventory()); + //Utils.LOG_INFO("Crafting Grid Result: "+ContainerWorkbench.craftResult.getStackInSlot(0)); + } } |