mirror of
https://github.com/Minestom/Minestom.git
synced 2024-12-27 11:38:03 +01:00
Added BlockEntityDataPacket
This commit is contained in:
parent
47447706b0
commit
388caefa34
@ -0,0 +1,32 @@
|
||||
package net.minestom.server.network.packet.server.play;
|
||||
|
||||
import net.minestom.server.network.packet.server.ServerPacket;
|
||||
import net.minestom.server.network.packet.server.ServerPacketIdentifier;
|
||||
import net.minestom.server.utils.BlockPosition;
|
||||
import net.minestom.server.utils.binary.BinaryWriter;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jglrxavpok.hephaistos.nbt.NBTCompound;
|
||||
|
||||
public class BlockEntityDataPacket implements ServerPacket {
|
||||
|
||||
public BlockPosition blockPosition;
|
||||
public byte action;
|
||||
public NBTCompound nbtCompound;
|
||||
|
||||
@Override
|
||||
public void write(@NotNull BinaryWriter writer) {
|
||||
writer.writeBlockPosition(blockPosition);
|
||||
writer.writeByte(action);
|
||||
if (nbtCompound != null) {
|
||||
writer.writeNBT("", nbtCompound);
|
||||
} else {
|
||||
// TAG_End
|
||||
writer.writeByte((byte) 0x00);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getId() {
|
||||
return ServerPacketIdentifier.BLOCK_ENTITY_DATA;
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user