Skip to content

Commit

Permalink
Add simple handlers for rotators
Browse files Browse the repository at this point in the history
  • Loading branch information
Melledy committed Feb 9, 2024
1 parent 7cf67f6 commit c61e87f
Show file tree
Hide file tree
Showing 13 changed files with 551 additions and 1,127 deletions.
347 changes: 11 additions & 336 deletions src/generated/main/emu/lunarcore/proto/DeployRotaterScRspOuterClass.java

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,341 @@
// Code generated by protocol buffer compiler. Do not edit!
package emu.lunarcore.proto;

import java.io.IOException;
import us.hebi.quickbuf.FieldName;
import us.hebi.quickbuf.InvalidProtocolBufferException;
import us.hebi.quickbuf.JsonSink;
import us.hebi.quickbuf.JsonSource;
import us.hebi.quickbuf.MessageFactory;
import us.hebi.quickbuf.ProtoMessage;
import us.hebi.quickbuf.ProtoSink;
import us.hebi.quickbuf.ProtoSource;

public final class RotatorEnergyInfoOuterClass {
/**
* Protobuf type {@code RotatorEnergyInfo}
*/
public static final class RotatorEnergyInfo extends ProtoMessage<RotatorEnergyInfo> implements Cloneable {
private static final long serialVersionUID = 0L;

/**
* <code>optional uint32 cur_num = 3;</code>
*/
private int curNum;

/**
* <code>optional uint32 max_num = 14;</code>
*/
private int maxNum;

private RotatorEnergyInfo() {
}

/**
* @return a new empty instance of {@code RotatorEnergyInfo}
*/
public static RotatorEnergyInfo newInstance() {
return new RotatorEnergyInfo();
}

/**
* <code>optional uint32 cur_num = 3;</code>
* @return whether the curNum field is set
*/
public boolean hasCurNum() {
return (bitField0_ & 0x00000001) != 0;
}

/**
* <code>optional uint32 cur_num = 3;</code>
* @return this
*/
public RotatorEnergyInfo clearCurNum() {
bitField0_ &= ~0x00000001;
curNum = 0;
return this;
}

/**
* <code>optional uint32 cur_num = 3;</code>
* @return the curNum
*/
public int getCurNum() {
return curNum;
}

/**
* <code>optional uint32 cur_num = 3;</code>
* @param value the curNum to set
* @return this
*/
public RotatorEnergyInfo setCurNum(final int value) {
bitField0_ |= 0x00000001;
curNum = value;
return this;
}

/**
* <code>optional uint32 max_num = 14;</code>
* @return whether the maxNum field is set
*/
public boolean hasMaxNum() {
return (bitField0_ & 0x00000002) != 0;
}

/**
* <code>optional uint32 max_num = 14;</code>
* @return this
*/
public RotatorEnergyInfo clearMaxNum() {
bitField0_ &= ~0x00000002;
maxNum = 0;
return this;
}

/**
* <code>optional uint32 max_num = 14;</code>
* @return the maxNum
*/
public int getMaxNum() {
return maxNum;
}

/**
* <code>optional uint32 max_num = 14;</code>
* @param value the maxNum to set
* @return this
*/
public RotatorEnergyInfo setMaxNum(final int value) {
bitField0_ |= 0x00000002;
maxNum = value;
return this;
}

@Override
public RotatorEnergyInfo copyFrom(final RotatorEnergyInfo other) {
cachedSize = other.cachedSize;
if ((bitField0_ | other.bitField0_) != 0) {
bitField0_ = other.bitField0_;
curNum = other.curNum;
maxNum = other.maxNum;
}
return this;
}

@Override
public RotatorEnergyInfo mergeFrom(final RotatorEnergyInfo other) {
if (other.isEmpty()) {
return this;
}
cachedSize = -1;
if (other.hasCurNum()) {
setCurNum(other.curNum);
}
if (other.hasMaxNum()) {
setMaxNum(other.maxNum);
}
return this;
}

@Override
public RotatorEnergyInfo clear() {
if (isEmpty()) {
return this;
}
cachedSize = -1;
bitField0_ = 0;
curNum = 0;
maxNum = 0;
return this;
}

@Override
public RotatorEnergyInfo clearQuick() {
if (isEmpty()) {
return this;
}
cachedSize = -1;
bitField0_ = 0;
return this;
}

@Override
public boolean equals(Object o) {
if (o == this) {
return true;
}
if (!(o instanceof RotatorEnergyInfo)) {
return false;
}
RotatorEnergyInfo other = (RotatorEnergyInfo) o;
return bitField0_ == other.bitField0_
&& (!hasCurNum() || curNum == other.curNum)
&& (!hasMaxNum() || maxNum == other.maxNum);
}

@Override
public void writeTo(final ProtoSink output) throws IOException {
if ((bitField0_ & 0x00000001) != 0) {
output.writeRawByte((byte) 24);
output.writeUInt32NoTag(curNum);
}
if ((bitField0_ & 0x00000002) != 0) {
output.writeRawByte((byte) 112);
output.writeUInt32NoTag(maxNum);
}
}

@Override
protected int computeSerializedSize() {
int size = 0;
if ((bitField0_ & 0x00000001) != 0) {
size += 1 + ProtoSink.computeUInt32SizeNoTag(curNum);
}
if ((bitField0_ & 0x00000002) != 0) {
size += 1 + ProtoSink.computeUInt32SizeNoTag(maxNum);
}
return size;
}

@Override
@SuppressWarnings("fallthrough")
public RotatorEnergyInfo mergeFrom(final ProtoSource input) throws IOException {
// Enabled Fall-Through Optimization (QuickBuffers)
int tag = input.readTag();
while (true) {
switch (tag) {
case 24: {
// curNum
curNum = input.readUInt32();
bitField0_ |= 0x00000001;
tag = input.readTag();
if (tag != 112) {
break;
}
}
case 112: {
// maxNum
maxNum = input.readUInt32();
bitField0_ |= 0x00000002;
tag = input.readTag();
if (tag != 0) {
break;
}
}
case 0: {
return this;
}
default: {
if (!input.skipField(tag)) {
return this;
}
tag = input.readTag();
break;
}
}
}
}

@Override
public void writeTo(final JsonSink output) throws IOException {
output.beginObject();
if ((bitField0_ & 0x00000001) != 0) {
output.writeUInt32(FieldNames.curNum, curNum);
}
if ((bitField0_ & 0x00000002) != 0) {
output.writeUInt32(FieldNames.maxNum, maxNum);
}
output.endObject();
}

@Override
public RotatorEnergyInfo mergeFrom(final JsonSource input) throws IOException {
if (!input.beginObject()) {
return this;
}
while (!input.isAtEnd()) {
switch (input.readFieldHash()) {
case -1349154522:
case 1126382855: {
if (input.isAtField(FieldNames.curNum)) {
if (!input.trySkipNullValue()) {
curNum = input.readUInt32();
bitField0_ |= 0x00000001;
}
} else {
input.skipUnknownField();
}
break;
}
case -1081154686:
case 844443179: {
if (input.isAtField(FieldNames.maxNum)) {
if (!input.trySkipNullValue()) {
maxNum = input.readUInt32();
bitField0_ |= 0x00000002;
}
} else {
input.skipUnknownField();
}
break;
}
default: {
input.skipUnknownField();
break;
}
}
}
input.endObject();
return this;
}

@Override
public RotatorEnergyInfo clone() {
return new RotatorEnergyInfo().copyFrom(this);
}

@Override
public boolean isEmpty() {
return ((bitField0_) == 0);
}

public static RotatorEnergyInfo parseFrom(final byte[] data) throws
InvalidProtocolBufferException {
return ProtoMessage.mergeFrom(new RotatorEnergyInfo(), data).checkInitialized();
}

public static RotatorEnergyInfo parseFrom(final ProtoSource input) throws IOException {
return ProtoMessage.mergeFrom(new RotatorEnergyInfo(), input).checkInitialized();
}

public static RotatorEnergyInfo parseFrom(final JsonSource input) throws IOException {
return ProtoMessage.mergeFrom(new RotatorEnergyInfo(), input).checkInitialized();
}

/**
* @return factory for creating RotatorEnergyInfo messages
*/
public static MessageFactory<RotatorEnergyInfo> getFactory() {
return RotatorEnergyInfoFactory.INSTANCE;
}

private enum RotatorEnergyInfoFactory implements MessageFactory<RotatorEnergyInfo> {
INSTANCE;

@Override
public RotatorEnergyInfo create() {
return RotatorEnergyInfo.newInstance();
}
}

/**
* Contains name constants used for serializing JSON
*/
static class FieldNames {
static final FieldName curNum = FieldName.forField("curNum", "cur_num");

static final FieldName maxNum = FieldName.forField("maxNum", "max_num");
}
}
}
Loading

0 comments on commit c61e87f

Please sign in to comment.