mirror of
https://github.com/GTNewHorizons/TinkersConstruct.git
synced 2026-11-25 06:24:37 +00:00
Dump button, dumps the grid to linked inventory (#228)
This commit is contained in:
1 parent
3548fcb9a9
commit
611d84923d
6 files changed
+114
No files matched your search
@@ -434,4 +434,21 @@ public class CraftingStationContainer extends Container {
|
||||
|
||||
return didSomething;
|
||||
}
|
||||
|
||||
// Dump crafting grid to connected chests
|
||||
public void dumpCraftingGrid() {
|
||||
if (logic.slotCount == 0) return;
|
||||
|
||||
// 46 is the first slot index of the attached inventory
|
||||
for (int i = 0; i < 9; i++) {
|
||||
ItemStack stack = craftMatrix.getStackInSlot(i);
|
||||
if (stack != null && stack.stackSize > 0) {
|
||||
if (mergeItemStack(stack, 46, 46 + logic.slotCount, false)) {
|
||||
craftMatrix.setInventorySlotContents(i, stack.stackSize > 0 ? stack : null);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
this.onCraftMatrixChanged(this.craftMatrix);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user