Search in sources :

Example 6 with CraftingRecipe

use of mcjty.rftools.craftinggrid.CraftingRecipe in project RFTools by McJty.

the class GuiCrafter method selectRecipe.

private void selectRecipe() {
    int selected = recipeList.getSelected();
    lastSelected = selected;
    if (selected == -1) {
        for (int i = 0; i < 10; i++) {
            inventorySlots.getSlot(i).putStack(ItemStack.EMPTY);
        }
        keepItem.setChoice("All");
        internalRecipe.setChoice("Ext");
        return;
    }
    CraftingRecipe craftingRecipe = tileEntity.getRecipe(selected);
    InventoryCrafting inv = craftingRecipe.getInventory();
    for (int i = 0; i < 9; i++) {
        inventorySlots.getSlot(i).putStack(inv.getStackInSlot(i));
    }
    inventorySlots.getSlot(9).putStack(craftingRecipe.getResult());
    keepItem.setChoice(craftingRecipe.isKeepOne() ? "Keep" : "All");
    internalRecipe.setChoice(craftingRecipe.getCraftMode().getDescription());
}
Also used : CraftingRecipe(mcjty.rftools.craftinggrid.CraftingRecipe) InventoryCrafting(net.minecraft.inventory.InventoryCrafting)

Example 7 with CraftingRecipe

use of mcjty.rftools.craftinggrid.CraftingRecipe in project RFTools by McJty.

the class GuiCrafter method updateRecipe.

private void updateRecipe() {
    int selected = recipeList.getSelected();
    if (selected == -1) {
        return;
    }
    CraftingRecipe craftingRecipe = tileEntity.getRecipe(selected);
    boolean keepOne = "Keep".equals(keepItem.getCurrentChoice());
    CraftingRecipe.CraftMode mode;
    if ("Int".equals(internalRecipe.getCurrentChoice())) {
        mode = CraftingRecipe.CraftMode.INT;
    } else if ("Ext".equals(internalRecipe.getCurrentChoice())) {
        mode = CraftingRecipe.CraftMode.EXT;
    } else {
        mode = CraftingRecipe.CraftMode.EXTC;
    }
    craftingRecipe.setKeepOne(keepOne);
    craftingRecipe.setCraftMode(mode);
    sendChangeToServer(selected, craftingRecipe.getInventory(), craftingRecipe.getResult(), keepOne, mode);
}
Also used : CraftingRecipe(mcjty.rftools.craftinggrid.CraftingRecipe)

Aggregations

CraftingRecipe (mcjty.rftools.craftinggrid.CraftingRecipe)7 InventoryCrafting (net.minecraft.inventory.InventoryCrafting)3 ItemStack (net.minecraft.item.ItemStack)2 IRecipe (net.minecraft.item.crafting.IRecipe)2 HashMap (java.util.HashMap)1 NBTTagCompound (net.minecraft.nbt.NBTTagCompound)1 NBTTagList (net.minecraft.nbt.NBTTagList)1