Search in sources :

Example 1 with MessagePlayOutRecord

use of org.lanternpowered.server.network.vanilla.message.type.play.MessagePlayOutRecord in project LanternServer by LanternPowered.

the class LanternPlayer method playOrStopRecord.

private void playOrStopRecord(Vector3i position, @Nullable RecordType recordType) {
    checkNotNull(position, "position");
    getConnection().send(new MessagePlayOutRecord(position, recordType));
}
Also used : MessagePlayOutRecord(org.lanternpowered.server.network.vanilla.message.type.play.MessagePlayOutRecord)

Example 2 with MessagePlayOutRecord

use of org.lanternpowered.server.network.vanilla.message.type.play.MessagePlayOutRecord in project LanternServer by LanternPowered.

the class CodecPlayOutEffect method encode.

@Override
public ByteBuffer encode(CodecContext context, Message message) throws CodecException {
    final ByteBuffer buf = context.byteBufAlloc().buffer();
    if (message instanceof MessagePlayOutEffect) {
        final MessagePlayOutEffect message1 = (MessagePlayOutEffect) message;
        buf.writeInteger(message1.getType());
        buf.write(Types.VECTOR_3_I, message1.getPosition());
        buf.writeInteger(message1.getData());
        buf.writeBoolean(message1.isBroadcast());
    } else if (message instanceof MessagePlayOutRecord) {
        final MessagePlayOutRecord message1 = (MessagePlayOutRecord) message;
        buf.writeInteger(1010);
        buf.write(Types.VECTOR_3_I, message1.getPosition());
        buf.writeInteger(message1.getRecord().map(type -> 2256 + ((LanternRecordType) type).getInternalId()).orElse(0));
        buf.writeBoolean(false);
    } else {
        throw new EncoderException("Unsupported message type: " + message.getClass().getName());
    }
    return buf;
}
Also used : EncoderException(io.netty.handler.codec.EncoderException) CodecException(io.netty.handler.codec.CodecException) Codec(org.lanternpowered.server.network.message.codec.Codec) MessagePlayOutRecord(org.lanternpowered.server.network.vanilla.message.type.play.MessagePlayOutRecord) LanternRecordType(org.lanternpowered.server.data.type.record.LanternRecordType) MessagePlayOutEffect(org.lanternpowered.server.network.vanilla.message.type.play.MessagePlayOutEffect) ByteBuffer(org.lanternpowered.server.network.buffer.ByteBuffer) Types(org.lanternpowered.server.network.buffer.objects.Types) CodecContext(org.lanternpowered.server.network.message.codec.CodecContext) Message(org.lanternpowered.server.network.message.Message) EncoderException(io.netty.handler.codec.EncoderException) MessagePlayOutEffect(org.lanternpowered.server.network.vanilla.message.type.play.MessagePlayOutEffect) MessagePlayOutRecord(org.lanternpowered.server.network.vanilla.message.type.play.MessagePlayOutRecord) ByteBuffer(org.lanternpowered.server.network.buffer.ByteBuffer)

Example 3 with MessagePlayOutRecord

use of org.lanternpowered.server.network.vanilla.message.type.play.MessagePlayOutRecord in project LanternServer by LanternPowered.

the class LanternWorld method playOrStopRecord.

private void playOrStopRecord(Vector3i position, @Nullable RecordType recordType) {
    checkNotNull(position, "position");
    broadcast(() -> new MessagePlayOutRecord(position, recordType));
}
Also used : MessagePlayOutRecord(org.lanternpowered.server.network.vanilla.message.type.play.MessagePlayOutRecord)

Aggregations

MessagePlayOutRecord (org.lanternpowered.server.network.vanilla.message.type.play.MessagePlayOutRecord)3 CodecException (io.netty.handler.codec.CodecException)1 EncoderException (io.netty.handler.codec.EncoderException)1 LanternRecordType (org.lanternpowered.server.data.type.record.LanternRecordType)1 ByteBuffer (org.lanternpowered.server.network.buffer.ByteBuffer)1 Types (org.lanternpowered.server.network.buffer.objects.Types)1 Message (org.lanternpowered.server.network.message.Message)1 Codec (org.lanternpowered.server.network.message.codec.Codec)1 CodecContext (org.lanternpowered.server.network.message.codec.CodecContext)1 MessagePlayOutEffect (org.lanternpowered.server.network.vanilla.message.type.play.MessagePlayOutEffect)1