Search in sources :

Example 1 with AdvancedMenuClickHandler

use of me.mrCookieSlime.CSCoreLibPlugin.general.Inventory.ChestMenu.AdvancedMenuClickHandler in project FluffyMachines by NCBPFluffyBear.

the class AutoAncientAltar method constructMenu.

protected void constructMenu(BlockMenuPreset preset) {
    borders(preset, border, inputBorder, outputBorder);
    for (int i : getOutputSlots()) {
        preset.addMenuClickHandler(i, new AdvancedMenuClickHandler() {

            @Override
            public boolean onClick(Player p, int slot, ItemStack cursor, ClickAction action) {
                return false;
            }

            @Override
            public boolean onClick(InventoryClickEvent e, Player p, int slot, ItemStack cursor, ClickAction action) {
                if (cursor == null)
                    return true;
                return cursor.getType() == Material.AIR;
            }
        });
    }
    preset.addItem(2, new CustomItemStack(new ItemStack(Material.ENCHANTING_TABLE), "&eRecipe", "", "&bPut in the Recipe you want to craft", "&4Ancient Altar Recipes ONLY"), (p, slot, item, action) -> false);
}
Also used : InventoryClickEvent(org.bukkit.event.inventory.InventoryClickEvent) Player(org.bukkit.entity.Player) AdvancedMenuClickHandler(me.mrCookieSlime.CSCoreLibPlugin.general.Inventory.ChestMenu.AdvancedMenuClickHandler) ClickAction(me.mrCookieSlime.CSCoreLibPlugin.general.Inventory.ClickAction) CustomItemStack(io.github.thebusybiscuit.slimefun4.libraries.dough.items.CustomItemStack) CustomItemStack(io.github.thebusybiscuit.slimefun4.libraries.dough.items.CustomItemStack) ItemStack(org.bukkit.inventory.ItemStack) SlimefunItemStack(io.github.thebusybiscuit.slimefun4.api.items.SlimefunItemStack)

Example 2 with AdvancedMenuClickHandler

use of me.mrCookieSlime.CSCoreLibPlugin.general.Inventory.ChestMenu.AdvancedMenuClickHandler in project Slimefun4 by Slimefun.

the class ProgrammableAndroid method constructMenu.

private void constructMenu(@Nonnull BlockMenuPreset preset) {
    preset.drawBackground(BORDER);
    preset.drawBackground(ChestMenuUtils.getOutputSlotTexture(), OUTPUT_BORDER);
    for (int i : getOutputSlots()) {
        preset.addMenuClickHandler(i, new AdvancedMenuClickHandler() {

            @Override
            public boolean onClick(Player p, int slot, ItemStack cursor, ClickAction action) {
                return false;
            }

            @Override
            public boolean onClick(InventoryClickEvent e, Player p, int slot, ItemStack cursor, ClickAction action) {
                return cursor == null || cursor.getType() == null || cursor.getType() == Material.AIR;
            }
        });
    }
    preset.addItem(34, getFuelSource().getItem(), ChestMenuUtils.getEmptyClickHandler());
}
Also used : InventoryClickEvent(org.bukkit.event.inventory.InventoryClickEvent) Player(org.bukkit.entity.Player) AdvancedMenuClickHandler(me.mrCookieSlime.CSCoreLibPlugin.general.Inventory.ChestMenu.AdvancedMenuClickHandler) ClickAction(me.mrCookieSlime.CSCoreLibPlugin.general.Inventory.ClickAction) ItemStack(org.bukkit.inventory.ItemStack) CustomItemStack(io.github.bakedlibs.dough.items.CustomItemStack) SlimefunItemStack(io.github.thebusybiscuit.slimefun4.api.items.SlimefunItemStack)

Example 3 with AdvancedMenuClickHandler

use of me.mrCookieSlime.CSCoreLibPlugin.general.Inventory.ChestMenu.AdvancedMenuClickHandler in project FluffyMachines by NCBPFluffyBear.

the class AutoCraftingTable method constructMenu.

