Search in sources :

Example 66 with EntityPlayer

use of net.minecraft.server.v1_13_R2.EntityPlayer in project TheAPI by TheDevTec.

the class v1_15_R1 method closeGUI.

@Override
public void closeGUI(Player player, Object container, boolean closePacket) {
    if (closePacket)
        BukkitLoader.getPacketHandler().send(player, new PacketPlayOutCloseWindow(BukkitLoader.getNmsProvider().getContainerId(container)));
    EntityPlayer nmsPlayer = (EntityPlayer) getPlayer(player);
    nmsPlayer.activeContainer = nmsPlayer.defaultContainer;
    ((Container) container).transferTo(nmsPlayer.activeContainer, (CraftPlayer) player);
}
Also used : CraftContainer(org.bukkit.craftbukkit.v1_15_R1.inventory.CraftContainer) Container(net.minecraft.server.v1_15_R1.Container) EntityPlayer(net.minecraft.server.v1_15_R1.EntityPlayer) PacketPlayOutCloseWindow(net.minecraft.server.v1_15_R1.PacketPlayOutCloseWindow)

Example 67 with EntityPlayer

use of net.minecraft.server.v1_13_R2.EntityPlayer in project TheAPI by TheDevTec.

the class v1_16_R2 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_16_R2.ItemStack[] nmsItems = new net.minecraft.server.v1_16_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_16_R2.ItemStack item = null;
        ((Container) container).setItem(i, item = (net.minecraft.server.v1_16_R2.ItemStack) asNMSItem(is));
        nmsItems[i] = item;
    }
    BukkitLoader.getPacketHandler().send(player, packetOpenWindow(id, legacy, size, title));
    int i = 0;
    for (net.minecraft.server.v1_16_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) container).checkReachable = false;
}
Also used : Container(net.minecraft.server.v1_16_R2.Container) CraftContainer(org.bukkit.craftbukkit.v1_16_R2.inventory.CraftContainer) EntityPlayer(net.minecraft.server.v1_16_R2.EntityPlayer) CraftPlayer(org.bukkit.craftbukkit.v1_16_R2.entity.CraftPlayer) CraftItemStack(org.bukkit.craftbukkit.v1_16_R2.inventory.CraftItemStack) ItemStack(org.bukkit.inventory.ItemStack)

Example 68 with EntityPlayer

use of net.minecraft.server.v1_13_R2.EntityPlayer in project TheAPI by TheDevTec.

the class v1_16_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;
    NonNullList<net.minecraft.server.v1_16_R2.ItemStack> nmsItems = ((Container) container).items;
    BukkitLoader.getPacketHandler().send(player, packetOpenWindow(id, legacy, size, title));
    int i = 0;
    for (net.minecraft.server.v1_16_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 : Container(net.minecraft.server.v1_16_R2.Container) CraftContainer(org.bukkit.craftbukkit.v1_16_R2.inventory.CraftContainer) EntityPlayer(net.minecraft.server.v1_16_R2.EntityPlayer) CraftPlayer(org.bukkit.craftbukkit.v1_16_R2.entity.CraftPlayer) CraftItemStack(org.bukkit.craftbukkit.v1_16_R2.inventory.CraftItemStack) ItemStack(org.bukkit.inventory.ItemStack)

Example 69 with EntityPlayer

use of net.minecraft.server.v1_13_R2.EntityPlayer in project TheAPI by TheDevTec.

the class v1_16_R2 method packetRespawn.

@Override
public Object packetRespawn(Player player) {
    EntityPlayer entityPlayer = (EntityPlayer) getPlayer(player);
    WorldServer worldserver = entityPlayer.getWorldServer();
    return new PacketPlayOutRespawn(worldserver.getDimensionManager(), worldserver.getDimensionKey(), BiomeManager.a(worldserver.getSeed()), entityPlayer.playerInteractManager.getGameMode(), entityPlayer.playerInteractManager.c(), worldserver.isDebugWorld(), worldserver.isFlatWorld(), true);
}
Also used : EntityPlayer(net.minecraft.server.v1_16_R2.EntityPlayer) WorldServer(net.minecraft.server.v1_16_R2.WorldServer) PacketPlayOutRespawn(net.minecraft.server.v1_16_R2.PacketPlayOutRespawn)

Example 70 with EntityPlayer

use of net.minecraft.server.v1_13_R2.EntityPlayer in project TheAPI by TheDevTec.

the class v1_7_R4 method closeGUI.

@Override
public void closeGUI(Player player, Object container, boolean closePacket) {
    if (closePacket)
        BukkitLoader.getPacketHandler().send(player, new PacketPlayOutCloseWindow(BukkitLoader.getNmsProvider().getContainerId(container)));
    EntityPlayer nmsPlayer = (EntityPlayer) getPlayer(player);
    nmsPlayer.activeContainer = nmsPlayer.defaultContainer;
    ((Container) container).transferTo(nmsPlayer.activeContainer, (CraftPlayer) player);
}
Also used : IContainer(net.minecraft.server.v1_7_R4.IContainer) CraftContainer(org.bukkit.craftbukkit.v1_7_R4.inventory.CraftContainer) Container(net.minecraft.server.v1_7_R4.Container) EntityPlayer(net.minecraft.server.v1_7_R4.EntityPlayer) PacketPlayOutCloseWindow(net.minecraft.server.v1_7_R4.PacketPlayOutCloseWindow)

Aggregations

Player (org.bukkit.entity.Player)83 ItemStack (org.bukkit.inventory.ItemStack)46 EntityPlayer (net.minecraft.server.v1_8_R3.EntityPlayer)44 EntityPlayer (net.minecraft.server.v1_12_R1.EntityPlayer)40 EntityPlayer (net.minecraft.server.v1_16_R3.EntityPlayer)40 CraftPlayer (org.bukkit.craftbukkit.v1_16_R3.entity.CraftPlayer)32 EntityPlayer (net.minecraft.server.v1_15_R1.EntityPlayer)31 Channel (io.netty.channel.Channel)30 EntityPlayer (net.minecraft.server.v1_13_R2.EntityPlayer)29 CraftPlayer (org.bukkit.craftbukkit.v1_12_R1.entity.CraftPlayer)29 ChannelPipeline (io.netty.channel.ChannelPipeline)28 EntityPlayer (net.minecraft.server.v1_10_R1.EntityPlayer)27 EntityPlayer (net.minecraft.server.v1_11_R1.EntityPlayer)27 MyPet (de.Keyle.MyPet.api.entity.MyPet)26 EntityPlayer (net.minecraft.server.v1_14_R1.EntityPlayer)25 CraftPlayer (org.bukkit.craftbukkit.v1_15_R1.entity.CraftPlayer)24 CraftPlayer (org.bukkit.craftbukkit.v1_8_R3.entity.CraftPlayer)24 Behavior (de.Keyle.MyPet.api.skill.skills.Behavior)22 NPCHolder (net.citizensnpcs.npc.ai.NPCHolder)19 SkinnableEntity (net.citizensnpcs.npc.skin.SkinnableEntity)19