Package org.bukkit.inventory

Examples of org.bukkit.inventory.BrewerInventory


            if (!ItemUtil.isAPotionIngredient(stack)) {
                leftovers.add(stack);
                continue;
            }
            BrewerInventory inv = brewingStand.getInventory();
            if (InventoryUtil.fitsInSlot(stack, inv.getIngredient())) {
                if (inv.getIngredient() == null) {
                    inv.setIngredient(stack);
                } else {
                    leftovers.add(ItemUtil.addToStack(inv.getIngredient(), stack));
                }
            } else {
                leftovers.add(stack);
            }
        }
View Full Code Here


    public static void finishBrewing(BlockState brewingStand, Player player, boolean forced) {
        if (!(brewingStand instanceof BrewingStand)) {
            return;
        }

        BrewerInventory inventory = ((BrewingStand) brewingStand).getInventory();
        ItemStack ingredient = inventory.getIngredient() == null ? null : inventory.getIngredient().clone();

        if (!removeIngredient(inventory, player)) {
            return;
        }

        List<AlchemyPotion> inputList = new ArrayList<AlchemyPotion>();

        for (int i = 0; i < 3; i++) {
            ItemStack item = inventory.getItem(i);

            if (isEmpty(item) || item.getType() == Material.GLASS_BOTTLE || !PotionConfig.getInstance().isValidPotion(item)) {
                continue;
            }

            AlchemyPotion input = PotionConfig.getInstance().getPotion(item.getDurability());
            AlchemyPotion output = PotionConfig.getInstance().getPotion(input.getChildDataValue(ingredient));

            inputList.add(input);

            if (output != null) {
                inventory.setItem(i, output.toItemStack(item.getAmount()).clone());
            }
        }

        FakeBrewEvent event = new FakeBrewEvent(brewingStand.getBlock(), inventory);
        mcMMO.p.getServer().getPluginManager().callEvent(event);
View Full Code Here

TOP

Related Classes of org.bukkit.inventory.BrewerInventory

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.