Search in sources :

Example 1 with IconMenuItem

use of de.Keyle.MyPet.api.gui.IconMenuItem in project MyPet by xXKeyleXx.

the class IconMenuInventory method update.

@Override
public void update(IconMenu menu) {
    for (int slot = 0; slot < size; slot++) {
        IconMenuItem menuItem = menu.getOption(slot);
        if (menuItem != null) {
            ItemStack item = createItemStack(menuItem);
            minecraftInventory.setItem(slot, item);
        } else {
            minecraftInventory.setItem(slot, ItemStack.a);
        }
    }
}
Also used : IconMenuItem(de.Keyle.MyPet.api.gui.IconMenuItem) CraftItemStack(org.bukkit.craftbukkit.v1_12_R1.inventory.CraftItemStack) ItemStack(net.minecraft.server.v1_12_R1.ItemStack)

Example 2 with IconMenuItem

use of de.Keyle.MyPet.api.gui.IconMenuItem in project MyPet by xXKeyleXx.

the class IconMenuInventory method update.

@Override
public void update(IconMenu menu) {
    for (int slot = 0; slot < size; slot++) {
        IconMenuItem menuItem = menu.getOption(slot);
        if (menuItem != null) {
            ItemStack item = createItemStack(menuItem);
            minecraftInventory.setItem(slot, item);
        } else {
            minecraftInventory.setItem(slot, null);
        }
    }
}
Also used : IconMenuItem(de.Keyle.MyPet.api.gui.IconMenuItem) ItemStack(net.minecraft.server.v1_7_R4.ItemStack) CraftItemStack(org.bukkit.craftbukkit.v1_7_R4.inventory.CraftItemStack)

Example 3 with IconMenuItem

use of de.Keyle.MyPet.api.gui.IconMenuItem in project MyPet by xXKeyleXx.

the class IconMenuInventory method open.

@Override
public void open(IconMenu menu, HumanEntity player) {
    size = menu.getSize();
    minecraftInventory = new CustomInventory(size, menu.getTitle());
    for (int slot = 0; slot < size; slot++) {
        IconMenuItem menuItem = menu.getOption(slot);
        if (menuItem != null) {
            ItemStack item = createItemStack(menuItem);
            minecraftInventory.setItem(slot, item);
        }
    }
    player.openInventory(minecraftInventory.getBukkitInventory());
}
Also used : IconMenuItem(de.Keyle.MyPet.api.gui.IconMenuItem) ItemStack(net.minecraft.server.v1_7_R4.ItemStack) CraftItemStack(org.bukkit.craftbukkit.v1_7_R4.inventory.CraftItemStack) CustomInventory(de.Keyle.MyPet.compat.v1_7_R4.util.inventory.CustomInventory)

Example 4 with IconMenuItem

use of de.Keyle.MyPet.api.gui.IconMenuItem in project MyPet by xXKeyleXx.

the class IconMenuInventory method open.

@Override
public void open(IconMenu menu, HumanEntity player) {
    size = menu.getSize();
    minecraftInventory = new CustomInventory(size, menu.getTitle());
    for (int slot = 0; slot < size; slot++) {
        IconMenuItem menuItem = menu.getOption(slot);
        if (menuItem != null) {
            ItemStack item = createItemStack(menuItem);
            minecraftInventory.setItem(slot, item);
        }
    }
    player.openInventory(minecraftInventory.getBukkitInventory());
}
Also used : IconMenuItem(de.Keyle.MyPet.api.gui.IconMenuItem) ItemStack(net.minecraft.server.v1_8_R1.ItemStack) CraftItemStack(org.bukkit.craftbukkit.v1_8_R1.inventory.CraftItemStack) CustomInventory(de.Keyle.MyPet.compat.v1_8_R1.util.inventory.CustomInventory)

Example 5 with IconMenuItem

use of de.Keyle.MyPet.api.gui.IconMenuItem in project MyPet by xXKeyleXx.

the class IconMenuInventory method update.

@Override
public void update(IconMenu menu) {
    for (int slot = 0; slot < size; slot++) {
        IconMenuItem menuItem = menu.getOption(slot);
        if (menuItem != null) {
            ItemStack item = createItemStack(menuItem);
            minecraftInventory.setItem(slot, item);
        } else {
            minecraftInventory.setItem(slot, null);
        }
    }
}
Also used : IconMenuItem(de.Keyle.MyPet.api.gui.IconMenuItem) ItemStack(net.minecraft.server.v1_8_R1.ItemStack) CraftItemStack(org.bukkit.craftbukkit.v1_8_R1.inventory.CraftItemStack)

Aggregations

IconMenuItem (de.Keyle.MyPet.api.gui.IconMenuItem)21 IconMenu (de.Keyle.MyPet.api.gui.IconMenu)3 TagCompound (de.keyle.knbt.TagCompound)2 ItemStack (net.minecraft.server.v1_10_R1.ItemStack)2 ItemStack (net.minecraft.server.v1_11_R1.ItemStack)2 ItemStack (net.minecraft.server.v1_12_R1.ItemStack)2 ItemStack (net.minecraft.server.v1_7_R4.ItemStack)2 ItemStack (net.minecraft.server.v1_8_R1.ItemStack)2 ItemStack (net.minecraft.server.v1_8_R2.ItemStack)2 ItemStack (net.minecraft.server.v1_8_R3.ItemStack)2 ItemStack (net.minecraft.server.v1_9_R1.ItemStack)2 ItemStack (net.minecraft.server.v1_9_R2.ItemStack)2 CraftItemStack (org.bukkit.craftbukkit.v1_10_R1.inventory.CraftItemStack)2 CraftItemStack (org.bukkit.craftbukkit.v1_11_R1.inventory.CraftItemStack)2 CraftItemStack (org.bukkit.craftbukkit.v1_12_R1.inventory.CraftItemStack)2 CraftItemStack (org.bukkit.craftbukkit.v1_7_R4.inventory.CraftItemStack)2 CraftItemStack (org.bukkit.craftbukkit.v1_8_R1.inventory.CraftItemStack)2 CraftItemStack (org.bukkit.craftbukkit.v1_8_R2.inventory.CraftItemStack)2 CraftItemStack (org.bukkit.craftbukkit.v1_8_R3.inventory.CraftItemStack)2 CraftItemStack (org.bukkit.craftbukkit.v1_9_R1.inventory.CraftItemStack)2