Creating the actual patterns now
This commit is contained in:
@@ -121,6 +121,12 @@ public class ContainerGrid extends ContainerBase {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!player.worldObj.isRemote && slot instanceof SlotDisabled && grid.getType() == EnumGridType.PATTERN && slot.getHasStack()) {
|
||||||
|
((TileGrid) grid).onCreatePattern();
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
return super.func_184996_a(id, clickedButton, clickType, player);
|
return super.func_184996_a(id, clickedButton, clickType, player);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,10 +10,12 @@ import net.minecraft.item.crafting.CraftingManager;
|
|||||||
import net.minecraft.nbt.NBTTagCompound;
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
import refinedstorage.RefinedStorage;
|
import refinedstorage.RefinedStorage;
|
||||||
import refinedstorage.RefinedStorageBlocks;
|
import refinedstorage.RefinedStorageBlocks;
|
||||||
|
import refinedstorage.RefinedStorageItems;
|
||||||
import refinedstorage.block.BlockGrid;
|
import refinedstorage.block.BlockGrid;
|
||||||
import refinedstorage.block.EnumGridType;
|
import refinedstorage.block.EnumGridType;
|
||||||
import refinedstorage.container.ContainerGrid;
|
import refinedstorage.container.ContainerGrid;
|
||||||
import refinedstorage.inventory.InventorySimple;
|
import refinedstorage.inventory.InventorySimple;
|
||||||
|
import refinedstorage.item.ItemPattern;
|
||||||
import refinedstorage.network.MessageGridSettingsUpdate;
|
import refinedstorage.network.MessageGridSettingsUpdate;
|
||||||
import refinedstorage.network.MessageGridStoragePull;
|
import refinedstorage.network.MessageGridStoragePull;
|
||||||
import refinedstorage.network.MessageGridStoragePush;
|
import refinedstorage.network.MessageGridStoragePush;
|
||||||
@@ -159,6 +161,27 @@ public class TileGrid extends TileMachine implements IGrid {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void onCreatePattern() {
|
||||||
|
ItemStack crafted = craftingResultInventory.getStackInSlot(0);
|
||||||
|
|
||||||
|
if (patternsInventory.getStackInSlot(1) == null && patternsInventory.getStackInSlot(0) != null && patternsInventory.getStackInSlot(0).stackSize > 0) {
|
||||||
|
patternsInventory.decrStackSize(0, 1);
|
||||||
|
|
||||||
|
ItemStack pattern = new ItemStack(RefinedStorageItems.PATTERN);
|
||||||
|
ItemPattern.setResult(pattern, crafted);
|
||||||
|
|
||||||
|
for (int i = 0; i < 9; ++i) {
|
||||||
|
ItemStack slot = craftingInventory.getStackInSlot(i);
|
||||||
|
|
||||||
|
if (slot != null) {
|
||||||
|
ItemPattern.setSlot(pattern, i, slot);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
patternsInventory.setInventorySlotContents(1, pattern);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public void onRecipeTransfer(ItemStack[][] recipe) {
|
public void onRecipeTransfer(ItemStack[][] recipe) {
|
||||||
if (isConnected()) {
|
if (isConnected()) {
|
||||||
for (int i = 0; i < craftingInventory.getSizeInventory(); ++i) {
|
for (int i = 0; i < craftingInventory.getSizeInventory(); ++i) {
|
||||||
|
|||||||
Reference in New Issue
Block a user