Search in sources :

Example 1 with BlockEntityDataPacket

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

the class BlockEntitySpawnable method spawnTo.

public void spawnTo(Player player) {
    if (this.closed) {
        return;
    }
    CompoundTag tag = this.getSpawnCompound();
    BlockEntityDataPacket pk = new BlockEntityDataPacket();
    pk.x = (int) this.x;
    pk.y = (int) this.y;
    pk.z = (int) this.z;
    try {
        pk.namedTag = NBTIO.write(tag, ByteOrder.LITTLE_ENDIAN, true);
    } catch (IOException e) {
        throw new RuntimeException(e);
    }
    player.dataPacket(pk);
}
Also used : BlockEntityDataPacket(cn.nukkit.network.protocol.BlockEntityDataPacket) IOException(java.io.IOException) CompoundTag(cn.nukkit.nbt.tag.CompoundTag)

Aggregations

CompoundTag (cn.nukkit.nbt.tag.CompoundTag)1 BlockEntityDataPacket (cn.nukkit.network.protocol.BlockEntityDataPacket)1 IOException (java.io.IOException)1