Search in sources :

Example 16 with PacketPlayOutEntityEquipment

use of net.minecraft.server.v1_14_R1.PacketPlayOutEntityEquipment in project DragonsOnline by UniverseCraft.

the class PlayerNPC116R3 method setEquipment.

public void setEquipment(EquipmentSlot slot, org.bukkit.inventory.ItemStack item) {
    PacketPlayOutEntityEquipment packet = new PacketPlayOutEntityEquipment();
    this.setField(packet, "a", handle.getId());
    this.setField(packet, "b", CraftEquipmentSlot.getNMS(slot));
    this.setField(packet, "c", CraftItemStack.asNMSCopy(item));
    this.sendPacket(packet);
}
Also used : PacketPlayOutEntityEquipment(net.minecraft.server.v1_16_R3.PacketPlayOutEntityEquipment)

Example 17 with PacketPlayOutEntityEquipment

use of net.minecraft.server.v1_14_R1.PacketPlayOutEntityEquipment in project MechanicsMain by WeaponMechanics.

the class FakeEntity_1_14_R1 method show.

public void show() {
    // Construct the packets out of the loop to save resources, they will
    // be the same for each Player.
    Packet<?> spawn = type.isAlive() ? new PacketPlayOutSpawnEntityLiving((EntityLiving) entity) : new PacketPlayOutSpawnEntity(entity, type == EntityType.FALLING_BLOCK ? Block.getCombinedId(block) : 0);
    PacketPlayOutEntityMetadata meta = new PacketPlayOutEntityMetadata(cache, entity.getDataWatcher(), true);
    PacketPlayOutEntityHeadRotation head = new PacketPlayOutEntityHeadRotation(entity, convertYaw(getYaw()));
    PacketPlayOutEntityLook look = new PacketPlayOutEntityLook(cache, convertYaw(getYaw()), convertPitch(getPitch()), false);
    PacketPlayOutEntityVelocity velocity = new PacketPlayOutEntityVelocity(cache, new Vec3D(motion.getX(), motion.getY(), motion.getZ()));
    for (Player temp : DistanceUtil.getPlayersInRange(location)) {
        PlayerConnection connection = ((CraftPlayer) temp).getHandle().playerConnection;
        if (connections.contains(connection)) {
            continue;
        }
        connection.sendPacket(spawn);
        connection.sendPacket(meta);
        connection.sendPacket(head);
        connection.sendPacket(velocity);
        connection.sendPacket(look);
        PacketPlayOutEntityEquipment[] equipment = getEquipmentPacket();
        if (equipment != null) {
            for (PacketPlayOutEntityEquipment packet : equipment) {
                connection.sendPacket(packet);
            }
        }
        connections.add(connection);
    }
}
Also used : Player(org.bukkit.entity.Player) CraftPlayer(org.bukkit.craftbukkit.v1_14_R1.entity.CraftPlayer) PacketPlayOutEntityLook(net.minecraft.server.v1_14_R1.PacketPlayOutEntity.PacketPlayOutEntityLook)

Aggregations

Location (org.bukkit.Location)9 Pair (com.mojang.datafixers.util.Pair)4 ArrayList (java.util.ArrayList)4 ItemStack (org.bukkit.inventory.ItemStack)4 PacketContainer (com.comphenix.protocol.events.PacketContainer)3 EquipmentSlot (org.bukkit.inventory.EquipmentSlot)3 PacketPlayOutEntityLook (net.minecraft.server.v1_14_R1.PacketPlayOutEntity.PacketPlayOutEntityLook)2 PacketPlayOutEntityEquipment (net.minecraft.server.v1_16_R3.PacketPlayOutEntityEquipment)2 Player (org.bukkit.entity.Player)2 UltraCosmeticsData (be.isach.ultracosmetics.UltraCosmeticsData)1 ChestType (be.isach.ultracosmetics.treasurechests.ChestType)1 TreasureChestDesign (be.isach.ultracosmetics.treasurechests.TreasureChestDesign)1 MathUtils (be.isach.ultracosmetics.util.MathUtils)1 PacketSender (be.isach.ultracosmetics.util.PacketSender)1 Particles (be.isach.ultracosmetics.util.Particles)1 UtilParticles (be.isach.ultracosmetics.util.UtilParticles)1 CustomPathFinderGoalPanic (be.isach.ultracosmetics.v1_14_R1.pathfinders.CustomPathFinderGoalPanic)1 IEntityUtil (be.isach.ultracosmetics.version.IEntityUtil)1 ChannelHandlerContext (io.netty.channel.ChannelHandlerContext)1 ChannelOutboundHandlerAdapter (io.netty.channel.ChannelOutboundHandlerAdapter)1