use of org.lanternpowered.server.data.type.record.LanternRecordType 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;
}
use of org.lanternpowered.server.data.type.record.LanternRecordType in project LanternServer by LanternPowered.
the class RecordTypeRegistryModule method registerDefaults.
@Override
public void registerDefaults() {
register(new LanternRecordType("minecraft", "thirteen", "item.record.13.desc", 0, SoundTypes.RECORD_13));
register(new LanternRecordType("minecraft", "cat", "item.record.cat.desc", 1, SoundTypes.RECORD_CAT));
register(new LanternRecordType("minecraft", "blocks", "item.record.blocks.desc", 2, SoundTypes.RECORD_BLOCKS));
register(new LanternRecordType("minecraft", "chirp", "item.record.chirp.desc", 3, SoundTypes.RECORD_CHIRP));
register(new LanternRecordType("minecraft", "far", "item.record.far.desc", 4, SoundTypes.RECORD_FAR));
register(new LanternRecordType("minecraft", "mall", "item.record.mall.desc", 5, SoundTypes.RECORD_MALL));
register(new LanternRecordType("minecraft", "mellohi", "item.record.mellohi.desc", 6, SoundTypes.RECORD_MELLOHI));
register(new LanternRecordType("minecraft", "stal", "item.record.stal.desc", 7, SoundTypes.RECORD_STAL));
register(new LanternRecordType("minecraft", "strad", "item.record.strad.desc", 8, SoundTypes.RECORD_STRAD));
register(new LanternRecordType("minecraft", "ward", "item.record.ward.desc", 9, SoundTypes.RECORD_WARD));
register(new LanternRecordType("minecraft", "eleven", "item.record.11.desc", 10, SoundTypes.RECORD_11));
register(new LanternRecordType("minecraft", "wait", "item.record.wait.desc", 11, SoundTypes.RECORD_WAIT));
}
Aggregations