Search in sources :

Example 1 with ItemBow

use of cn.nukkit.item.ItemBow in project Nukkit by Nukkit.

the class EntitySkeleton method spawnTo.

@Override
public void spawnTo(Player player) {
    AddEntityPacket pk = new AddEntityPacket();
    pk.type = this.getNetworkId();
    pk.entityUniqueId = this.getId();
    pk.entityRuntimeId = this.getId();
    pk.x = (float) this.x;
    pk.y = (float) this.y;
    pk.z = (float) this.z;
    pk.speedX = (float) this.motionX;
    pk.speedY = (float) this.motionY;
    pk.speedZ = (float) this.motionZ;
    pk.metadata = this.dataProperties;
    player.dataPacket(pk);
    MobEquipmentPacket pk1 = new MobEquipmentPacket();
    pk1.eid = this.getId();
    pk1.item = new ItemBow();
    pk1.hotbarSlot = 10;
    player.dataPacket(pk1);
    super.spawnTo(player);
}
Also used : AddEntityPacket(cn.nukkit.network.protocol.AddEntityPacket) ItemBow(cn.nukkit.item.ItemBow) MobEquipmentPacket(cn.nukkit.network.protocol.MobEquipmentPacket)

Example 2 with ItemBow

use of cn.nukkit.item.ItemBow in project Nukkit by Nukkit.

the class EntityStray method spawnTo.

@Override
public void spawnTo(Player player) {
    AddEntityPacket pk = new AddEntityPacket();
    pk.type = this.getNetworkId();
    pk.entityUniqueId = this.getId();
    pk.entityRuntimeId = this.getId();
    pk.x = (float) this.x;
    pk.y = (float) this.y;
    pk.z = (float) this.z;
    pk.speedX = (float) this.motionX;
    pk.speedY = (float) this.motionY;
    pk.speedZ = (float) this.motionZ;
    pk.metadata = this.dataProperties;
    player.dataPacket(pk);
    MobEquipmentPacket pk1 = new MobEquipmentPacket();
    pk1.eid = this.getId();
    pk1.item = new ItemBow();
    pk1.hotbarSlot = 10;
    player.dataPacket(pk1);
    super.spawnTo(player);
}
Also used : AddEntityPacket(cn.nukkit.network.protocol.AddEntityPacket) ItemBow(cn.nukkit.item.ItemBow) MobEquipmentPacket(cn.nukkit.network.protocol.MobEquipmentPacket)

Aggregations

ItemBow (cn.nukkit.item.ItemBow)2 AddEntityPacket (cn.nukkit.network.protocol.AddEntityPacket)2 MobEquipmentPacket (cn.nukkit.network.protocol.MobEquipmentPacket)2