}
}
//Not enough material
return null;
}
AutoCraftingInventory crafter = new AutoCraftingInventory(null);//TODO
for(int i=0;i<9;i++) {
int j = toUse[i];
if(j != -1) crafter.setInventorySlotContents(i, inv.getStackInSlot(j));
}
if(!cache.matches(crafter, getWorld())) return null; //Fix MystCraft
ItemStack result = cache.getCraftingResult(crafter);
if(result == null) return null;
if(!resultInv.getIDStackInSlot(0).getItem().equalsWithoutNBT(ItemIdentifier.get(result))) return null;
crafter = new AutoCraftingInventory(null);//TODO
for(int i=0;i<9;i++) {
int j = toUse[i];
if(j != -1) crafter.setInventorySlotContents(i, inv.decrStackSize(j, 1));
}
result = cache.getCraftingResult(crafter);
if(fake == null) {
fake = MainProxy.getFakePlayer(this.container);
}
result = result.copy();
SlotCrafting craftingSlot = new SlotCrafting(fake, crafter, resultInv, 0, 0, 0);
craftingSlot.onPickupFromSlot(fake, result);
for(int i=0;i<9;i++) {
ItemStack left = crafter.getStackInSlot(i);
crafter.setInventorySlotContents(i, null);
if(left != null) {
left.stackSize = inv.addCompressed(left, false);
if(left.stackSize > 0) {
ItemIdentifierInventory.dropItems(getWorld(), left, getX(), getY(), getZ());
}