Search in sources :

Example 96 with Container

use of net.minecraft.server.v1_16_R1.Container in project TheAPI by TheDevTec.

the class v1_9_R1 method setGUITitle.

@Override
public void setGUITitle(Player player, Object container, String legacy, int size, String title) {
    EntityPlayer nmsPlayer = ((CraftPlayer) player).getHandle();
    int id = ((Container) container).windowId;
    List<net.minecraft.server.v1_9_R1.ItemStack> nmsItems = ((Container) container).b;
    BukkitLoader.getPacketHandler().send(player, packetOpenWindow(id, legacy, size, title));
    int i = 0;
    for (net.minecraft.server.v1_9_R1.ItemStack o : nmsItems) BukkitLoader.getPacketHandler().send(player, packetSetSlot(id, i++, o));
    nmsPlayer.activeContainer = (Container) container;
    ((Container) container).addSlotListener(nmsPlayer);
    ((Container) container).checkReachable = false;
}
Also used : CraftContainer(org.bukkit.craftbukkit.v1_9_R1.inventory.CraftContainer) Container(net.minecraft.server.v1_9_R1.Container) EntityPlayer(net.minecraft.server.v1_9_R1.EntityPlayer) CraftPlayer(org.bukkit.craftbukkit.v1_9_R1.entity.CraftPlayer) ItemStack(org.bukkit.inventory.ItemStack) CraftItemStack(org.bukkit.craftbukkit.v1_9_R1.inventory.CraftItemStack)

Example 97 with Container

use of net.minecraft.server.v1_16_R1.Container in project TheAPI by TheDevTec.

the class v1_9_R1 method openAnvilGUI.

@Override
public void openAnvilGUI(Player player, Object con, String title, ItemStack[] items) {
    ContainerAnvil container = (ContainerAnvil) con;
    EntityPlayer nmsPlayer = ((CraftPlayer) player).getHandle();
    int id = container.windowId;
    net.minecraft.server.v1_9_R1.ItemStack[] nmsItems = new net.minecraft.server.v1_9_R1.ItemStack[items.length];
    for (int i = 0; i < items.length; ++i) {
        ItemStack is = items[i];
        if (is == null || is.getType() == Material.AIR)
            continue;
        net.minecraft.server.v1_9_R1.ItemStack item = null;
        container.setItem(i, item = (net.minecraft.server.v1_9_R1.ItemStack) asNMSItem(is));
        nmsItems[i] = item;
    }
    BukkitLoader.getPacketHandler().send(player, packetOpenWindow(id, "minecraft:anvil", 0, title));
    int i = 0;
    for (net.minecraft.server.v1_9_R1.ItemStack o : nmsItems) BukkitLoader.getPacketHandler().send(player, packetSetSlot(id, i++, o));
    nmsPlayer.activeContainer.transferTo((Container) container, (CraftPlayer) player);
    nmsPlayer.activeContainer = (Container) container;
    ((Container) container).addSlotListener(nmsPlayer);
    container.checkReachable = false;
}
Also used : CraftContainer(org.bukkit.craftbukkit.v1_9_R1.inventory.CraftContainer) Container(net.minecraft.server.v1_9_R1.Container) ContainerAnvil(net.minecraft.server.v1_9_R1.ContainerAnvil) EntityPlayer(net.minecraft.server.v1_9_R1.EntityPlayer) CraftPlayer(org.bukkit.craftbukkit.v1_9_R1.entity.CraftPlayer) ItemStack(org.bukkit.inventory.ItemStack) CraftItemStack(org.bukkit.craftbukkit.v1_9_R1.inventory.CraftItemStack)

Example 98 with Container

use of net.minecraft.server.v1_16_R1.Container in project TheAPI by TheDevTec.

the class v1_9_R1 method openGUI.

@Override
public void openGUI(Player player, Object container, String legacy, int size, String title, ItemStack[] items) {
    EntityPlayer nmsPlayer = ((CraftPlayer) player).getHandle();
    int id = ((Container) container).windowId;
    net.minecraft.server.v1_9_R1.ItemStack[] nmsItems = new net.minecraft.server.v1_9_R1.ItemStack[items.length];
    for (int i = 0; i < items.length; ++i) {
        ItemStack is = items[i];
        if (is == null || is.getType() == Material.AIR)
            continue;
        net.minecraft.server.v1_9_R1.ItemStack item = null;
        ((Container) container).setItem(i, item = (net.minecraft.server.v1_9_R1.ItemStack) asNMSItem(is));
        nmsItems[i] = item;
    }
    BukkitLoader.getPacketHandler().send(player, packetOpenWindow(id, legacy, size, title));
    int i = 0;
    for (net.minecraft.server.v1_9_R1.ItemStack o : nmsItems) BukkitLoader.getPacketHandler().send(player, packetSetSlot(id, i++, o));
    nmsPlayer.activeContainer.transferTo((Container) container, (CraftPlayer) player);
    nmsPlayer.activeContainer = (Container) container;
    ((Container) container).addSlotListener(nmsPlayer);
    ((Container) container).checkReachable = false;
}
Also used : CraftContainer(org.bukkit.craftbukkit.v1_9_R1.inventory.CraftContainer) Container(net.minecraft.server.v1_9_R1.Container) EntityPlayer(net.minecraft.server.v1_9_R1.EntityPlayer) CraftPlayer(org.bukkit.craftbukkit.v1_9_R1.entity.CraftPlayer) ItemStack(org.bukkit.inventory.ItemStack) CraftItemStack(org.bukkit.craftbukkit.v1_9_R1.inventory.CraftItemStack)

