Search in sources :

Example 1 with MobEquipmentPacket

use of cn.nukkit.network.protocol.MobEquipmentPacket 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 MobEquipmentPacket

use of cn.nukkit.network.protocol.MobEquipmentPacket 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)

Example 3 with MobEquipmentPacket

use of cn.nukkit.network.protocol.MobEquipmentPacket in project Nukkit by Nukkit.

the class EntityVex 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 ItemSwordIron();
    pk1.hotbarSlot = 10;
    player.dataPacket(pk1);
    super.spawnTo(player);
}
Also used : ItemSwordIron(cn.nukkit.item.ItemSwordIron) AddEntityPacket(cn.nukkit.network.protocol.AddEntityPacket) MobEquipmentPacket(cn.nukkit.network.protocol.MobEquipmentPacket)

Example 4 with MobEquipmentPacket

use of cn.nukkit.network.protocol.MobEquipmentPacket in project Nukkit by Nukkit.

the class EntityWitherSkeleton 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 ItemSwordStone();
    pk1.hotbarSlot = 10;
    player.dataPacket(pk1);
    super.spawnTo(player);
}
Also used : ItemSwordStone(cn.nukkit.item.ItemSwordStone) AddEntityPacket(cn.nukkit.network.protocol.AddEntityPacket) MobEquipmentPacket(cn.nukkit.network.protocol.MobEquipmentPacket)

Example 5 with MobEquipmentPacket

use of cn.nukkit.network.protocol.MobEquipmentPacket in project Nukkit by Nukkit.

the class PlayerInventory method sendHeldItem.

public void sendHeldItem(Player... players) {
    Item item = this.getItemInHand();
    MobEquipmentPacket pk = new MobEquipmentPacket();
    pk.item = item;
    pk.inventorySlot = pk.hotbarSlot = this.getHeldItemIndex();
    for (Player player : players) {
        pk.eid = this.getHolder().getId();
        if (player.equals(this.getHolder())) {
            pk.eid = player.getId();
            this.sendSlot(this.getHeldItemIndex(), player);
        }
        player.dataPacket(pk);
    }
}
Also used : Item(cn.nukkit.item.Item) Player(cn.nukkit.Player) MobEquipmentPacket(cn.nukkit.network.protocol.MobEquipmentPacket)

Aggregations

MobEquipmentPacket (cn.nukkit.network.protocol.MobEquipmentPacket)6 AddEntityPacket (cn.nukkit.network.protocol.AddEntityPacket)5 ItemBow (cn.nukkit.item.ItemBow)2 Player (cn.nukkit.Player)1 Item (cn.nukkit.item.Item)1 ItemSwordGold (cn.nukkit.item.ItemSwordGold)1 ItemSwordIron (cn.nukkit.item.ItemSwordIron)1 ItemSwordStone (cn.nukkit.item.ItemSwordStone)1