private void handleWorkerAvailability(MessageWorkerAvailability msg) { if (!haveFreeWorkerSlots(msg)) return; // Only ask for things if we have a valid config. if (!canCraft(false)) return; // If we have anything at 1, build matcher for that. ItemStackMatcher matcher = matcherRequiredInputs(1); if (matcher != null) { TRPutInInventory req = new TRPutInInventory( TileEntityAutoWorkbench.this, msg.getSender(), msg.getTransactionID(), Priority.getWorkbenchInventoryOutRequestValue(), matcher, 8); _broadcastHelper.postMessage(req); return; } // Otherwise we can use a little of everything matcher = matcherRequiredInputs(8); if (matcher != null) { TRPutInInventory req = new TRPutInInventory( TileEntityAutoWorkbench.this, msg.getSender(), msg.getTransactionID(), Priority.getWorkbenchInventoryLowRequestValue(), matcher, 8); _broadcastHelper.postMessage(req); } }
private void handleStorageAvailable(MessageIsStorageAvailable msg) { ItemStackMatcher matcher = matcherRequiredInputs(32); if (matcher != null) { TRPutInInventory req = new TRPutInInventory( TileEntityAutoWorkbench.this, msg.getSender(), msg.getTransactionID(), Priority.getWorkbenchStorageAvailValue(), matcher, 32); _broadcastHelper.postMessage(req); } }
private void handleItemRequest(MessageItemRequest msg) { // Anything in the out slot they can have ItemStack stack = _craftOutput.getStackInSlot(0); if (stack != null && msg.getMatcher().matches(stack)) { TRGetFromInventory req = new TRGetFromInventory( TileEntityAutoWorkbench.this, msg.getSender(), msg.getTransactionID(), Priority.getWorkbenchItemRequestValue(), new ItemStackMatcher(stack), msg.getQuantity()); _broadcastHelper.postMessage(req); } }