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);
}
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);
}
}
Aggregations