use of org.lanternpowered.server.network.vanilla.message.type.play.MessagePlayOutBlockChange in project LanternServer by LanternPowered.
the class CodecPlayOutMultiBlockChange method encode.
@Override
public ByteBuffer encode(CodecContext context, MessagePlayOutMultiBlockChange message) throws CodecException {
ByteBuffer buf = context.byteBufAlloc().buffer();
buf.writeInteger(message.getChunkX());
buf.writeInteger(message.getChunkZ());
Collection<MessagePlayOutBlockChange> changes = message.getChanges();
buf.writeVarInt(changes.size());
for (MessagePlayOutBlockChange change : changes) {
Vector3i position = change.getPosition();
buf.writeByte((byte) ((position.getX() & 0xf) << 4 | position.getZ() & 0xf));
buf.writeByte((byte) position.getY());
buf.writeVarInt(change.getBlockState());
}
return buf;
}
use of org.lanternpowered.server.network.vanilla.message.type.play.MessagePlayOutBlockChange in project LanternServer by LanternPowered.
the class LanternPlayer method sendBlockChange.
@Override
public void sendBlockChange(Vector3i position, BlockState state) {
checkNotNull(state, "state");
checkNotNull(position, "position");
this.session.send(new MessagePlayOutBlockChange(position, BlockRegistryModule.get().getStateInternalIdAndData(state)));
}
use of org.lanternpowered.server.network.vanilla.message.type.play.MessagePlayOutBlockChange in project LanternServer by LanternPowered.
the class LanternPlayer method resetBlockChange.
@Override
public void resetBlockChange(Vector3i position) {
checkNotNull(position, "position");
LanternWorld world = this.getWorld();
if (world == null) {
return;
}
this.session.send(new MessagePlayOutBlockChange(position, BlockRegistryModule.get().getStateInternalIdAndData(world.getBlock(position))));
}
Aggregations