protected void constructMenu(BlockMenuPreset preset) {
    AutoAncientAltar.borders(preset, border, inputBorder, outputBorder);
    for (int i : keyBorder) {
        preset.addItem(i, new CustomItemStack(new ItemStack(Material.YELLOW_STAINED_GLASS_PANE), "&e&lKey Item Slot"), (p, slot, item, action) -> false);
    }
    preset.addItem(statusSlot, new CustomItemStack(new ItemStack(Material.YELLOW_STAINED_GLASS_PANE), "&e&lIdle"), (p, slot, item, action) -> false);
    for (int i : getOutputSlots()) {
        preset.addMenuClickHandler(i, new AdvancedMenuClickHandler() {

            @Override
            public boolean onClick(Player p, int slot, ItemStack cursor, ClickAction action) {
                return false;
            }

            @Override
            public boolean onClick(InventoryClickEvent e, Player p, int slot, ItemStack cursor, ClickAction action) {
                if (cursor == null)
                    return true;
                return cursor.getType() == Material.AIR;
            }
        });
    }
    preset.addItem(2, new CustomItemStack(new ItemStack(Material.CRAFTING_TABLE), "&eRecipe", "", "&bPut in the Recipe you want to craft", "&ePut in the item you want crafted", "&4Vanilla Crafting Table Recipes ONLY"), (p, slot, item, action) -> false);
}
Also used : InventoryClickEvent(org.bukkit.event.inventory.InventoryClickEvent) Player(org.bukkit.entity.Player) AdvancedMenuClickHandler(me.mrCookieSlime.CSCoreLibPlugin.general.Inventory.ChestMenu.AdvancedMenuClickHandler) ClickAction(me.mrCookieSlime.CSCoreLibPlugin.general.Inventory.ClickAction) CustomItemStack(io.github.thebusybiscuit.slimefun4.libraries.dough.items.CustomItemStack) CustomItemStack(io.github.thebusybiscuit.slimefun4.libraries.dough.items.CustomItemStack) ItemStack(org.bukkit.inventory.ItemStack) SlimefunItemStack(io.github.thebusybiscuit.slimefun4.api.items.SlimefunItemStack)

Example 4 with AdvancedMenuClickHandler

use of me.mrCookieSlime.CSCoreLibPlugin.general.Inventory.ChestMenu.AdvancedMenuClickHandler in project DynaTech by ProfElements.

the class AMachineGenerator method constructMenu.

protected void constructMenu(BlockMenuPreset preset) {
    for (int i : getBorders().get(0)) {
        preset.addItem(i, ChestMenuUtils.getBackground());
        preset.addMenuClickHandler(i, ChestMenuUtils.getEmptyClickHandler());
    }
    for (int i : getBorders().get(1)) {
        preset.addItem(i, ChestMenuUtils.getInputSlotTexture());
        preset.addMenuClickHandler(i, ChestMenuUtils.getEmptyClickHandler());
    }
    for (int i : getBorders().get(2)) {
        preset.addItem(i, ChestMenuUtils.getOutputSlotTexture());
        preset.addMenuClickHandler(i, ChestMenuUtils.getEmptyClickHandler());
    }
    preset.addItem(getProgressBarSlot(), new CustomItemStack(Material.BLACK_STAINED_GLASS_PANE, " "));
    preset.addMenuClickHandler(getProgressBarSlot(), ChestMenuUtils.getEmptyClickHandler());
    for (int i : getOutputSlots()) {
        preset.addMenuClickHandler(i, new AdvancedMenuClickHandler() {

            @Override
            public boolean onClick(Player p, int slot, ItemStack cursor, ClickAction action) {
                return false;
            }

            @Override
            public boolean onClick(InventoryClickEvent e, Player p, int slot, ItemStack cursor, ClickAction action) {
                return cursor == null || cursor.getType() == Material.AIR;
            }
        });
    }
}
Also used : InventoryClickEvent(org.bukkit.event.inventory.InventoryClickEvent) Player(org.bukkit.entity.Player) AdvancedMenuClickHandler(me.mrCookieSlime.CSCoreLibPlugin.general.Inventory.ChestMenu.AdvancedMenuClickHandler) ClickAction(me.mrCookieSlime.CSCoreLibPlugin.general.Inventory.ClickAction) CustomItemStack(io.github.thebusybiscuit.slimefun4.libraries.dough.items.CustomItemStack) CustomItemStack(io.github.thebusybiscuit.slimefun4.libraries.dough.items.CustomItemStack) ItemStack(org.bukkit.inventory.ItemStack) SlimefunItemStack(io.github.thebusybiscuit.slimefun4.api.items.SlimefunItemStack)

Aggregations

SlimefunItemStack (io.github.thebusybiscuit.slimefun4.api.items.SlimefunItemStack)4 AdvancedMenuClickHandler (me.mrCookieSlime.CSCoreLibPlugin.general.Inventory.ChestMenu.AdvancedMenuClickHandler)4 ClickAction (me.mrCookieSlime.CSCoreLibPlugin.general.Inventory.ClickAction)4 Player (org.bukkit.entity.Player)4 InventoryClickEvent (org.bukkit.event.inventory.InventoryClickEvent)4 ItemStack (org.bukkit.inventory.ItemStack)4 CustomItemStack (io.github.thebusybiscuit.slimefun4.libraries.dough.items.CustomItemStack)3 CustomItemStack (io.github.bakedlibs.dough.items.CustomItemStack)1