Search in sources :

Example 1 with EntityPlayer

use of net.minecraft.server.level.EntityPlayer in project PublicCrafters by BananaPuncher714.

the class ContainerManager_v1_17_1 method animate.

@Override
public void animate(Player player) {
    EntityPlayer NMSPlayer = ((CraftPlayer) player).getHandle();
    broadcastPacket(player, new PacketPlayOutAnimation(NMSPlayer, ThreadLocalRandom.current().nextInt(2) == 1 ? 0 : 3));
}
Also used : EntityPlayer(net.minecraft.server.level.EntityPlayer) CraftPlayer(org.bukkit.craftbukkit.v1_17_R1.entity.CraftPlayer) PacketPlayOutAnimation(net.minecraft.network.protocol.game.PacketPlayOutAnimation)

Example 2 with EntityPlayer

use of net.minecraft.server.level.EntityPlayer in project PublicCrafters by BananaPuncher714.

the class ContainerManager_v1_17_1 method broadcastPacket.

private void broadcastPacket(Player origin, Packet<?> packet) {
    Location location = origin.getLocation();
    for (Player player : Bukkit.getOnlinePlayers()) {
        if (player == origin) {
            continue;
        }
        Location ploc = player.getLocation();
        if (ploc.getWorld() != location.getWorld()) {
            continue;
        }
        if (ploc.distanceSquared(location) > 128) {
            continue;
        }
        EntityPlayer NMSPlayer = ((CraftPlayer) player).getHandle();
        NMSPlayer.b.sendPacket(packet);
    }
}
Also used : CraftPlayer(org.bukkit.craftbukkit.v1_17_R1.entity.CraftPlayer) Player(org.bukkit.entity.Player) EntityPlayer(net.minecraft.server.level.EntityPlayer) EntityPlayer(net.minecraft.server.level.EntityPlayer) CraftPlayer(org.bukkit.craftbukkit.v1_17_R1.entity.CraftPlayer) Location(org.bukkit.Location)

Example 3 with EntityPlayer

use of net.minecraft.server.level.EntityPlayer in project PublicCrafters by BananaPuncher714.

the class ContainerManager_v1_17_R1 method broadcastPacket.

private void broadcastPacket(Player origin, Packet<?> packet) {
    Location location = origin.getLocation();
    for (Player player : Bukkit.getOnlinePlayers()) {
        if (player == origin) {
            continue;
        }
        Location ploc = player.getLocation();
        if (ploc.getWorld() != location.getWorld()) {
            continue;
        }
        if (ploc.distanceSquared(location) > 128) {
            continue;
        }
        EntityPlayer NMSPlayer = ((CraftPlayer) player).getHandle();
        NMSPlayer.b.sendPacket(packet);
    }
}
Also used : CraftPlayer(org.bukkit.craftbukkit.v1_17_R1.entity.CraftPlayer) Player(org.bukkit.entity.Player) EntityPlayer(net.minecraft.server.level.EntityPlayer) EntityPlayer(net.minecraft.server.level.EntityPlayer) CraftPlayer(org.bukkit.craftbukkit.v1_17_R1.entity.CraftPlayer) Location(org.bukkit.Location)

Example 4 with EntityPlayer

use of net.minecraft.server.level.EntityPlayer in project PublicCrafters by BananaPuncher714.

the class ContainerManager_v1_17_R1 method animate.

@Override
public void animate(Player player) {
    EntityPlayer NMSPlayer = ((CraftPlayer) player).getHandle();
    broadcastPacket(player, new PacketPlayOutAnimation(NMSPlayer, ThreadLocalRandom.current().nextInt(2) == 1 ? 0 : 3));
}
Also used : EntityPlayer(net.minecraft.server.level.EntityPlayer) CraftPlayer(org.bukkit.craftbukkit.v1_17_R1.entity.CraftPlayer) PacketPlayOutAnimation(net.minecraft.network.protocol.game.PacketPlayOutAnimation)

Example 5 with EntityPlayer

use of net.minecraft.server.level.EntityPlayer in project PublicCrafters by BananaPuncher714.

the class ContainerManager_v1_18_R1 method broadcastPacket.

private void broadcastPacket(Player origin, Packet<?> packet) {
    Location location = origin.getLocation();
    for (Player player : Bukkit.getOnlinePlayers()) {
        if (player == origin) {
            continue;
        }
        Location ploc = player.getLocation();
        if (ploc.getWorld() != location.getWorld()) {
            continue;
        }
        if (ploc.distanceSquared(location) > 128) {
            continue;
        }
        EntityPlayer NMSPlayer = ((CraftPlayer) player).getHandle();
        NMSPlayer.b.a(packet);
    }
}
Also used : Player(org.bukkit.entity.Player) CraftPlayer(org.bukkit.craftbukkit.v1_18_R1.entity.CraftPlayer) EntityPlayer(net.minecraft.server.level.EntityPlayer) EntityPlayer(net.minecraft.server.level.EntityPlayer) CraftPlayer(org.bukkit.craftbukkit.v1_18_R1.entity.CraftPlayer) Location(org.bukkit.Location)

Aggregations

EntityPlayer (net.minecraft.server.level.EntityPlayer)22 CraftPlayer (org.bukkit.craftbukkit.v1_17_R1.entity.CraftPlayer)10 CraftPlayer (org.bukkit.craftbukkit.v1_18_R1.entity.CraftPlayer)10 Pair (com.mojang.datafixers.util.Pair)6 ArrayList (java.util.ArrayList)6 PacketPlayOutAnimation (net.minecraft.network.protocol.game.PacketPlayOutAnimation)4 ItemStack (net.minecraft.world.item.ItemStack)4 Location (org.bukkit.Location)4 Player (org.bukkit.entity.Player)4 PlayerInventory (net.minecraft.world.entity.player.PlayerInventory)3 Channel (io.netty.channel.Channel)2 ChannelPipeline (io.netty.channel.ChannelPipeline)2 BlockPosition (net.minecraft.core.BlockPosition)2 NonNullList (net.minecraft.core.NonNullList)2 WorldServer (net.minecraft.server.level.WorldServer)2 IBlockData (net.minecraft.world.level.block.state.IBlockData)2 CraftPlayer (org.bukkit.craftbukkit.v1_18_R2.entity.CraftPlayer)2 TileEntityContainer (com.bgsoftware.wildchests.objects.containers.TileEntityContainer)1 HashMap (java.util.HashMap)1 ChatComponentText (net.minecraft.network.chat.ChatComponentText)1