Example 99 with Container

use of net.minecraft.server.v1_16_R1.Container in project TheAPI by TheDevTec.

the class v1_8_R2 method setGUITitle.

@Override
public void setGUITitle(Player player, Object container, String legacy, int size, String title) {
    EntityPlayer nmsPlayer = ((CraftPlayer) player).getHandle();
    int id = ((Container) container).windowId;
    List<net.minecraft.server.v1_8_R2.ItemStack> nmsItems = ((Container) container).b;
    BukkitLoader.getPacketHandler().send(player, packetOpenWindow(id, legacy, size, title));
    int i = 0;
    for (net.minecraft.server.v1_8_R2.ItemStack o : nmsItems) BukkitLoader.getPacketHandler().send(player, packetSetSlot(id, i++, o));
    nmsPlayer.activeContainer = (Container) container;
    ((Container) container).addSlotListener(nmsPlayer);
    ((Container) container).checkReachable = false;
}
Also used : IContainer(net.minecraft.server.v1_8_R2.IContainer) CraftContainer(org.bukkit.craftbukkit.v1_8_R2.inventory.CraftContainer) Container(net.minecraft.server.v1_8_R2.Container) EntityPlayer(net.minecraft.server.v1_8_R2.EntityPlayer) CraftPlayer(org.bukkit.craftbukkit.v1_8_R2.entity.CraftPlayer) ItemStack(org.bukkit.inventory.ItemStack) CraftItemStack(org.bukkit.craftbukkit.v1_8_R2.inventory.CraftItemStack)

Example 100 with Container

use of net.minecraft.server.v1_16_R1.Container in project TheAPI by TheDevTec.

the class v1_8_R2 method openAnvilGUI.

@Override
public void openAnvilGUI(Player player, Object con, String title, ItemStack[] items) {
    ContainerAnvil container = (ContainerAnvil) con;
    EntityPlayer nmsPlayer = ((CraftPlayer) player).getHandle();
    int id = container.windowId;
    net.minecraft.server.v1_8_R2.ItemStack[] nmsItems = new net.minecraft.server.v1_8_R2.ItemStack[items.length];
    for (int i = 0; i < items.length; ++i) {
        ItemStack is = items[i];
        if (is == null || is.getType() == Material.AIR)
            continue;
        net.minecraft.server.v1_8_R2.ItemStack item = null;
        container.setItem(i, item = (net.minecraft.server.v1_8_R2.ItemStack) asNMSItem(is));
        nmsItems[i] = item;
    }
    BukkitLoader.getPacketHandler().send(player, packetOpenWindow(id, "minecraft:anvil", 0, title));
    int i = 0;
    for (net.minecraft.server.v1_8_R2.ItemStack o : nmsItems) BukkitLoader.getPacketHandler().send(player, packetSetSlot(id, i++, o));
    nmsPlayer.activeContainer.transferTo((Container) container, (CraftPlayer) player);
    nmsPlayer.activeContainer = (Container) container;
    ((Container) container).addSlotListener(nmsPlayer);
    container.checkReachable = false;
}
Also used : IContainer(net.minecraft.server.v1_8_R2.IContainer) CraftContainer(org.bukkit.craftbukkit.v1_8_R2.inventory.CraftContainer) Container(net.minecraft.server.v1_8_R2.Container) ContainerAnvil(net.minecraft.server.v1_8_R2.ContainerAnvil) EntityPlayer(net.minecraft.server.v1_8_R2.EntityPlayer) CraftPlayer(org.bukkit.craftbukkit.v1_8_R2.entity.CraftPlayer) ItemStack(org.bukkit.inventory.ItemStack) CraftItemStack(org.bukkit.craftbukkit.v1_8_R2.inventory.CraftItemStack)

Aggregations

ItemStack (org.bukkit.inventory.ItemStack)46 Container (net.minecraft.server.v1_12_R1.Container)9 Container (net.minecraft.server.v1_16_R3.Container)9 Container (org.flyte.api.v1.Container)9 FailedNbt (com.ruinscraft.panilla.api.exception.FailedNbt)8 INbtTagCompound (com.ruinscraft.panilla.api.nbt.INbtTagCompound)8 Container (net.minecraft.server.v1_11_R1.Container)8 Container (net.minecraft.server.v1_14_R1.Container)8 Container (net.minecraft.server.v1_15_R1.Container)8 Container (net.minecraft.server.v1_16_R1.Container)8 Container (net.minecraft.server.v1_16_R2.Container)8 Container (net.minecraft.server.v1_8_R3.Container)8 Test (org.junit.Test)8 Container (net.minecraft.server.v1_13_R1.Container)7 Container (net.minecraft.server.v1_13_R2.Container)6 Container (net.minecraft.server.v1_10_R1.Container)5 EntityPlayer (net.minecraft.server.v1_8_R3.EntityPlayer)5 Tasks (flyteidl.core.Tasks)4 SelfContainer (io.github.bananapuncher714.crafters.implementation.v1_11_R1.ContainerManager_v1_11_R1.SelfContainer)4 HashMap (java.util.HashMap)4