Make crafting INSTANT!
This commit is contained in:
@@ -23,16 +23,6 @@ public class SlotGridCraftingResult extends SlotCrafting {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onPickupFromSlot(EntityPlayer player, ItemStack stack) {
|
public void onPickupFromSlot(EntityPlayer player, ItemStack stack) {
|
||||||
ItemStack[] matrixSlots = new ItemStack[craftingMatrix.getSizeInventory()];
|
grid.onCrafted(container);
|
||||||
|
|
||||||
for (int i = 0; i < craftingMatrix.getSizeInventory(); ++i) {
|
|
||||||
if (craftingMatrix.getStackInSlot(i) != null) {
|
|
||||||
matrixSlots[i] = craftingMatrix.getStackInSlot(i).copy();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
super.onPickupFromSlot(player, stack);
|
|
||||||
|
|
||||||
grid.onCrafted(container, matrixSlots);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -11,8 +11,8 @@ import net.minecraft.nbt.NBTTagCompound;
|
|||||||
import refinedstorage.RefinedStorageBlocks;
|
import refinedstorage.RefinedStorageBlocks;
|
||||||
import refinedstorage.block.BlockGrid;
|
import refinedstorage.block.BlockGrid;
|
||||||
import refinedstorage.block.EnumGridType;
|
import refinedstorage.block.EnumGridType;
|
||||||
|
import refinedstorage.container.ContainerGrid;
|
||||||
import refinedstorage.inventory.InventorySimple;
|
import refinedstorage.inventory.InventorySimple;
|
||||||
import refinedstorage.storage.StorageItem;
|
|
||||||
import refinedstorage.util.InventoryUtils;
|
import refinedstorage.util.InventoryUtils;
|
||||||
|
|
||||||
public class TileGrid extends TileMachine {
|
public class TileGrid extends TileMachine {
|
||||||
@@ -73,18 +73,16 @@ public class TileGrid extends TileMachine {
|
|||||||
craftingResultInventory.setInventorySlotContents(0, CraftingManager.getInstance().findMatchingRecipe(craftingInventory, worldObj));
|
craftingResultInventory.setInventorySlotContents(0, CraftingManager.getInstance().findMatchingRecipe(craftingInventory, worldObj));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onCrafted(Container container, ItemStack[] matrixSlots) {
|
public void onCrafted(ContainerGrid container) {
|
||||||
if (isConnected() && !worldObj.isRemote) {
|
if (isConnected() && !worldObj.isRemote) {
|
||||||
for (int i = 0; i < craftingInventory.getSizeInventory(); ++i) {
|
for (int i = 0; i < craftingInventory.getSizeInventory(); ++i) {
|
||||||
ItemStack slot = craftingInventory.getStackInSlot(i);
|
ItemStack slot = craftingInventory.getStackInSlot(i);
|
||||||
|
|
||||||
if (slot == null && matrixSlots[i] != null) {
|
if (slot != null) {
|
||||||
for (StorageItem item : getController().getItems()) {
|
if (slot.stackSize == 1) {
|
||||||
if (item.compareNoQuantity(matrixSlots[i].copy())) {
|
craftingInventory.setInventorySlotContents(i, getController().take(slot.copy()));
|
||||||
craftingInventory.setInventorySlotContents(i, getController().take(matrixSlots[i].copy()));
|
} else {
|
||||||
|
craftingInventory.decrStackSize(i, 1);
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user