Java Code Examples for cn.nukkit.network.protocol.MobArmorEquipmentPacket#encode()

The following examples show how to use cn.nukkit.network.protocol.MobArmorEquipmentPacket#encode() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: PlayerInventory.java    From Jupiter with GNU General Public License v3.0 6 votes vote down vote up
public void sendArmorContents(Player[] players) {
    Item[] armor = this.getArmorContents();

    MobArmorEquipmentPacket pk = new MobArmorEquipmentPacket();
    pk.eid = this.getHolder().getId();
    pk.slots = armor;
    pk.encode();
    pk.isEncoded = true;

    for (Player player : players) {
        if (player.equals(this.getHolder())) {
            InventoryContentPacket pk2 = new InventoryContentPacket();
            pk2.inventoryId = InventoryContentPacket.SPECIAL_ARMOR;
            pk2.slots = armor;
            player.dataPacket(pk2);
        } else {
            player.dataPacket(pk);
        }
    }
}
 
Example 2
Source File: PlayerInventory.java    From Jupiter with GNU General Public License v3.0 6 votes vote down vote up
public void sendArmorSlot(int index, Player[] players) {
    Item[] armor = this.getArmorContents();

    MobArmorEquipmentPacket pk = new MobArmorEquipmentPacket();
    pk.eid = this.getHolder().getId();
    pk.slots = armor;
    pk.encode();
    pk.isEncoded = true;

    for (Player player : players) {
        if (player.equals(this.getHolder())) {
            InventorySlotPacket pk2 = new InventorySlotPacket();
            pk2.inventoryId = InventoryContentPacket.SPECIAL_ARMOR;
            pk2.slot = index - this.getSize();
            pk2.item = this.getItem(index);
            player.dataPacket(pk2);
        } else {
            player.dataPacket(pk);
        }
    }
}
 
Example 3
Source File: PlayerInventory.java    From Nukkit with GNU General Public License v3.0 6 votes vote down vote up
public void sendArmorContents(Player[] players) {
    Item[] armor = this.getArmorContents();

    MobArmorEquipmentPacket pk = new MobArmorEquipmentPacket();
    pk.eid = this.getHolder().getId();
    pk.slots = armor;
    pk.encode();
    pk.isEncoded = true;

    for (Player player : players) {
        if (player.equals(this.getHolder())) {
            InventoryContentPacket pk2 = new InventoryContentPacket();
            pk2.inventoryId = InventoryContentPacket.SPECIAL_ARMOR;
            pk2.slots = armor;
            player.dataPacket(pk2);
        } else {
            player.dataPacket(pk);
        }
    }
}
 
Example 4
Source File: PlayerInventory.java    From Nukkit with GNU General Public License v3.0 6 votes vote down vote up
public void sendArmorSlot(int index, Player[] players) {
    Item[] armor = this.getArmorContents();

    MobArmorEquipmentPacket pk = new MobArmorEquipmentPacket();
    pk.eid = this.getHolder().getId();
    pk.slots = armor;
    pk.encode();
    pk.isEncoded = true;

    for (Player player : players) {
        if (player.equals(this.getHolder())) {
            InventorySlotPacket pk2 = new InventorySlotPacket();
            pk2.inventoryId = InventoryContentPacket.SPECIAL_ARMOR;
            pk2.slot = index - this.getSize();
            pk2.item = this.getItem(index);
            player.dataPacket(pk2);
        } else {
            player.dataPacket(pk);
        }
    }
}
 
Example 5
Source File: PlayerInventory.java    From Nukkit with GNU General Public License v3.0 6 votes vote down vote up
public void sendArmorContents(Player[] players) {
    Item[] armor = this.getArmorContents();

    MobArmorEquipmentPacket pk = new MobArmorEquipmentPacket();
    pk.eid = this.getHolder().getId();
    pk.slots = armor;
    pk.encode();
    pk.isEncoded = true;

    for (Player player : players) {
        if (player.equals(this.getHolder())) {
            InventoryContentPacket pk2 = new InventoryContentPacket();
            pk2.inventoryId = InventoryContentPacket.SPECIAL_ARMOR;
            pk2.slots = armor;
            player.dataPacket(pk2);
        } else {
            player.dataPacket(pk);
        }
    }
}
 
Example 6
Source File: PlayerInventory.java    From Nukkit with GNU General Public License v3.0 6 votes vote down vote up
public void sendArmorSlot(int index, Player[] players) {
    Item[] armor = this.getArmorContents();

    MobArmorEquipmentPacket pk = new MobArmorEquipmentPacket();
    pk.eid = this.getHolder().getId();
    pk.slots = armor;
    pk.encode();
    pk.isEncoded = true;

    for (Player player : players) {
        if (player.equals(this.getHolder())) {
            InventorySlotPacket pk2 = new InventorySlotPacket();
            pk2.inventoryId = InventoryContentPacket.SPECIAL_ARMOR;
            pk2.slot = index - this.getSize();
            pk2.item = this.getItem(index);
            player.dataPacket(pk2);
        } else {
            player.dataPacket(pk);
        }
    }
}