// Code generated by protocol buffer compiler. Do not edit!
package emu.nebula.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.ProtoEnum;
import us.hebi.quickbuf.ProtoMessage;
import us.hebi.quickbuf.ProtoSink;
import us.hebi.quickbuf.ProtoSource;
import us.hebi.quickbuf.ProtoUtil;
import us.hebi.quickbuf.RepeatedByte;
import us.hebi.quickbuf.RepeatedInt;
import us.hebi.quickbuf.RepeatedMessage;

public final class PublicMining {
  /**
   * Protobuf enum {@code MiningGridType}
   */
  public enum MiningGridType implements ProtoEnum<MiningGridType> {
    /**
     * <code>Destroyed = 0;</code>
     */
    Destroyed("Destroyed", 0),

    /**
     * <code>Fragile = 1;</code>
     */
    Fragile("Fragile", 1),

    /**
     * <code>Normal = 2;</code>
     */
    Normal("Normal", 2),

    /**
     * <code>Hard = 3;</code>
     */
    Hard("Hard", 3),

    /**
     * <code>SuperHard = 4;</code>
     */
    SuperHard("SuperHard", 4),

    /**
     * <code>TypeCounter = 5;</code>
     */
    TypeCounter("TypeCounter", 5);

    /**
     * <code>Destroyed = 0;</code>
     */
    public static final int Destroyed_VALUE = 0;

    /**
     * <code>Fragile = 1;</code>
     */
    public static final int Fragile_VALUE = 1;

    /**
     * <code>Normal = 2;</code>
     */
    public static final int Normal_VALUE = 2;

    /**
     * <code>Hard = 3;</code>
     */
    public static final int Hard_VALUE = 3;

    /**
     * <code>SuperHard = 4;</code>
     */
    public static final int SuperHard_VALUE = 4;

    /**
     * <code>TypeCounter = 5;</code>
     */
    public static final int TypeCounter_VALUE = 5;

    private final String name;

    private final int number;

    private MiningGridType(String name, int number) {
      this.name = name;
      this.number = number;
    }

    /**
     * @return the string representation of enum entry
     */
    @Override
    public String getName() {
      return name;
    }

    /**
     * @return the numeric wire value of this enum entry
     */
    @Override
    public int getNumber() {
      return number;
    }

    /**
     * @return a converter that maps between this enum's numeric and text representations
     */
    public static ProtoEnum.EnumConverter<MiningGridType> converter() {
      return MiningGridTypeConverter.INSTANCE;
    }

    /**
     * @param value The numeric wire value of the corresponding enum entry.
     * @return The enum associated with the given numeric wire value, or null if unknown.
     */
    public static MiningGridType forNumber(int value) {
      return MiningGridTypeConverter.INSTANCE.forNumber(value);
    }

    /**
     * @param value The numeric wire value of the corresponding enum entry.
     * @param other Fallback value in case the value is not known.
     * @return The enum associated with the given numeric wire value, or the fallback value if unknown.
     */
    public static MiningGridType forNumberOr(int number, MiningGridType other) {
      MiningGridType value = forNumber(number);
      return value == null ? other : value;
    }

    enum MiningGridTypeConverter implements ProtoEnum.EnumConverter<MiningGridType> {
      INSTANCE;

      private static final MiningGridType[] lookup = new MiningGridType[6];

      static {
        lookup[0] = Destroyed;
        lookup[1] = Fragile;
        lookup[2] = Normal;
        lookup[3] = Hard;
        lookup[4] = SuperHard;
        lookup[5] = TypeCounter;
      }

      @Override
      public final MiningGridType forNumber(final int value) {
        if (value >= 0 && value < lookup.length) {
          return lookup[value];
        }
        return null;
      }

      @Override
      public final MiningGridType forName(final CharSequence value) {
        switch (value.length()) {
          case 4: {
            if (ProtoUtil.isEqual("Hard", value)) {
              return Hard;
            }
            break;
          }
          case 6: {
            if (ProtoUtil.isEqual("Normal", value)) {
              return Normal;
            }
            break;
          }
          case 7: {
            if (ProtoUtil.isEqual("Fragile", value)) {
              return Fragile;
            }
            break;
          }
          case 9: {
            if (ProtoUtil.isEqual("Destroyed", value)) {
              return Destroyed;
            }
            if (ProtoUtil.isEqual("SuperHard", value)) {
              return SuperHard;
            }
            break;
          }
          case 11: {
            if (ProtoUtil.isEqual("TypeCounter", value)) {
              return TypeCounter;
            }
            break;
          }
        }
        return null;
      }
    }
  }

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

    /**
     * <code>optional uint32 Id = 1;</code>
     */
    private int id;

    /**
     * <code>optional bool Received = 3;</code>
     */
    private boolean received;

    /**
     * <code>optional bytes NextPackage = 2047;</code>
     */
    private final RepeatedByte nextPackage = RepeatedByte.newEmptyInstance();

    /**
     * <code>repeated uint32 PosIndex = 2;</code>
     */
    private final RepeatedInt posIndex = RepeatedInt.newEmptyInstance();

    private MiningTreasure() {
    }

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

    /**
     * <code>optional uint32 Id = 1;</code>
     * @return whether the id field is set
     */
    public boolean hasId() {
      return (bitField0_ & 0x00000001) != 0;
    }

    /**
     * <code>optional uint32 Id = 1;</code>
     * @return this
     */
    public MiningTreasure clearId() {
      bitField0_ &= ~0x00000001;
      id = 0;
      return this;
    }

    /**
     * <code>optional uint32 Id = 1;</code>
     * @return the id
     */
    public int getId() {
      return id;
    }

    /**
     * <code>optional uint32 Id = 1;</code>
     * @param value the id to set
     * @return this
     */
    public MiningTreasure setId(final int value) {
      bitField0_ |= 0x00000001;
      id = value;
      return this;
    }

    /**
     * <code>optional bool Received = 3;</code>
     * @return whether the received field is set
     */
    public boolean hasReceived() {
      return (bitField0_ & 0x00000002) != 0;
    }

    /**
     * <code>optional bool Received = 3;</code>
     * @return this
     */
    public MiningTreasure clearReceived() {
      bitField0_ &= ~0x00000002;
      received = false;
      return this;
    }

    /**
     * <code>optional bool Received = 3;</code>
     * @return the received
     */
    public boolean getReceived() {
      return received;
    }

    /**
     * <code>optional bool Received = 3;</code>
     * @param value the received to set
     * @return this
     */
    public MiningTreasure setReceived(final boolean value) {
      bitField0_ |= 0x00000002;
      received = value;
      return this;
    }

    /**
     * <code>optional bytes NextPackage = 2047;</code>
     * @return whether the nextPackage field is set
     */
    public boolean hasNextPackage() {
      return (bitField0_ & 0x00000004) != 0;
    }

    /**
     * <code>optional bytes NextPackage = 2047;</code>
     * @return this
     */
    public MiningTreasure clearNextPackage() {
      bitField0_ &= ~0x00000004;
      nextPackage.clear();
      return this;
    }

    /**
     * <code>optional bytes NextPackage = 2047;</code>
     *
     * This method returns the internal storage object without modifying any has state.
     * The returned object should not be modified and be treated as read-only.
     *
     * Use {@link #getMutableNextPackage()} if you want to modify it.
     *
     * @return internal storage object for reading
     */
    public RepeatedByte getNextPackage() {
      return nextPackage;
    }

    /**
     * <code>optional bytes NextPackage = 2047;</code>
     *
     * This method returns the internal storage object and sets the corresponding
     * has state. The returned object will become part of this message and its
     * contents may be modified as long as the has state is not cleared.
     *
     * @return internal storage object for modifications
     */
    public RepeatedByte getMutableNextPackage() {
      bitField0_ |= 0x00000004;
      return nextPackage;
    }

    /**
     * <code>optional bytes NextPackage = 2047;</code>
     * @param value the nextPackage to add
     * @return this
     */
    public MiningTreasure addNextPackage(final byte value) {
      bitField0_ |= 0x00000004;
      nextPackage.add(value);
      return this;
    }

    /**
     * <code>optional bytes NextPackage = 2047;</code>
     * @param values the nextPackage to add
     * @return this
     */
    public MiningTreasure addAllNextPackage(final byte... values) {
      bitField0_ |= 0x00000004;
      nextPackage.addAll(values);
      return this;
    }

    /**
     * <code>optional bytes NextPackage = 2047;</code>
     * @param values the nextPackage to set
     * @return this
     */
    public MiningTreasure setNextPackage(final byte... values) {
      bitField0_ |= 0x00000004;
      nextPackage.copyFrom(values);
      return this;
    }

    /**
     * <code>repeated uint32 PosIndex = 2;</code>
     * @return whether the posIndex field is set
     */
    public boolean hasPosIndex() {
      return (bitField0_ & 0x00000008) != 0;
    }

    /**
     * <code>repeated uint32 PosIndex = 2;</code>
     * @return this
     */
    public MiningTreasure clearPosIndex() {
      bitField0_ &= ~0x00000008;
      posIndex.clear();
      return this;
    }

    /**
     * <code>repeated uint32 PosIndex = 2;</code>
     *
     * This method returns the internal storage object without modifying any has state.
     * The returned object should not be modified and be treated as read-only.
     *
     * Use {@link #getMutablePosIndex()} if you want to modify it.
     *
     * @return internal storage object for reading
     */
    public RepeatedInt getPosIndex() {
      return posIndex;
    }

    /**
     * <code>repeated uint32 PosIndex = 2;</code>
     *
     * This method returns the internal storage object and sets the corresponding
     * has state. The returned object will become part of this message and its
     * contents may be modified as long as the has state is not cleared.
     *
     * @return internal storage object for modifications
     */
    public RepeatedInt getMutablePosIndex() {
      bitField0_ |= 0x00000008;
      return posIndex;
    }

    /**
     * <code>repeated uint32 PosIndex = 2;</code>
     * @param value the posIndex to add
     * @return this
     */
    public MiningTreasure addPosIndex(final int value) {
      bitField0_ |= 0x00000008;
      posIndex.add(value);
      return this;
    }

    /**
     * <code>repeated uint32 PosIndex = 2;</code>
     * @param values the posIndex to add
     * @return this
     */
    public MiningTreasure addAllPosIndex(final int... values) {
      bitField0_ |= 0x00000008;
      posIndex.addAll(values);
      return this;
    }

    @Override
    public MiningTreasure copyFrom(final MiningTreasure other) {
      cachedSize = other.cachedSize;
      if ((bitField0_ | other.bitField0_) != 0) {
        bitField0_ = other.bitField0_;
        id = other.id;
        received = other.received;
        nextPackage.copyFrom(other.nextPackage);
        posIndex.copyFrom(other.posIndex);
      }
      return this;
    }

    @Override
    public MiningTreasure mergeFrom(final MiningTreasure other) {
      if (other.isEmpty()) {
        return this;
      }
      cachedSize = -1;
      if (other.hasId()) {
        setId(other.id);
      }
      if (other.hasReceived()) {
        setReceived(other.received);
      }
      if (other.hasNextPackage()) {
        getMutableNextPackage().copyFrom(other.nextPackage);
      }
      if (other.hasPosIndex()) {
        getMutablePosIndex().addAll(other.posIndex);
      }
      return this;
    }

    @Override
    public MiningTreasure clear() {
      if (isEmpty()) {
        return this;
      }
      cachedSize = -1;
      bitField0_ = 0;
      id = 0;
      received = false;
      nextPackage.clear();
      posIndex.clear();
      return this;
    }

    @Override
    public MiningTreasure clearQuick() {
      if (isEmpty()) {
        return this;
      }
      cachedSize = -1;
      bitField0_ = 0;
      nextPackage.clear();
      posIndex.clear();
      return this;
    }

    @Override
    public boolean equals(Object o) {
      if (o == this) {
        return true;
      }
      if (!(o instanceof MiningTreasure)) {
        return false;
      }
      MiningTreasure other = (MiningTreasure) o;
      return bitField0_ == other.bitField0_
        && (!hasId() || id == other.id)
        && (!hasReceived() || received == other.received)
        && (!hasNextPackage() || nextPackage.equals(other.nextPackage))
        && (!hasPosIndex() || posIndex.equals(other.posIndex));
    }

    @Override
    public void writeTo(final ProtoSink output) throws IOException {
      if ((bitField0_ & 0x00000001) != 0) {
        output.writeRawByte((byte) 8);
        output.writeUInt32NoTag(id);
      }
      if ((bitField0_ & 0x00000002) != 0) {
        output.writeRawByte((byte) 24);
        output.writeBoolNoTag(received);
      }
      if ((bitField0_ & 0x00000004) != 0) {
        output.writeRawLittleEndian16((short) 32762);
        output.writeBytesNoTag(nextPackage);
      }
      if ((bitField0_ & 0x00000008) != 0) {
        for (int i = 0; i < posIndex.length(); i++) {
          output.writeRawByte((byte) 16);
          output.writeUInt32NoTag(posIndex.array()[i]);
        }
      }
    }

    @Override
    protected int computeSerializedSize() {
      int size = 0;
      if ((bitField0_ & 0x00000001) != 0) {
        size += 1 + ProtoSink.computeUInt32SizeNoTag(id);
      }
      if ((bitField0_ & 0x00000002) != 0) {
        size += 2;
      }
      if ((bitField0_ & 0x00000004) != 0) {
        size += 2 + ProtoSink.computeBytesSizeNoTag(nextPackage);
      }
      if ((bitField0_ & 0x00000008) != 0) {
        size += (1 * posIndex.length()) + ProtoSink.computeRepeatedUInt32SizeNoTag(posIndex);
      }
      return size;
    }

    @Override
    @SuppressWarnings("fallthrough")
    public MiningTreasure mergeFrom(final ProtoSource input) throws IOException {
      // Enabled Fall-Through Optimization (QuickBuffers)
      int tag = input.readTag();
      while (true) {
        switch (tag) {
          case 8: {
            // id
            id = input.readUInt32();
            bitField0_ |= 0x00000001;
            tag = input.readTag();
            if (tag != 24) {
              break;
            }
          }
          case 24: {
            // received
            received = input.readBool();
            bitField0_ |= 0x00000002;
            tag = input.readTag();
            if (tag != 16378) {
              break;
            }
          }
          case 16378: {
            // nextPackage
            input.readBytes(nextPackage);
            bitField0_ |= 0x00000004;
            tag = input.readTag();
            if (tag != 18) {
              break;
            }
          }
          case 18: {
            // posIndex [packed=true]
            input.readPackedUInt32(posIndex, tag);
            bitField0_ |= 0x00000008;
            tag = input.readTag();
            if (tag != 0) {
              break;
            }
          }
          case 0: {
            return this;
          }
          default: {
            if (!input.skipField(tag)) {
              return this;
            }
            tag = input.readTag();
            break;
          }
          case 16: {
            // posIndex [packed=false]
            tag = input.readRepeatedUInt32(posIndex, tag);
            bitField0_ |= 0x00000008;
            break;
          }
        }
      }
    }

    @Override
    public void writeTo(final JsonSink output) throws IOException {
      output.beginObject();
      if ((bitField0_ & 0x00000001) != 0) {
        output.writeUInt32(FieldNames.id, id);
      }
      if ((bitField0_ & 0x00000002) != 0) {
        output.writeBool(FieldNames.received, received);
      }
      if ((bitField0_ & 0x00000004) != 0) {
        output.writeBytes(FieldNames.nextPackage, nextPackage);
      }
      if ((bitField0_ & 0x00000008) != 0) {
        output.writeRepeatedUInt32(FieldNames.posIndex, posIndex);
      }
      output.endObject();
    }

    @Override
    public MiningTreasure mergeFrom(final JsonSource input) throws IOException {
      if (!input.beginObject()) {
        return this;
      }
      while (!input.isAtEnd()) {
        switch (input.readFieldHash()) {
          case 2363: {
            if (input.isAtField(FieldNames.id)) {
              if (!input.trySkipNullValue()) {
                id = input.readUInt32();
                bitField0_ |= 0x00000001;
              }
            } else {
              input.skipUnknownField();
            }
            break;
          }
          case -744075775: {
            if (input.isAtField(FieldNames.received)) {
              if (!input.trySkipNullValue()) {
                received = input.readBool();
                bitField0_ |= 0x00000002;
              }
            } else {
              input.skipUnknownField();
            }
            break;
          }
          case -2082324045: {
            if (input.isAtField(FieldNames.nextPackage)) {
              if (!input.trySkipNullValue()) {
                input.readBytes(nextPackage);
                bitField0_ |= 0x00000004;
              }
            } else {
              input.skipUnknownField();
            }
            break;
          }
          case 782712574: {
            if (input.isAtField(FieldNames.posIndex)) {
              if (!input.trySkipNullValue()) {
                input.readRepeatedUInt32(posIndex);
                bitField0_ |= 0x00000008;
              }
            } else {
              input.skipUnknownField();
            }
            break;
          }
          default: {
            input.skipUnknownField();
            break;
          }
        }
      }
      input.endObject();
      return this;
    }

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

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

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

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

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

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

    private enum MiningTreasureFactory implements MessageFactory<MiningTreasure> {
      INSTANCE;

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

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

      static final FieldName received = FieldName.forField("Received");

      static final FieldName nextPackage = FieldName.forField("NextPackage");

      static final FieldName posIndex = FieldName.forField("PosIndex");
    }
  }

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

    /**
     * <code>optional uint32 Id = 1;</code>
     */
    private int id;

    /**
     * <code>optional uint32 PosIndex = 2;</code>
     */
    private int posIndex;

    /**
     * <code>optional .MiningGridType GridType = 3;</code>
     */
    private int gridType;

    /**
     * <code>optional bool Marked = 4;</code>
     */
    private boolean marked;

    /**
     * <code>optional bytes NextPackage = 2047;</code>
     */
    private final RepeatedByte nextPackage = RepeatedByte.newEmptyInstance();

    private MiningGrid() {
    }

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

    /**
     * <code>optional uint32 Id = 1;</code>
     * @return whether the id field is set
     */
    public boolean hasId() {
      return (bitField0_ & 0x00000001) != 0;
    }

    /**
     * <code>optional uint32 Id = 1;</code>
     * @return this
     */
    public MiningGrid clearId() {
      bitField0_ &= ~0x00000001;
      id = 0;
      return this;
    }

    /**
     * <code>optional uint32 Id = 1;</code>
     * @return the id
     */
    public int getId() {
      return id;
    }

    /**
     * <code>optional uint32 Id = 1;</code>
     * @param value the id to set
     * @return this
     */
    public MiningGrid setId(final int value) {
      bitField0_ |= 0x00000001;
      id = value;
      return this;
    }

    /**
     * <code>optional uint32 PosIndex = 2;</code>
     * @return whether the posIndex field is set
     */
    public boolean hasPosIndex() {
      return (bitField0_ & 0x00000002) != 0;
    }

    /**
     * <code>optional uint32 PosIndex = 2;</code>
     * @return this
     */
    public MiningGrid clearPosIndex() {
      bitField0_ &= ~0x00000002;
      posIndex = 0;
      return this;
    }

    /**
     * <code>optional uint32 PosIndex = 2;</code>
     * @return the posIndex
     */
    public int getPosIndex() {
      return posIndex;
    }

    /**
     * <code>optional uint32 PosIndex = 2;</code>
     * @param value the posIndex to set
     * @return this
     */
    public MiningGrid setPosIndex(final int value) {
      bitField0_ |= 0x00000002;
      posIndex = value;
      return this;
    }

    /**
     * <code>optional .MiningGridType GridType = 3;</code>
     * @return whether the gridType field is set
     */
    public boolean hasGridType() {
      return (bitField0_ & 0x00000004) != 0;
    }

    /**
     * <code>optional .MiningGridType GridType = 3;</code>
     * @return this
     */
    public MiningGrid clearGridType() {
      bitField0_ &= ~0x00000004;
      gridType = 0;
      return this;
    }

    /**
     * <code>optional .MiningGridType GridType = 3;</code>
     * @return the gridType
     */
    public MiningGridType getGridType() {
      return MiningGridType.forNumber(gridType);
    }

    /**
     * Gets the value of the internal enum store. The result is
     * equivalent to {@link MiningGrid#getGridType()}.getNumber().
     *
     * @return numeric wire representation
     */
    public int getGridTypeValue() {
      return gridType;
    }

    /**
     * Sets the value of the internal enum store. This does not
     * do any validity checks, so be sure to use appropriate value
     * constants from {@link MiningGridType}. Setting an invalid value
     * can cause {@link MiningGrid#getGridType()} to return null
     *
     * @param value the numeric wire value to set
     * @return this
     */
    public MiningGrid setGridTypeValue(final int value) {
      bitField0_ |= 0x00000004;
      gridType = value;
      return this;
    }

    /**
     * <code>optional .MiningGridType GridType = 3;</code>
     * @param value the gridType to set
     * @return this
     */
    public MiningGrid setGridType(final MiningGridType value) {
      bitField0_ |= 0x00000004;
      gridType = value.getNumber();
      return this;
    }

    /**
     * <code>optional bool Marked = 4;</code>
     * @return whether the marked field is set
     */
    public boolean hasMarked() {
      return (bitField0_ & 0x00000008) != 0;
    }

    /**
     * <code>optional bool Marked = 4;</code>
     * @return this
     */
    public MiningGrid clearMarked() {
      bitField0_ &= ~0x00000008;
      marked = false;
      return this;
    }

    /**
     * <code>optional bool Marked = 4;</code>
     * @return the marked
     */
    public boolean getMarked() {
      return marked;
    }

    /**
     * <code>optional bool Marked = 4;</code>
     * @param value the marked to set
     * @return this
     */
    public MiningGrid setMarked(final boolean value) {
      bitField0_ |= 0x00000008;
      marked = value;
      return this;
    }

    /**
     * <code>optional bytes NextPackage = 2047;</code>
     * @return whether the nextPackage field is set
     */
    public boolean hasNextPackage() {
      return (bitField0_ & 0x00000010) != 0;
    }

    /**
     * <code>optional bytes NextPackage = 2047;</code>
     * @return this
     */
    public MiningGrid clearNextPackage() {
      bitField0_ &= ~0x00000010;
      nextPackage.clear();
      return this;
    }

    /**
     * <code>optional bytes NextPackage = 2047;</code>
     *
     * This method returns the internal storage object without modifying any has state.
     * The returned object should not be modified and be treated as read-only.
     *
     * Use {@link #getMutableNextPackage()} if you want to modify it.
     *
     * @return internal storage object for reading
     */
    public RepeatedByte getNextPackage() {
      return nextPackage;
    }

    /**
     * <code>optional bytes NextPackage = 2047;</code>
     *
     * This method returns the internal storage object and sets the corresponding
     * has state. The returned object will become part of this message and its
     * contents may be modified as long as the has state is not cleared.
     *
     * @return internal storage object for modifications
     */
    public RepeatedByte getMutableNextPackage() {
      bitField0_ |= 0x00000010;
      return nextPackage;
    }

    /**
     * <code>optional bytes NextPackage = 2047;</code>
     * @param value the nextPackage to add
     * @return this
     */
    public MiningGrid addNextPackage(final byte value) {
      bitField0_ |= 0x00000010;
      nextPackage.add(value);
      return this;
    }

    /**
     * <code>optional bytes NextPackage = 2047;</code>
     * @param values the nextPackage to add
     * @return this
     */
    public MiningGrid addAllNextPackage(final byte... values) {
      bitField0_ |= 0x00000010;
      nextPackage.addAll(values);
      return this;
    }

    /**
     * <code>optional bytes NextPackage = 2047;</code>
     * @param values the nextPackage to set
     * @return this
     */
    public MiningGrid setNextPackage(final byte... values) {
      bitField0_ |= 0x00000010;
      nextPackage.copyFrom(values);
      return this;
    }

    @Override
    public MiningGrid copyFrom(final MiningGrid other) {
      cachedSize = other.cachedSize;
      if ((bitField0_ | other.bitField0_) != 0) {
        bitField0_ = other.bitField0_;
        id = other.id;
        posIndex = other.posIndex;
        gridType = other.gridType;
        marked = other.marked;
        nextPackage.copyFrom(other.nextPackage);
      }
      return this;
    }

    @Override
    public MiningGrid mergeFrom(final MiningGrid other) {
      if (other.isEmpty()) {
        return this;
      }
      cachedSize = -1;
      if (other.hasId()) {
        setId(other.id);
      }
      if (other.hasPosIndex()) {
        setPosIndex(other.posIndex);
      }
      if (other.hasGridType()) {
        setGridTypeValue(other.gridType);
      }
      if (other.hasMarked()) {
        setMarked(other.marked);
      }
      if (other.hasNextPackage()) {
        getMutableNextPackage().copyFrom(other.nextPackage);
      }
      return this;
    }

    @Override
    public MiningGrid clear() {
      if (isEmpty()) {
        return this;
      }
      cachedSize = -1;
      bitField0_ = 0;
      id = 0;
      posIndex = 0;
      gridType = 0;
      marked = false;
      nextPackage.clear();
      return this;
    }

    @Override
    public MiningGrid clearQuick() {
      if (isEmpty()) {
        return this;
      }
      cachedSize = -1;
      bitField0_ = 0;
      nextPackage.clear();
      return this;
    }

    @Override
    public boolean equals(Object o) {
      if (o == this) {
        return true;
      }
      if (!(o instanceof MiningGrid)) {
        return false;
      }
      MiningGrid other = (MiningGrid) o;
      return bitField0_ == other.bitField0_
        && (!hasId() || id == other.id)
        && (!hasPosIndex() || posIndex == other.posIndex)
        && (!hasGridType() || gridType == other.gridType)
        && (!hasMarked() || marked == other.marked)
        && (!hasNextPackage() || nextPackage.equals(other.nextPackage));
    }

    @Override
    public void writeTo(final ProtoSink output) throws IOException {
      if ((bitField0_ & 0x00000001) != 0) {
        output.writeRawByte((byte) 8);
        output.writeUInt32NoTag(id);
      }
      if ((bitField0_ & 0x00000002) != 0) {
        output.writeRawByte((byte) 16);
        output.writeUInt32NoTag(posIndex);
      }
      if ((bitField0_ & 0x00000004) != 0) {
        output.writeRawByte((byte) 24);
        output.writeEnumNoTag(gridType);
      }
      if ((bitField0_ & 0x00000008) != 0) {
        output.writeRawByte((byte) 32);
        output.writeBoolNoTag(marked);
      }
      if ((bitField0_ & 0x00000010) != 0) {
        output.writeRawLittleEndian16((short) 32762);
        output.writeBytesNoTag(nextPackage);
      }
    }

    @Override
    protected int computeSerializedSize() {
      int size = 0;
      if ((bitField0_ & 0x00000001) != 0) {
        size += 1 + ProtoSink.computeUInt32SizeNoTag(id);
      }
      if ((bitField0_ & 0x00000002) != 0) {
        size += 1 + ProtoSink.computeUInt32SizeNoTag(posIndex);
      }
      if ((bitField0_ & 0x00000004) != 0) {
        size += 1 + ProtoSink.computeEnumSizeNoTag(gridType);
      }
      if ((bitField0_ & 0x00000008) != 0) {
        size += 2;
      }
      if ((bitField0_ & 0x00000010) != 0) {
        size += 2 + ProtoSink.computeBytesSizeNoTag(nextPackage);
      }
      return size;
    }

    @Override
    @SuppressWarnings("fallthrough")
    public MiningGrid mergeFrom(final ProtoSource input) throws IOException {
      // Enabled Fall-Through Optimization (QuickBuffers)
      int tag = input.readTag();
      while (true) {
        switch (tag) {
          case 8: {
            // id
            id = input.readUInt32();
            bitField0_ |= 0x00000001;
            tag = input.readTag();
            if (tag != 16) {
              break;
            }
          }
          case 16: {
            // posIndex
            posIndex = input.readUInt32();
            bitField0_ |= 0x00000002;
            tag = input.readTag();
            if (tag != 24) {
              break;
            }
          }
          case 24: {
            // gridType
            final int value = input.readInt32();
            if (MiningGridType.forNumber(value) != null) {
              gridType = value;
              bitField0_ |= 0x00000004;
            }
            tag = input.readTag();
            if (tag != 32) {
              break;
            }
          }
          case 32: {
            // marked
            marked = input.readBool();
            bitField0_ |= 0x00000008;
            tag = input.readTag();
            if (tag != 16378) {
              break;
            }
          }
          case 16378: {
            // nextPackage
            input.readBytes(nextPackage);
            bitField0_ |= 0x00000010;
            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.id, id);
      }
      if ((bitField0_ & 0x00000002) != 0) {
        output.writeUInt32(FieldNames.posIndex, posIndex);
      }
      if ((bitField0_ & 0x00000004) != 0) {
        output.writeEnum(FieldNames.gridType, gridType, MiningGridType.converter());
      }
      if ((bitField0_ & 0x00000008) != 0) {
        output.writeBool(FieldNames.marked, marked);
      }
      if ((bitField0_ & 0x00000010) != 0) {
        output.writeBytes(FieldNames.nextPackage, nextPackage);
      }
      output.endObject();
    }

    @Override
    public MiningGrid mergeFrom(final JsonSource input) throws IOException {
      if (!input.beginObject()) {
        return this;
      }
      while (!input.isAtEnd()) {
        switch (input.readFieldHash()) {
          case 2363: {
            if (input.isAtField(FieldNames.id)) {
              if (!input.trySkipNullValue()) {
                id = input.readUInt32();
                bitField0_ |= 0x00000001;
              }
            } else {
              input.skipUnknownField();
            }
            break;
          }
          case 782712574: {
            if (input.isAtField(FieldNames.posIndex)) {
              if (!input.trySkipNullValue()) {
                posIndex = input.readUInt32();
                bitField0_ |= 0x00000002;
              }
            } else {
              input.skipUnknownField();
            }
            break;
          }
          case 382721984: {
            if (input.isAtField(FieldNames.gridType)) {
              if (!input.trySkipNullValue()) {
                final MiningGridType value = input.readEnum(MiningGridType.converter());
                if (value != null) {
                  gridType = value.getNumber();
                  bitField0_ |= 0x00000004;
                } else {
                  input.skipUnknownEnumValue();
                }
              }
            } else {
              input.skipUnknownField();
            }
            break;
          }
          case -1997438900: {
            if (input.isAtField(FieldNames.marked)) {
              if (!input.trySkipNullValue()) {
                marked = input.readBool();
                bitField0_ |= 0x00000008;
              }
            } else {
              input.skipUnknownField();
            }
            break;
          }
          case -2082324045: {
            if (input.isAtField(FieldNames.nextPackage)) {
              if (!input.trySkipNullValue()) {
                input.readBytes(nextPackage);
                bitField0_ |= 0x00000010;
              }
            } else {
              input.skipUnknownField();
            }
            break;
          }
          default: {
            input.skipUnknownField();
            break;
          }
        }
      }
      input.endObject();
      return this;
    }

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

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

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

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

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

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

    private enum MiningGridFactory implements MessageFactory<MiningGrid> {
      INSTANCE;

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

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

      static final FieldName posIndex = FieldName.forField("PosIndex");

      static final FieldName gridType = FieldName.forField("GridType");

      static final FieldName marked = FieldName.forField("Marked");

      static final FieldName nextPackage = FieldName.forField("NextPackage");
    }
  }

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

    /**
     * <code>optional int32 UsableCount = 2;</code>
     */
    private int usableCount;

    /**
     * <code>optional int32 UsedCount = 3;</code>
     */
    private int usedCount;

    /**
     * <code>optional uint32 Id = 1;</code>
     */
    private int id;

    /**
     * <code>optional bytes NextPackage = 2047;</code>
     */
    private final RepeatedByte nextPackage = RepeatedByte.newEmptyInstance();

    private MiningSupport() {
    }

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

    /**
     * <code>optional int32 UsableCount = 2;</code>
     * @return whether the usableCount field is set
     */
    public boolean hasUsableCount() {
      return (bitField0_ & 0x00000001) != 0;
    }

    /**
     * <code>optional int32 UsableCount = 2;</code>
     * @return this
     */
    public MiningSupport clearUsableCount() {
      bitField0_ &= ~0x00000001;
      usableCount = 0;
      return this;
    }

    /**
     * <code>optional int32 UsableCount = 2;</code>
     * @return the usableCount
     */
    public int getUsableCount() {
      return usableCount;
    }

    /**
     * <code>optional int32 UsableCount = 2;</code>
     * @param value the usableCount to set
     * @return this
     */
    public MiningSupport setUsableCount(final int value) {
      bitField0_ |= 0x00000001;
      usableCount = value;
      return this;
    }

    /**
     * <code>optional int32 UsedCount = 3;</code>
     * @return whether the usedCount field is set
     */
    public boolean hasUsedCount() {
      return (bitField0_ & 0x00000002) != 0;
    }

    /**
     * <code>optional int32 UsedCount = 3;</code>
     * @return this
     */
    public MiningSupport clearUsedCount() {
      bitField0_ &= ~0x00000002;
      usedCount = 0;
      return this;
    }

    /**
     * <code>optional int32 UsedCount = 3;</code>
     * @return the usedCount
     */
    public int getUsedCount() {
      return usedCount;
    }

    /**
     * <code>optional int32 UsedCount = 3;</code>
     * @param value the usedCount to set
     * @return this
     */
    public MiningSupport setUsedCount(final int value) {
      bitField0_ |= 0x00000002;
      usedCount = value;
      return this;
    }

    /**
     * <code>optional uint32 Id = 1;</code>
     * @return whether the id field is set
     */
    public boolean hasId() {
      return (bitField0_ & 0x00000004) != 0;
    }

    /**
     * <code>optional uint32 Id = 1;</code>
     * @return this
     */
    public MiningSupport clearId() {
      bitField0_ &= ~0x00000004;
      id = 0;
      return this;
    }

    /**
     * <code>optional uint32 Id = 1;</code>
     * @return the id
     */
    public int getId() {
      return id;
    }

    /**
     * <code>optional uint32 Id = 1;</code>
     * @param value the id to set
     * @return this
     */
    public MiningSupport setId(final int value) {
      bitField0_ |= 0x00000004;
      id = value;
      return this;
    }

    /**
     * <code>optional bytes NextPackage = 2047;</code>
     * @return whether the nextPackage field is set
     */
    public boolean hasNextPackage() {
      return (bitField0_ & 0x00000008) != 0;
    }

    /**
     * <code>optional bytes NextPackage = 2047;</code>
     * @return this
     */
    public MiningSupport clearNextPackage() {
      bitField0_ &= ~0x00000008;
      nextPackage.clear();
      return this;
    }

    /**
     * <code>optional bytes NextPackage = 2047;</code>
     *
     * This method returns the internal storage object without modifying any has state.
     * The returned object should not be modified and be treated as read-only.
     *
     * Use {@link #getMutableNextPackage()} if you want to modify it.
     *
     * @return internal storage object for reading
     */
    public RepeatedByte getNextPackage() {
      return nextPackage;
    }

    /**
     * <code>optional bytes NextPackage = 2047;</code>
     *
     * This method returns the internal storage object and sets the corresponding
     * has state. The returned object will become part of this message and its
     * contents may be modified as long as the has state is not cleared.
     *
     * @return internal storage object for modifications
     */
    public RepeatedByte getMutableNextPackage() {
      bitField0_ |= 0x00000008;
      return nextPackage;
    }

    /**
     * <code>optional bytes NextPackage = 2047;</code>
     * @param value the nextPackage to add
     * @return this
     */
    public MiningSupport addNextPackage(final byte value) {
      bitField0_ |= 0x00000008;
      nextPackage.add(value);
      return this;
    }

    /**
     * <code>optional bytes NextPackage = 2047;</code>
     * @param values the nextPackage to add
     * @return this
     */
    public MiningSupport addAllNextPackage(final byte... values) {
      bitField0_ |= 0x00000008;
      nextPackage.addAll(values);
      return this;
    }

    /**
     * <code>optional bytes NextPackage = 2047;</code>
     * @param values the nextPackage to set
     * @return this
     */
    public MiningSupport setNextPackage(final byte... values) {
      bitField0_ |= 0x00000008;
      nextPackage.copyFrom(values);
      return this;
    }

    @Override
    public MiningSupport copyFrom(final MiningSupport other) {
      cachedSize = other.cachedSize;
      if ((bitField0_ | other.bitField0_) != 0) {
        bitField0_ = other.bitField0_;
        usableCount = other.usableCount;
        usedCount = other.usedCount;
        id = other.id;
        nextPackage.copyFrom(other.nextPackage);
      }
      return this;
    }

    @Override
    public MiningSupport mergeFrom(final MiningSupport other) {
      if (other.isEmpty()) {
        return this;
      }
      cachedSize = -1;
      if (other.hasUsableCount()) {
        setUsableCount(other.usableCount);
      }
      if (other.hasUsedCount()) {
        setUsedCount(other.usedCount);
      }
      if (other.hasId()) {
        setId(other.id);
      }
      if (other.hasNextPackage()) {
        getMutableNextPackage().copyFrom(other.nextPackage);
      }
      return this;
    }

    @Override
    public MiningSupport clear() {
      if (isEmpty()) {
        return this;
      }
      cachedSize = -1;
      bitField0_ = 0;
      usableCount = 0;
      usedCount = 0;
      id = 0;
      nextPackage.clear();
      return this;
    }

    @Override
    public MiningSupport clearQuick() {
      if (isEmpty()) {
        return this;
      }
      cachedSize = -1;
      bitField0_ = 0;
      nextPackage.clear();
      return this;
    }

    @Override
    public boolean equals(Object o) {
      if (o == this) {
        return true;
      }
      if (!(o instanceof MiningSupport)) {
        return false;
      }
      MiningSupport other = (MiningSupport) o;
      return bitField0_ == other.bitField0_
        && (!hasUsableCount() || usableCount == other.usableCount)
        && (!hasUsedCount() || usedCount == other.usedCount)
        && (!hasId() || id == other.id)
        && (!hasNextPackage() || nextPackage.equals(other.nextPackage));
    }

    @Override
    public void writeTo(final ProtoSink output) throws IOException {
      if ((bitField0_ & 0x00000001) != 0) {
        output.writeRawByte((byte) 16);
        output.writeInt32NoTag(usableCount);
      }
      if ((bitField0_ & 0x00000002) != 0) {
        output.writeRawByte((byte) 24);
        output.writeInt32NoTag(usedCount);
      }
      if ((bitField0_ & 0x00000004) != 0) {
        output.writeRawByte((byte) 8);
        output.writeUInt32NoTag(id);
      }
      if ((bitField0_ & 0x00000008) != 0) {
        output.writeRawLittleEndian16((short) 32762);
        output.writeBytesNoTag(nextPackage);
      }
    }

    @Override
    protected int computeSerializedSize() {
      int size = 0;
      if ((bitField0_ & 0x00000001) != 0) {
        size += 1 + ProtoSink.computeInt32SizeNoTag(usableCount);
      }
      if ((bitField0_ & 0x00000002) != 0) {
        size += 1 + ProtoSink.computeInt32SizeNoTag(usedCount);
      }
      if ((bitField0_ & 0x00000004) != 0) {
        size += 1 + ProtoSink.computeUInt32SizeNoTag(id);
      }
      if ((bitField0_ & 0x00000008) != 0) {
        size += 2 + ProtoSink.computeBytesSizeNoTag(nextPackage);
      }
      return size;
    }

    @Override
    @SuppressWarnings("fallthrough")
    public MiningSupport mergeFrom(final ProtoSource input) throws IOException {
      // Enabled Fall-Through Optimization (QuickBuffers)
      int tag = input.readTag();
      while (true) {
        switch (tag) {
          case 16: {
            // usableCount
            usableCount = input.readInt32();
            bitField0_ |= 0x00000001;
            tag = input.readTag();
            if (tag != 24) {
              break;
            }
          }
          case 24: {
            // usedCount
            usedCount = input.readInt32();
            bitField0_ |= 0x00000002;
            tag = input.readTag();
            if (tag != 8) {
              break;
            }
          }
          case 8: {
            // id
            id = input.readUInt32();
            bitField0_ |= 0x00000004;
            tag = input.readTag();
            if (tag != 16378) {
              break;
            }
          }
          case 16378: {
            // nextPackage
            input.readBytes(nextPackage);
            bitField0_ |= 0x00000008;
            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.writeInt32(FieldNames.usableCount, usableCount);
      }
      if ((bitField0_ & 0x00000002) != 0) {
        output.writeInt32(FieldNames.usedCount, usedCount);
      }
      if ((bitField0_ & 0x00000004) != 0) {
        output.writeUInt32(FieldNames.id, id);
      }
      if ((bitField0_ & 0x00000008) != 0) {
        output.writeBytes(FieldNames.nextPackage, nextPackage);
      }
      output.endObject();
    }

    @Override
    public MiningSupport mergeFrom(final JsonSource input) throws IOException {
      if (!input.beginObject()) {
        return this;
      }
      while (!input.isAtEnd()) {
        switch (input.readFieldHash()) {
          case 544030423: {
            if (input.isAtField(FieldNames.usableCount)) {
              if (!input.trySkipNullValue()) {
                usableCount = input.readInt32();
                bitField0_ |= 0x00000001;
              }
            } else {
              input.skipUnknownField();
            }
            break;
          }
          case 1916691250: {
            if (input.isAtField(FieldNames.usedCount)) {
              if (!input.trySkipNullValue()) {
                usedCount = input.readInt32();
                bitField0_ |= 0x00000002;
              }
            } else {
              input.skipUnknownField();
            }
            break;
          }
          case 2363: {
            if (input.isAtField(FieldNames.id)) {
              if (!input.trySkipNullValue()) {
                id = input.readUInt32();
                bitField0_ |= 0x00000004;
              }
            } else {
              input.skipUnknownField();
            }
            break;
          }
          case -2082324045: {
            if (input.isAtField(FieldNames.nextPackage)) {
              if (!input.trySkipNullValue()) {
                input.readBytes(nextPackage);
                bitField0_ |= 0x00000008;
              }
            } else {
              input.skipUnknownField();
            }
            break;
          }
          default: {
            input.skipUnknownField();
            break;
          }
        }
      }
      input.endObject();
      return this;
    }

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

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

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

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

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

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

    private enum MiningSupportFactory implements MessageFactory<MiningSupport> {
      INSTANCE;

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

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

      static final FieldName usedCount = FieldName.forField("UsedCount");

      static final FieldName id = FieldName.forField("Id");

      static final FieldName nextPackage = FieldName.forField("NextPackage");
    }
  }

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

    /**
     * <code>optional uint32 Id = 1;</code>
     */
    private int id;

    /**
     * <code>optional bytes NextPackage = 2047;</code>
     */
    private final RepeatedByte nextPackage = RepeatedByte.newEmptyInstance();

    /**
     * <code>repeated .MiningTreasure Treasures = 2;</code>
     */
    private final RepeatedMessage<MiningTreasure> treasures = RepeatedMessage.newEmptyInstance(MiningTreasure.getFactory());

    /**
     * <code>repeated .MiningGrid Grids = 3;</code>
     */
    private final RepeatedMessage<MiningGrid> grids = RepeatedMessage.newEmptyInstance(MiningGrid.getFactory());

    private MiningMap() {
    }

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

    /**
     * <code>optional uint32 Id = 1;</code>
     * @return whether the id field is set
     */
    public boolean hasId() {
      return (bitField0_ & 0x00000001) != 0;
    }

    /**
     * <code>optional uint32 Id = 1;</code>
     * @return this
     */
    public MiningMap clearId() {
      bitField0_ &= ~0x00000001;
      id = 0;
      return this;
    }

    /**
     * <code>optional uint32 Id = 1;</code>
     * @return the id
     */
    public int getId() {
      return id;
    }

    /**
     * <code>optional uint32 Id = 1;</code>
     * @param value the id to set
     * @return this
     */
    public MiningMap setId(final int value) {
      bitField0_ |= 0x00000001;
      id = value;
      return this;
    }

    /**
     * <code>optional bytes NextPackage = 2047;</code>
     * @return whether the nextPackage field is set
     */
    public boolean hasNextPackage() {
      return (bitField0_ & 0x00000002) != 0;
    }

    /**
     * <code>optional bytes NextPackage = 2047;</code>
     * @return this
     */
    public MiningMap clearNextPackage() {
      bitField0_ &= ~0x00000002;
      nextPackage.clear();
      return this;
    }

    /**
     * <code>optional bytes NextPackage = 2047;</code>
     *
     * This method returns the internal storage object without modifying any has state.
     * The returned object should not be modified and be treated as read-only.
     *
     * Use {@link #getMutableNextPackage()} if you want to modify it.
     *
     * @return internal storage object for reading
     */
    public RepeatedByte getNextPackage() {
      return nextPackage;
    }

    /**
     * <code>optional bytes NextPackage = 2047;</code>
     *
     * This method returns the internal storage object and sets the corresponding
     * has state. The returned object will become part of this message and its
     * contents may be modified as long as the has state is not cleared.
     *
     * @return internal storage object for modifications
     */
    public RepeatedByte getMutableNextPackage() {
      bitField0_ |= 0x00000002;
      return nextPackage;
    }

    /**
     * <code>optional bytes NextPackage = 2047;</code>
     * @param value the nextPackage to add
     * @return this
     */
    public MiningMap addNextPackage(final byte value) {
      bitField0_ |= 0x00000002;
      nextPackage.add(value);
      return this;
    }

    /**
     * <code>optional bytes NextPackage = 2047;</code>
     * @param values the nextPackage to add
     * @return this
     */
    public MiningMap addAllNextPackage(final byte... values) {
      bitField0_ |= 0x00000002;
      nextPackage.addAll(values);
      return this;
    }

    /**
     * <code>optional bytes NextPackage = 2047;</code>
     * @param values the nextPackage to set
     * @return this
     */
    public MiningMap setNextPackage(final byte... values) {
      bitField0_ |= 0x00000002;
      nextPackage.copyFrom(values);
      return this;
    }

    /**
     * <code>repeated .MiningTreasure Treasures = 2;</code>
     * @return whether the treasures field is set
     */
    public boolean hasTreasures() {
      return (bitField0_ & 0x00000004) != 0;
    }

    /**
     * <code>repeated .MiningTreasure Treasures = 2;</code>
     * @return this
     */
    public MiningMap clearTreasures() {
      bitField0_ &= ~0x00000004;
      treasures.clear();
      return this;
    }

    /**
     * <code>repeated .MiningTreasure Treasures = 2;</code>
     *
     * This method returns the internal storage object without modifying any has state.
     * The returned object should not be modified and be treated as read-only.
     *
     * Use {@link #getMutableTreasures()} if you want to modify it.
     *
     * @return internal storage object for reading
     */
    public RepeatedMessage<MiningTreasure> getTreasures() {
      return treasures;
    }

    /**
     * <code>repeated .MiningTreasure Treasures = 2;</code>
     *
     * This method returns the internal storage object and sets the corresponding
     * has state. The returned object will become part of this message and its
     * contents may be modified as long as the has state is not cleared.
     *
     * @return internal storage object for modifications
     */
    public RepeatedMessage<MiningTreasure> getMutableTreasures() {
      bitField0_ |= 0x00000004;
      return treasures;
    }

    /**
     * <code>repeated .MiningTreasure Treasures = 2;</code>
     * @param value the treasures to add
     * @return this
     */
    public MiningMap addTreasures(final MiningTreasure value) {
      bitField0_ |= 0x00000004;
      treasures.add(value);
      return this;
    }

    /**
     * <code>repeated .MiningTreasure Treasures = 2;</code>
     * @param values the treasures to add
     * @return this
     */
    public MiningMap addAllTreasures(final MiningTreasure... values) {
      bitField0_ |= 0x00000004;
      treasures.addAll(values);
      return this;
    }

    /**
     * <code>repeated .MiningGrid Grids = 3;</code>
     * @return whether the grids field is set
     */
    public boolean hasGrids() {
      return (bitField0_ & 0x00000008) != 0;
    }

    /**
     * <code>repeated .MiningGrid Grids = 3;</code>
     * @return this
     */
    public MiningMap clearGrids() {
      bitField0_ &= ~0x00000008;
      grids.clear();
      return this;
    }

    /**
     * <code>repeated .MiningGrid Grids = 3;</code>
     *
     * This method returns the internal storage object without modifying any has state.
     * The returned object should not be modified and be treated as read-only.
     *
     * Use {@link #getMutableGrids()} if you want to modify it.
     *
     * @return internal storage object for reading
     */
    public RepeatedMessage<MiningGrid> getGrids() {
      return grids;
    }

    /**
     * <code>repeated .MiningGrid Grids = 3;</code>
     *
     * This method returns the internal storage object and sets the corresponding
     * has state. The returned object will become part of this message and its
     * contents may be modified as long as the has state is not cleared.
     *
     * @return internal storage object for modifications
     */
    public RepeatedMessage<MiningGrid> getMutableGrids() {
      bitField0_ |= 0x00000008;
      return grids;
    }

    /**
     * <code>repeated .MiningGrid Grids = 3;</code>
     * @param value the grids to add
     * @return this
     */
    public MiningMap addGrids(final MiningGrid value) {
      bitField0_ |= 0x00000008;
      grids.add(value);
      return this;
    }

    /**
     * <code>repeated .MiningGrid Grids = 3;</code>
     * @param values the grids to add
     * @return this
     */
    public MiningMap addAllGrids(final MiningGrid... values) {
      bitField0_ |= 0x00000008;
      grids.addAll(values);
      return this;
    }

    @Override
    public MiningMap copyFrom(final MiningMap other) {
      cachedSize = other.cachedSize;
      if ((bitField0_ | other.bitField0_) != 0) {
        bitField0_ = other.bitField0_;
        id = other.id;
        nextPackage.copyFrom(other.nextPackage);
        treasures.copyFrom(other.treasures);
        grids.copyFrom(other.grids);
      }
      return this;
    }

    @Override
    public MiningMap mergeFrom(final MiningMap other) {
      if (other.isEmpty()) {
        return this;
      }
      cachedSize = -1;
      if (other.hasId()) {
        setId(other.id);
      }
      if (other.hasNextPackage()) {
        getMutableNextPackage().copyFrom(other.nextPackage);
      }
      if (other.hasTreasures()) {
        getMutableTreasures().addAll(other.treasures);
      }
      if (other.hasGrids()) {
        getMutableGrids().addAll(other.grids);
      }
      return this;
    }

    @Override
    public MiningMap clear() {
      if (isEmpty()) {
        return this;
      }
      cachedSize = -1;
      bitField0_ = 0;
      id = 0;
      nextPackage.clear();
      treasures.clear();
      grids.clear();
      return this;
    }

    @Override
    public MiningMap clearQuick() {
      if (isEmpty()) {
        return this;
      }
      cachedSize = -1;
      bitField0_ = 0;
      nextPackage.clear();
      treasures.clearQuick();
      grids.clearQuick();
      return this;
    }

    @Override
    public boolean equals(Object o) {
      if (o == this) {
        return true;
      }
      if (!(o instanceof MiningMap)) {
        return false;
      }
      MiningMap other = (MiningMap) o;
      return bitField0_ == other.bitField0_
        && (!hasId() || id == other.id)
        && (!hasNextPackage() || nextPackage.equals(other.nextPackage))
        && (!hasTreasures() || treasures.equals(other.treasures))
        && (!hasGrids() || grids.equals(other.grids));
    }

    @Override
    public void writeTo(final ProtoSink output) throws IOException {
      if ((bitField0_ & 0x00000001) != 0) {
        output.writeRawByte((byte) 8);
        output.writeUInt32NoTag(id);
      }
      if ((bitField0_ & 0x00000002) != 0) {
        output.writeRawLittleEndian16((short) 32762);
        output.writeBytesNoTag(nextPackage);
      }
      if ((bitField0_ & 0x00000004) != 0) {
        for (int i = 0; i < treasures.length(); i++) {
          output.writeRawByte((byte) 18);
          output.writeMessageNoTag(treasures.get(i));
        }
      }
      if ((bitField0_ & 0x00000008) != 0) {
        for (int i = 0; i < grids.length(); i++) {
          output.writeRawByte((byte) 26);
          output.writeMessageNoTag(grids.get(i));
        }
      }
    }

    @Override
    protected int computeSerializedSize() {
      int size = 0;
      if ((bitField0_ & 0x00000001) != 0) {
        size += 1 + ProtoSink.computeUInt32SizeNoTag(id);
      }
      if ((bitField0_ & 0x00000002) != 0) {
        size += 2 + ProtoSink.computeBytesSizeNoTag(nextPackage);
      }
      if ((bitField0_ & 0x00000004) != 0) {
        size += (1 * treasures.length()) + ProtoSink.computeRepeatedMessageSizeNoTag(treasures);
      }
      if ((bitField0_ & 0x00000008) != 0) {
        size += (1 * grids.length()) + ProtoSink.computeRepeatedMessageSizeNoTag(grids);
      }
      return size;
    }

    @Override
    @SuppressWarnings("fallthrough")
    public MiningMap mergeFrom(final ProtoSource input) throws IOException {
      // Enabled Fall-Through Optimization (QuickBuffers)
      int tag = input.readTag();
      while (true) {
        switch (tag) {
          case 8: {
            // id
            id = input.readUInt32();
            bitField0_ |= 0x00000001;
            tag = input.readTag();
            if (tag != 16378) {
              break;
            }
          }
          case 16378: {
            // nextPackage
            input.readBytes(nextPackage);
            bitField0_ |= 0x00000002;
            tag = input.readTag();
            if (tag != 18) {
              break;
            }
          }
          case 18: {
            // treasures
            tag = input.readRepeatedMessage(treasures, tag);
            bitField0_ |= 0x00000004;
            if (tag != 26) {
              break;
            }
          }
          case 26: {
            // grids
            tag = input.readRepeatedMessage(grids, tag);
            bitField0_ |= 0x00000008;
            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.id, id);
      }
      if ((bitField0_ & 0x00000002) != 0) {
        output.writeBytes(FieldNames.nextPackage, nextPackage);
      }
      if ((bitField0_ & 0x00000004) != 0) {
        output.writeRepeatedMessage(FieldNames.treasures, treasures);
      }
      if ((bitField0_ & 0x00000008) != 0) {
        output.writeRepeatedMessage(FieldNames.grids, grids);
      }
      output.endObject();
    }

    @Override
    public MiningMap mergeFrom(final JsonSource input) throws IOException {
      if (!input.beginObject()) {
        return this;
      }
      while (!input.isAtEnd()) {
        switch (input.readFieldHash()) {
          case 2363: {
            if (input.isAtField(FieldNames.id)) {
              if (!input.trySkipNullValue()) {
                id = input.readUInt32();
                bitField0_ |= 0x00000001;
              }
            } else {
              input.skipUnknownField();
            }
            break;
          }
          case -2082324045: {
            if (input.isAtField(FieldNames.nextPackage)) {
              if (!input.trySkipNullValue()) {
                input.readBytes(nextPackage);
                bitField0_ |= 0x00000002;
              }
            } else {
              input.skipUnknownField();
            }
            break;
          }
          case 1939952516: {
            if (input.isAtField(FieldNames.treasures)) {
              if (!input.trySkipNullValue()) {
                input.readRepeatedMessage(treasures);
                bitField0_ |= 0x00000004;
              }
            } else {
              input.skipUnknownField();
            }
            break;
          }
          case 69070285: {
            if (input.isAtField(FieldNames.grids)) {
              if (!input.trySkipNullValue()) {
                input.readRepeatedMessage(grids);
                bitField0_ |= 0x00000008;
              }
            } else {
              input.skipUnknownField();
            }
            break;
          }
          default: {
            input.skipUnknownField();
            break;
          }
        }
      }
      input.endObject();
      return this;
    }

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

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

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

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

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

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

    private enum MiningMapFactory implements MessageFactory<MiningMap> {
      INSTANCE;

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

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

      static final FieldName nextPackage = FieldName.forField("NextPackage");

      static final FieldName treasures = FieldName.forField("Treasures");

      static final FieldName grids = FieldName.forField("Grids");
    }
  }

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

    /**
     * <code>optional uint32 Layer = 1;</code>
     */
    private int layer;

    /**
     * <code>optional .MiningMap Map = 3;</code>
     */
    private final MiningMap map = MiningMap.newInstance();

    /**
     * <code>optional bytes NextPackage = 2047;</code>
     */
    private final RepeatedByte nextPackage = RepeatedByte.newEmptyInstance();

    /**
     * <code>repeated .MiningSupport Supports = 4;</code>
     */
    private final RepeatedMessage<MiningSupport> supports = RepeatedMessage.newEmptyInstance(MiningSupport.getFactory());

    private MiningLayer() {
    }

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

    /**
     * <code>optional uint32 Layer = 1;</code>
     * @return whether the layer field is set
     */
    public boolean hasLayer() {
      return (bitField0_ & 0x00000001) != 0;
    }

    /**
     * <code>optional uint32 Layer = 1;</code>
     * @return this
     */
    public MiningLayer clearLayer() {
      bitField0_ &= ~0x00000001;
      layer = 0;
      return this;
    }

    /**
     * <code>optional uint32 Layer = 1;</code>
     * @return the layer
     */
    public int getLayer() {
      return layer;
    }

    /**
     * <code>optional uint32 Layer = 1;</code>
     * @param value the layer to set
     * @return this
     */
    public MiningLayer setLayer(final int value) {
      bitField0_ |= 0x00000001;
      layer = value;
      return this;
    }

    /**
     * <code>optional .MiningMap Map = 3;</code>
     * @return whether the map field is set
     */
    public boolean hasMap() {
      return (bitField0_ & 0x00000002) != 0;
    }

    /**
     * <code>optional .MiningMap Map = 3;</code>
     * @return this
     */
    public MiningLayer clearMap() {
      bitField0_ &= ~0x00000002;
      map.clear();
      return this;
    }

    /**
     * <code>optional .MiningMap Map = 3;</code>
     *
     * This method returns the internal storage object without modifying any has state.
     * The returned object should not be modified and be treated as read-only.
     *
     * Use {@link #getMutableMap()} if you want to modify it.
     *
     * @return internal storage object for reading
     */
    public MiningMap getMap() {
      return map;
    }

    /**
     * <code>optional .MiningMap Map = 3;</code>
     *
     * This method returns the internal storage object and sets the corresponding
     * has state. The returned object will become part of this message and its
     * contents may be modified as long as the has state is not cleared.
     *
     * @return internal storage object for modifications
     */
    public MiningMap getMutableMap() {
      bitField0_ |= 0x00000002;
      return map;
    }

    /**
     * <code>optional .MiningMap Map = 3;</code>
     * @param value the map to set
     * @return this
     */
    public MiningLayer setMap(final MiningMap value) {
      bitField0_ |= 0x00000002;
      map.copyFrom(value);
      return this;
    }

    /**
     * <code>optional bytes NextPackage = 2047;</code>
     * @return whether the nextPackage field is set
     */
    public boolean hasNextPackage() {
      return (bitField0_ & 0x00000004) != 0;
    }

    /**
     * <code>optional bytes NextPackage = 2047;</code>
     * @return this
     */
    public MiningLayer clearNextPackage() {
      bitField0_ &= ~0x00000004;
      nextPackage.clear();
      return this;
    }

    /**
     * <code>optional bytes NextPackage = 2047;</code>
     *
     * This method returns the internal storage object without modifying any has state.
     * The returned object should not be modified and be treated as read-only.
     *
     * Use {@link #getMutableNextPackage()} if you want to modify it.
     *
     * @return internal storage object for reading
     */
    public RepeatedByte getNextPackage() {
      return nextPackage;
    }

    /**
     * <code>optional bytes NextPackage = 2047;</code>
     *
     * This method returns the internal storage object and sets the corresponding
     * has state. The returned object will become part of this message and its
     * contents may be modified as long as the has state is not cleared.
     *
     * @return internal storage object for modifications
     */
    public RepeatedByte getMutableNextPackage() {
      bitField0_ |= 0x00000004;
      return nextPackage;
    }

    /**
     * <code>optional bytes NextPackage = 2047;</code>
     * @param value the nextPackage to add
     * @return this
     */
    public MiningLayer addNextPackage(final byte value) {
      bitField0_ |= 0x00000004;
      nextPackage.add(value);
      return this;
    }

    /**
     * <code>optional bytes NextPackage = 2047;</code>
     * @param values the nextPackage to add
     * @return this
     */
    public MiningLayer addAllNextPackage(final byte... values) {
      bitField0_ |= 0x00000004;
      nextPackage.addAll(values);
      return this;
    }

    /**
     * <code>optional bytes NextPackage = 2047;</code>
     * @param values the nextPackage to set
     * @return this
     */
    public MiningLayer setNextPackage(final byte... values) {
      bitField0_ |= 0x00000004;
      nextPackage.copyFrom(values);
      return this;
    }

    /**
     * <code>repeated .MiningSupport Supports = 4;</code>
     * @return whether the supports field is set
     */
    public boolean hasSupports() {
      return (bitField0_ & 0x00000008) != 0;
    }

    /**
     * <code>repeated .MiningSupport Supports = 4;</code>
     * @return this
     */
    public MiningLayer clearSupports() {
      bitField0_ &= ~0x00000008;
      supports.clear();
      return this;
    }

    /**
     * <code>repeated .MiningSupport Supports = 4;</code>
     *
     * This method returns the internal storage object without modifying any has state.
     * The returned object should not be modified and be treated as read-only.
     *
     * Use {@link #getMutableSupports()} if you want to modify it.
     *
     * @return internal storage object for reading
     */
    public RepeatedMessage<MiningSupport> getSupports() {
      return supports;
    }

    /**
     * <code>repeated .MiningSupport Supports = 4;</code>
     *
     * This method returns the internal storage object and sets the corresponding
     * has state. The returned object will become part of this message and its
     * contents may be modified as long as the has state is not cleared.
     *
     * @return internal storage object for modifications
     */
    public RepeatedMessage<MiningSupport> getMutableSupports() {
      bitField0_ |= 0x00000008;
      return supports;
    }

    /**
     * <code>repeated .MiningSupport Supports = 4;</code>
     * @param value the supports to add
     * @return this
     */
    public MiningLayer addSupports(final MiningSupport value) {
      bitField0_ |= 0x00000008;
      supports.add(value);
      return this;
    }

    /**
     * <code>repeated .MiningSupport Supports = 4;</code>
     * @param values the supports to add
     * @return this
     */
    public MiningLayer addAllSupports(final MiningSupport... values) {
      bitField0_ |= 0x00000008;
      supports.addAll(values);
      return this;
    }

    @Override
    public MiningLayer copyFrom(final MiningLayer other) {
      cachedSize = other.cachedSize;
      if ((bitField0_ | other.bitField0_) != 0) {
        bitField0_ = other.bitField0_;
        layer = other.layer;
        map.copyFrom(other.map);
        nextPackage.copyFrom(other.nextPackage);
        supports.copyFrom(other.supports);
      }
      return this;
    }

    @Override
    public MiningLayer mergeFrom(final MiningLayer other) {
      if (other.isEmpty()) {
        return this;
      }
      cachedSize = -1;
      if (other.hasLayer()) {
        setLayer(other.layer);
      }
      if (other.hasMap()) {
        getMutableMap().mergeFrom(other.map);
      }
      if (other.hasNextPackage()) {
        getMutableNextPackage().copyFrom(other.nextPackage);
      }
      if (other.hasSupports()) {
        getMutableSupports().addAll(other.supports);
      }
      return this;
    }

    @Override
    public MiningLayer clear() {
      if (isEmpty()) {
        return this;
      }
      cachedSize = -1;
      bitField0_ = 0;
      layer = 0;
      map.clear();
      nextPackage.clear();
      supports.clear();
      return this;
    }

    @Override
    public MiningLayer clearQuick() {
      if (isEmpty()) {
        return this;
      }
      cachedSize = -1;
      bitField0_ = 0;
      map.clearQuick();
      nextPackage.clear();
      supports.clearQuick();
      return this;
    }

    @Override
    public boolean equals(Object o) {
      if (o == this) {
        return true;
      }
      if (!(o instanceof MiningLayer)) {
        return false;
      }
      MiningLayer other = (MiningLayer) o;
      return bitField0_ == other.bitField0_
        && (!hasLayer() || layer == other.layer)
        && (!hasMap() || map.equals(other.map))
        && (!hasNextPackage() || nextPackage.equals(other.nextPackage))
        && (!hasSupports() || supports.equals(other.supports));
    }

    @Override
    public void writeTo(final ProtoSink output) throws IOException {
      if ((bitField0_ & 0x00000001) != 0) {
        output.writeRawByte((byte) 8);
        output.writeUInt32NoTag(layer);
      }
      if ((bitField0_ & 0x00000002) != 0) {
        output.writeRawByte((byte) 26);
        output.writeMessageNoTag(map);
      }
      if ((bitField0_ & 0x00000004) != 0) {
        output.writeRawLittleEndian16((short) 32762);
        output.writeBytesNoTag(nextPackage);
      }
      if ((bitField0_ & 0x00000008) != 0) {
        for (int i = 0; i < supports.length(); i++) {
          output.writeRawByte((byte) 34);
          output.writeMessageNoTag(supports.get(i));
        }
      }
    }

    @Override
    protected int computeSerializedSize() {
      int size = 0;
      if ((bitField0_ & 0x00000001) != 0) {
        size += 1 + ProtoSink.computeUInt32SizeNoTag(layer);
      }
      if ((bitField0_ & 0x00000002) != 0) {
        size += 1 + ProtoSink.computeMessageSizeNoTag(map);
      }
      if ((bitField0_ & 0x00000004) != 0) {
        size += 2 + ProtoSink.computeBytesSizeNoTag(nextPackage);
      }
      if ((bitField0_ & 0x00000008) != 0) {
        size += (1 * supports.length()) + ProtoSink.computeRepeatedMessageSizeNoTag(supports);
      }
      return size;
    }

    @Override
    @SuppressWarnings("fallthrough")
    public MiningLayer mergeFrom(final ProtoSource input) throws IOException {
      // Enabled Fall-Through Optimization (QuickBuffers)
      int tag = input.readTag();
      while (true) {
        switch (tag) {
          case 8: {
            // layer
            layer = input.readUInt32();
            bitField0_ |= 0x00000001;
            tag = input.readTag();
            if (tag != 26) {
              break;
            }
          }
          case 26: {
            // map
            input.readMessage(map);
            bitField0_ |= 0x00000002;
            tag = input.readTag();
            if (tag != 16378) {
              break;
            }
          }
          case 16378: {
            // nextPackage
            input.readBytes(nextPackage);
            bitField0_ |= 0x00000004;
            tag = input.readTag();
            if (tag != 34) {
              break;
            }
          }
          case 34: {
            // supports
            tag = input.readRepeatedMessage(supports, tag);
            bitField0_ |= 0x00000008;
            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.layer, layer);
      }
      if ((bitField0_ & 0x00000002) != 0) {
        output.writeMessage(FieldNames.map, map);
      }
      if ((bitField0_ & 0x00000004) != 0) {
        output.writeBytes(FieldNames.nextPackage, nextPackage);
      }
      if ((bitField0_ & 0x00000008) != 0) {
        output.writeRepeatedMessage(FieldNames.supports, supports);
      }
      output.endObject();
    }

    @Override
    public MiningLayer mergeFrom(final JsonSource input) throws IOException {
      if (!input.beginObject()) {
        return this;
      }
      while (!input.isAtEnd()) {
        switch (input.readFieldHash()) {
          case 73196849: {
            if (input.isAtField(FieldNames.layer)) {
              if (!input.trySkipNullValue()) {
                layer = input.readUInt32();
                bitField0_ |= 0x00000001;
              }
            } else {
              input.skipUnknownField();
            }
            break;
          }
          case 77116: {
            if (input.isAtField(FieldNames.map)) {
              if (!input.trySkipNullValue()) {
                input.readMessage(map);
                bitField0_ |= 0x00000002;
              }
            } else {
              input.skipUnknownField();
            }
            break;
          }
          case -2082324045: {
            if (input.isAtField(FieldNames.nextPackage)) {
              if (!input.trySkipNullValue()) {
                input.readBytes(nextPackage);
                bitField0_ |= 0x00000004;
              }
            } else {
              input.skipUnknownField();
            }
            break;
          }
          case -1598562652: {
            if (input.isAtField(FieldNames.supports)) {
              if (!input.trySkipNullValue()) {
                input.readRepeatedMessage(supports);
                bitField0_ |= 0x00000008;
              }
            } else {
              input.skipUnknownField();
            }
            break;
          }
          default: {
            input.skipUnknownField();
            break;
          }
        }
      }
      input.endObject();
      return this;
    }

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

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

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

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

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

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

    private enum MiningLayerFactory implements MessageFactory<MiningLayer> {
      INSTANCE;

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

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

      static final FieldName map = FieldName.forField("Map");

      static final FieldName nextPackage = FieldName.forField("NextPackage");

      static final FieldName supports = FieldName.forField("Supports");
    }
  }

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

    /**
     * <code>optional int32 EffectType = 1;</code>
     */
    private int effectType;

    /**
     * <code>optional bytes NextPackage = 2047;</code>
     */
    private final RepeatedByte nextPackage = RepeatedByte.newEmptyInstance();

    /**
     * <code>repeated .MiningGrid EffectedGrids = 2;</code>
     */
    private final RepeatedMessage<MiningGrid> effectedGrids = RepeatedMessage.newEmptyInstance(MiningGrid.getFactory());

    private MiningProcess() {
    }

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

    /**
     * <code>optional int32 EffectType = 1;</code>
     * @return whether the effectType field is set
     */
    public boolean hasEffectType() {
      return (bitField0_ & 0x00000001) != 0;
    }

    /**
     * <code>optional int32 EffectType = 1;</code>
     * @return this
     */
    public MiningProcess clearEffectType() {
      bitField0_ &= ~0x00000001;
      effectType = 0;
      return this;
    }

    /**
     * <code>optional int32 EffectType = 1;</code>
     * @return the effectType
     */
    public int getEffectType() {
      return effectType;
    }

    /**
     * <code>optional int32 EffectType = 1;</code>
     * @param value the effectType to set
     * @return this
     */
    public MiningProcess setEffectType(final int value) {
      bitField0_ |= 0x00000001;
      effectType = value;
      return this;
    }

    /**
     * <code>optional bytes NextPackage = 2047;</code>
     * @return whether the nextPackage field is set
     */
    public boolean hasNextPackage() {
      return (bitField0_ & 0x00000002) != 0;
    }

    /**
     * <code>optional bytes NextPackage = 2047;</code>
     * @return this
     */
    public MiningProcess clearNextPackage() {
      bitField0_ &= ~0x00000002;
      nextPackage.clear();
      return this;
    }

    /**
     * <code>optional bytes NextPackage = 2047;</code>
     *
     * This method returns the internal storage object without modifying any has state.
     * The returned object should not be modified and be treated as read-only.
     *
     * Use {@link #getMutableNextPackage()} if you want to modify it.
     *
     * @return internal storage object for reading
     */
    public RepeatedByte getNextPackage() {
      return nextPackage;
    }

    /**
     * <code>optional bytes NextPackage = 2047;</code>
     *
     * This method returns the internal storage object and sets the corresponding
     * has state. The returned object will become part of this message and its
     * contents may be modified as long as the has state is not cleared.
     *
     * @return internal storage object for modifications
     */
    public RepeatedByte getMutableNextPackage() {
      bitField0_ |= 0x00000002;
      return nextPackage;
    }

    /**
     * <code>optional bytes NextPackage = 2047;</code>
     * @param value the nextPackage to add
     * @return this
     */
    public MiningProcess addNextPackage(final byte value) {
      bitField0_ |= 0x00000002;
      nextPackage.add(value);
      return this;
    }

    /**
     * <code>optional bytes NextPackage = 2047;</code>
     * @param values the nextPackage to add
     * @return this
     */
    public MiningProcess addAllNextPackage(final byte... values) {
      bitField0_ |= 0x00000002;
      nextPackage.addAll(values);
      return this;
    }

    /**
     * <code>optional bytes NextPackage = 2047;</code>
     * @param values the nextPackage to set
     * @return this
     */
    public MiningProcess setNextPackage(final byte... values) {
      bitField0_ |= 0x00000002;
      nextPackage.copyFrom(values);
      return this;
    }

    /**
     * <code>repeated .MiningGrid EffectedGrids = 2;</code>
     * @return whether the effectedGrids field is set
     */
    public boolean hasEffectedGrids() {
      return (bitField0_ & 0x00000004) != 0;
    }

    /**
     * <code>repeated .MiningGrid EffectedGrids = 2;</code>
     * @return this
     */
    public MiningProcess clearEffectedGrids() {
      bitField0_ &= ~0x00000004;
      effectedGrids.clear();
      return this;
    }

    /**
     * <code>repeated .MiningGrid EffectedGrids = 2;</code>
     *
     * This method returns the internal storage object without modifying any has state.
     * The returned object should not be modified and be treated as read-only.
     *
     * Use {@link #getMutableEffectedGrids()} if you want to modify it.
     *
     * @return internal storage object for reading
     */
    public RepeatedMessage<MiningGrid> getEffectedGrids() {
      return effectedGrids;
    }

    /**
     * <code>repeated .MiningGrid EffectedGrids = 2;</code>
     *
     * This method returns the internal storage object and sets the corresponding
     * has state. The returned object will become part of this message and its
     * contents may be modified as long as the has state is not cleared.
     *
     * @return internal storage object for modifications
     */
    public RepeatedMessage<MiningGrid> getMutableEffectedGrids() {
      bitField0_ |= 0x00000004;
      return effectedGrids;
    }

    /**
     * <code>repeated .MiningGrid EffectedGrids = 2;</code>
     * @param value the effectedGrids to add
     * @return this
     */
    public MiningProcess addEffectedGrids(final MiningGrid value) {
      bitField0_ |= 0x00000004;
      effectedGrids.add(value);
      return this;
    }

    /**
     * <code>repeated .MiningGrid EffectedGrids = 2;</code>
     * @param values the effectedGrids to add
     * @return this
     */
    public MiningProcess addAllEffectedGrids(final MiningGrid... values) {
      bitField0_ |= 0x00000004;
      effectedGrids.addAll(values);
      return this;
    }

    @Override
    public MiningProcess copyFrom(final MiningProcess other) {
      cachedSize = other.cachedSize;
      if ((bitField0_ | other.bitField0_) != 0) {
        bitField0_ = other.bitField0_;
        effectType = other.effectType;
        nextPackage.copyFrom(other.nextPackage);
        effectedGrids.copyFrom(other.effectedGrids);
      }
      return this;
    }

    @Override
    public MiningProcess mergeFrom(final MiningProcess other) {
      if (other.isEmpty()) {
        return this;
      }
      cachedSize = -1;
      if (other.hasEffectType()) {
        setEffectType(other.effectType);
      }
      if (other.hasNextPackage()) {
        getMutableNextPackage().copyFrom(other.nextPackage);
      }
      if (other.hasEffectedGrids()) {
        getMutableEffectedGrids().addAll(other.effectedGrids);
      }
      return this;
    }

    @Override
    public MiningProcess clear() {
      if (isEmpty()) {
        return this;
      }
      cachedSize = -1;
      bitField0_ = 0;
      effectType = 0;
      nextPackage.clear();
      effectedGrids.clear();
      return this;
    }

    @Override
    public MiningProcess clearQuick() {
      if (isEmpty()) {
        return this;
      }
      cachedSize = -1;
      bitField0_ = 0;
      nextPackage.clear();
      effectedGrids.clearQuick();
      return this;
    }

    @Override
    public boolean equals(Object o) {
      if (o == this) {
        return true;
      }
      if (!(o instanceof MiningProcess)) {
        return false;
      }
      MiningProcess other = (MiningProcess) o;
      return bitField0_ == other.bitField0_
        && (!hasEffectType() || effectType == other.effectType)
        && (!hasNextPackage() || nextPackage.equals(other.nextPackage))
        && (!hasEffectedGrids() || effectedGrids.equals(other.effectedGrids));
    }

    @Override
    public void writeTo(final ProtoSink output) throws IOException {
      if ((bitField0_ & 0x00000001) != 0) {
        output.writeRawByte((byte) 8);
        output.writeInt32NoTag(effectType);
      }
      if ((bitField0_ & 0x00000002) != 0) {
        output.writeRawLittleEndian16((short) 32762);
        output.writeBytesNoTag(nextPackage);
      }
      if ((bitField0_ & 0x00000004) != 0) {
        for (int i = 0; i < effectedGrids.length(); i++) {
          output.writeRawByte((byte) 18);
          output.writeMessageNoTag(effectedGrids.get(i));
        }
      }
    }

    @Override
    protected int computeSerializedSize() {
      int size = 0;
      if ((bitField0_ & 0x00000001) != 0) {
        size += 1 + ProtoSink.computeInt32SizeNoTag(effectType);
      }
      if ((bitField0_ & 0x00000002) != 0) {
        size += 2 + ProtoSink.computeBytesSizeNoTag(nextPackage);
      }
      if ((bitField0_ & 0x00000004) != 0) {
        size += (1 * effectedGrids.length()) + ProtoSink.computeRepeatedMessageSizeNoTag(effectedGrids);
      }
      return size;
    }

    @Override
    @SuppressWarnings("fallthrough")
    public MiningProcess mergeFrom(final ProtoSource input) throws IOException {
      // Enabled Fall-Through Optimization (QuickBuffers)
      int tag = input.readTag();
      while (true) {
        switch (tag) {
          case 8: {
            // effectType
            effectType = input.readInt32();
            bitField0_ |= 0x00000001;
            tag = input.readTag();
            if (tag != 16378) {
              break;
            }
          }
          case 16378: {
            // nextPackage
            input.readBytes(nextPackage);
            bitField0_ |= 0x00000002;
            tag = input.readTag();
            if (tag != 18) {
              break;
            }
          }
          case 18: {
            // effectedGrids
            tag = input.readRepeatedMessage(effectedGrids, tag);
            bitField0_ |= 0x00000004;
            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.writeInt32(FieldNames.effectType, effectType);
      }
      if ((bitField0_ & 0x00000002) != 0) {
        output.writeBytes(FieldNames.nextPackage, nextPackage);
      }
      if ((bitField0_ & 0x00000004) != 0) {
        output.writeRepeatedMessage(FieldNames.effectedGrids, effectedGrids);
      }
      output.endObject();
    }

    @Override
    public MiningProcess mergeFrom(final JsonSource input) throws IOException {
      if (!input.beginObject()) {
        return this;
      }
      while (!input.isAtEnd()) {
        switch (input.readFieldHash()) {
          case -585668469: {
            if (input.isAtField(FieldNames.effectType)) {
              if (!input.trySkipNullValue()) {
                effectType = input.readInt32();
                bitField0_ |= 0x00000001;
              }
            } else {
              input.skipUnknownField();
            }
            break;
          }
          case -2082324045: {
            if (input.isAtField(FieldNames.nextPackage)) {
              if (!input.trySkipNullValue()) {
                input.readBytes(nextPackage);
                bitField0_ |= 0x00000002;
              }
            } else {
              input.skipUnknownField();
            }
            break;
          }
          case 71871933: {
            if (input.isAtField(FieldNames.effectedGrids)) {
              if (!input.trySkipNullValue()) {
                input.readRepeatedMessage(effectedGrids);
                bitField0_ |= 0x00000004;
              }
            } else {
              input.skipUnknownField();
            }
            break;
          }
          default: {
            input.skipUnknownField();
            break;
          }
        }
      }
      input.endObject();
      return this;
    }

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

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

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

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

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

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

    private enum MiningProcessFactory implements MessageFactory<MiningProcess> {
      INSTANCE;

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

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

      static final FieldName nextPackage = FieldName.forField("NextPackage");

      static final FieldName effectedGrids = FieldName.forField("EffectedGrids");
    }
  }

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

    /**
     * <code>optional uint32 Score = 1;</code>
     */
    private int score;

    /**
     * <code>optional bytes NextPackage = 2047;</code>
     */
    private final RepeatedByte nextPackage = RepeatedByte.newEmptyInstance();

    /**
     * <code>repeated uint32 ReceivedTreasures = 3;</code>
     */
    private final RepeatedInt receivedTreasures = RepeatedInt.newEmptyInstance();

    /**
     * <code>repeated .MiningProcess Processes = 2;</code>
     */
    private final RepeatedMessage<MiningProcess> processes = RepeatedMessage.newEmptyInstance(MiningProcess.getFactory());

    private MiningChangeInfo() {
    }

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

    /**
     * <code>optional uint32 Score = 1;</code>
     * @return whether the score field is set
     */
    public boolean hasScore() {
      return (bitField0_ & 0x00000001) != 0;
    }

    /**
     * <code>optional uint32 Score = 1;</code>
     * @return this
     */
    public MiningChangeInfo clearScore() {
      bitField0_ &= ~0x00000001;
      score = 0;
      return this;
    }

    /**
     * <code>optional uint32 Score = 1;</code>
     * @return the score
     */
    public int getScore() {
      return score;
    }

    /**
     * <code>optional uint32 Score = 1;</code>
     * @param value the score to set
     * @return this
     */
    public MiningChangeInfo setScore(final int value) {
      bitField0_ |= 0x00000001;
      score = value;
      return this;
    }

    /**
     * <code>optional bytes NextPackage = 2047;</code>
     * @return whether the nextPackage field is set
     */
    public boolean hasNextPackage() {
      return (bitField0_ & 0x00000002) != 0;
    }

    /**
     * <code>optional bytes NextPackage = 2047;</code>
     * @return this
     */
    public MiningChangeInfo clearNextPackage() {
      bitField0_ &= ~0x00000002;
      nextPackage.clear();
      return this;
    }

    /**
     * <code>optional bytes NextPackage = 2047;</code>
     *
     * This method returns the internal storage object without modifying any has state.
     * The returned object should not be modified and be treated as read-only.
     *
     * Use {@link #getMutableNextPackage()} if you want to modify it.
     *
     * @return internal storage object for reading
     */
    public RepeatedByte getNextPackage() {
      return nextPackage;
    }

    /**
     * <code>optional bytes NextPackage = 2047;</code>
     *
     * This method returns the internal storage object and sets the corresponding
     * has state. The returned object will become part of this message and its
     * contents may be modified as long as the has state is not cleared.
     *
     * @return internal storage object for modifications
     */
    public RepeatedByte getMutableNextPackage() {
      bitField0_ |= 0x00000002;
      return nextPackage;
    }

    /**
     * <code>optional bytes NextPackage = 2047;</code>
     * @param value the nextPackage to add
     * @return this
     */
    public MiningChangeInfo addNextPackage(final byte value) {
      bitField0_ |= 0x00000002;
      nextPackage.add(value);
      return this;
    }

    /**
     * <code>optional bytes NextPackage = 2047;</code>
     * @param values the nextPackage to add
     * @return this
     */
    public MiningChangeInfo addAllNextPackage(final byte... values) {
      bitField0_ |= 0x00000002;
      nextPackage.addAll(values);
      return this;
    }

    /**
     * <code>optional bytes NextPackage = 2047;</code>
     * @param values the nextPackage to set
     * @return this
     */
    public MiningChangeInfo setNextPackage(final byte... values) {
      bitField0_ |= 0x00000002;
      nextPackage.copyFrom(values);
      return this;
    }

    /**
     * <code>repeated uint32 ReceivedTreasures = 3;</code>
     * @return whether the receivedTreasures field is set
     */
    public boolean hasReceivedTreasures() {
      return (bitField0_ & 0x00000004) != 0;
    }

    /**
     * <code>repeated uint32 ReceivedTreasures = 3;</code>
     * @return this
     */
    public MiningChangeInfo clearReceivedTreasures() {
      bitField0_ &= ~0x00000004;
      receivedTreasures.clear();
      return this;
    }

    /**
     * <code>repeated uint32 ReceivedTreasures = 3;</code>
     *
     * This method returns the internal storage object without modifying any has state.
     * The returned object should not be modified and be treated as read-only.
     *
     * Use {@link #getMutableReceivedTreasures()} if you want to modify it.
     *
     * @return internal storage object for reading
     */
    public RepeatedInt getReceivedTreasures() {
      return receivedTreasures;
    }

    /**
     * <code>repeated uint32 ReceivedTreasures = 3;</code>
     *
     * This method returns the internal storage object and sets the corresponding
     * has state. The returned object will become part of this message and its
     * contents may be modified as long as the has state is not cleared.
     *
     * @return internal storage object for modifications
     */
    public RepeatedInt getMutableReceivedTreasures() {
      bitField0_ |= 0x00000004;
      return receivedTreasures;
    }

    /**
     * <code>repeated uint32 ReceivedTreasures = 3;</code>
     * @param value the receivedTreasures to add
     * @return this
     */
    public MiningChangeInfo addReceivedTreasures(final int value) {
      bitField0_ |= 0x00000004;
      receivedTreasures.add(value);
      return this;
    }

    /**
     * <code>repeated uint32 ReceivedTreasures = 3;</code>
     * @param values the receivedTreasures to add
     * @return this
     */
    public MiningChangeInfo addAllReceivedTreasures(final int... values) {
      bitField0_ |= 0x00000004;
      receivedTreasures.addAll(values);
      return this;
    }

    /**
     * <code>repeated .MiningProcess Processes = 2;</code>
     * @return whether the processes field is set
     */
    public boolean hasProcesses() {
      return (bitField0_ & 0x00000008) != 0;
    }

    /**
     * <code>repeated .MiningProcess Processes = 2;</code>
     * @return this
     */
    public MiningChangeInfo clearProcesses() {
      bitField0_ &= ~0x00000008;
      processes.clear();
      return this;
    }

    /**
     * <code>repeated .MiningProcess Processes = 2;</code>
     *
     * This method returns the internal storage object without modifying any has state.
     * The returned object should not be modified and be treated as read-only.
     *
     * Use {@link #getMutableProcesses()} if you want to modify it.
     *
     * @return internal storage object for reading
     */
    public RepeatedMessage<MiningProcess> getProcesses() {
      return processes;
    }

    /**
     * <code>repeated .MiningProcess Processes = 2;</code>
     *
     * This method returns the internal storage object and sets the corresponding
     * has state. The returned object will become part of this message and its
     * contents may be modified as long as the has state is not cleared.
     *
     * @return internal storage object for modifications
     */
    public RepeatedMessage<MiningProcess> getMutableProcesses() {
      bitField0_ |= 0x00000008;
      return processes;
    }

    /**
     * <code>repeated .MiningProcess Processes = 2;</code>
     * @param value the processes to add
     * @return this
     */
    public MiningChangeInfo addProcesses(final MiningProcess value) {
      bitField0_ |= 0x00000008;
      processes.add(value);
      return this;
    }

    /**
     * <code>repeated .MiningProcess Processes = 2;</code>
     * @param values the processes to add
     * @return this
     */
    public MiningChangeInfo addAllProcesses(final MiningProcess... values) {
      bitField0_ |= 0x00000008;
      processes.addAll(values);
      return this;
    }

    @Override
    public MiningChangeInfo copyFrom(final MiningChangeInfo other) {
      cachedSize = other.cachedSize;
      if ((bitField0_ | other.bitField0_) != 0) {
        bitField0_ = other.bitField0_;
        score = other.score;
        nextPackage.copyFrom(other.nextPackage);
        receivedTreasures.copyFrom(other.receivedTreasures);
        processes.copyFrom(other.processes);
      }
      return this;
    }

    @Override
    public MiningChangeInfo mergeFrom(final MiningChangeInfo other) {
      if (other.isEmpty()) {
        return this;
      }
      cachedSize = -1;
      if (other.hasScore()) {
        setScore(other.score);
      }
      if (other.hasNextPackage()) {
        getMutableNextPackage().copyFrom(other.nextPackage);
      }
      if (other.hasReceivedTreasures()) {
        getMutableReceivedTreasures().addAll(other.receivedTreasures);
      }
      if (other.hasProcesses()) {
        getMutableProcesses().addAll(other.processes);
      }
      return this;
    }

    @Override
    public MiningChangeInfo clear() {
      if (isEmpty()) {
        return this;
      }
      cachedSize = -1;
      bitField0_ = 0;
      score = 0;
      nextPackage.clear();
      receivedTreasures.clear();
      processes.clear();
      return this;
    }

    @Override
    public MiningChangeInfo clearQuick() {
      if (isEmpty()) {
        return this;
      }
      cachedSize = -1;
      bitField0_ = 0;
      nextPackage.clear();
      receivedTreasures.clear();
      processes.clearQuick();
      return this;
    }

    @Override
    public boolean equals(Object o) {
      if (o == this) {
        return true;
      }
      if (!(o instanceof MiningChangeInfo)) {
        return false;
      }
      MiningChangeInfo other = (MiningChangeInfo) o;
      return bitField0_ == other.bitField0_
        && (!hasScore() || score == other.score)
        && (!hasNextPackage() || nextPackage.equals(other.nextPackage))
        && (!hasReceivedTreasures() || receivedTreasures.equals(other.receivedTreasures))
        && (!hasProcesses() || processes.equals(other.processes));
    }

    @Override
    public void writeTo(final ProtoSink output) throws IOException {
      if ((bitField0_ & 0x00000001) != 0) {
        output.writeRawByte((byte) 8);
        output.writeUInt32NoTag(score);
      }
      if ((bitField0_ & 0x00000002) != 0) {
        output.writeRawLittleEndian16((short) 32762);
        output.writeBytesNoTag(nextPackage);
      }
      if ((bitField0_ & 0x00000004) != 0) {
        for (int i = 0; i < receivedTreasures.length(); i++) {
          output.writeRawByte((byte) 24);
          output.writeUInt32NoTag(receivedTreasures.array()[i]);
        }
      }
      if ((bitField0_ & 0x00000008) != 0) {
        for (int i = 0; i < processes.length(); i++) {
          output.writeRawByte((byte) 18);
          output.writeMessageNoTag(processes.get(i));
        }
      }
    }

    @Override
    protected int computeSerializedSize() {
      int size = 0;
      if ((bitField0_ & 0x00000001) != 0) {
        size += 1 + ProtoSink.computeUInt32SizeNoTag(score);
      }
      if ((bitField0_ & 0x00000002) != 0) {
        size += 2 + ProtoSink.computeBytesSizeNoTag(nextPackage);
      }
      if ((bitField0_ & 0x00000004) != 0) {
        size += (1 * receivedTreasures.length()) + ProtoSink.computeRepeatedUInt32SizeNoTag(receivedTreasures);
      }
      if ((bitField0_ & 0x00000008) != 0) {
        size += (1 * processes.length()) + ProtoSink.computeRepeatedMessageSizeNoTag(processes);
      }
      return size;
    }

    @Override
    @SuppressWarnings("fallthrough")
    public MiningChangeInfo mergeFrom(final ProtoSource input) throws IOException {
      // Enabled Fall-Through Optimization (QuickBuffers)
      int tag = input.readTag();
      while (true) {
        switch (tag) {
          case 8: {
            // score
            score = input.readUInt32();
            bitField0_ |= 0x00000001;
            tag = input.readTag();
            if (tag != 16378) {
              break;
            }
          }
          case 16378: {
            // nextPackage
            input.readBytes(nextPackage);
            bitField0_ |= 0x00000002;
            tag = input.readTag();
            if (tag != 26) {
              break;
            }
          }
          case 26: {
            // receivedTreasures [packed=true]
            input.readPackedUInt32(receivedTreasures, tag);
            bitField0_ |= 0x00000004;
            tag = input.readTag();
            if (tag != 18) {
              break;
            }
          }
          case 18: {
            // processes
            tag = input.readRepeatedMessage(processes, tag);
            bitField0_ |= 0x00000008;
            if (tag != 0) {
              break;
            }
          }
          case 0: {
            return this;
          }
          default: {
            if (!input.skipField(tag)) {
              return this;
            }
            tag = input.readTag();
            break;
          }
          case 24: {
            // receivedTreasures [packed=false]
            tag = input.readRepeatedUInt32(receivedTreasures, tag);
            bitField0_ |= 0x00000004;
            break;
          }
        }
      }
    }

    @Override
    public void writeTo(final JsonSink output) throws IOException {
      output.beginObject();
      if ((bitField0_ & 0x00000001) != 0) {
        output.writeUInt32(FieldNames.score, score);
      }
      if ((bitField0_ & 0x00000002) != 0) {
        output.writeBytes(FieldNames.nextPackage, nextPackage);
      }
      if ((bitField0_ & 0x00000004) != 0) {
        output.writeRepeatedUInt32(FieldNames.receivedTreasures, receivedTreasures);
      }
      if ((bitField0_ & 0x00000008) != 0) {
        output.writeRepeatedMessage(FieldNames.processes, processes);
      }
      output.endObject();
    }

    @Override
    public MiningChangeInfo mergeFrom(final JsonSource input) throws IOException {
      if (!input.beginObject()) {
        return this;
      }
      while (!input.isAtEnd()) {
        switch (input.readFieldHash()) {
          case 79711858: {
            if (input.isAtField(FieldNames.score)) {
              if (!input.trySkipNullValue()) {
                score = input.readUInt32();
                bitField0_ |= 0x00000001;
              }
            } else {
              input.skipUnknownField();
            }
            break;
          }
          case -2082324045: {
            if (input.isAtField(FieldNames.nextPackage)) {
              if (!input.trySkipNullValue()) {
                input.readBytes(nextPackage);
                bitField0_ |= 0x00000002;
              }
            } else {
              input.skipUnknownField();
            }
            break;
          }
          case -1350814045: {
            if (input.isAtField(FieldNames.receivedTreasures)) {
              if (!input.trySkipNullValue()) {
                input.readRepeatedUInt32(receivedTreasures);
                bitField0_ |= 0x00000004;
              }
            } else {
              input.skipUnknownField();
            }
            break;
          }
          case 909208381: {
            if (input.isAtField(FieldNames.processes)) {
              if (!input.trySkipNullValue()) {
                input.readRepeatedMessage(processes);
                bitField0_ |= 0x00000008;
              }
            } else {
              input.skipUnknownField();
            }
            break;
          }
          default: {
            input.skipUnknownField();
            break;
          }
        }
      }
      input.endObject();
      return this;
    }

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

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

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

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

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

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

    private enum MiningChangeInfoFactory implements MessageFactory<MiningChangeInfo> {
      INSTANCE;

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

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

      static final FieldName nextPackage = FieldName.forField("NextPackage");

      static final FieldName receivedTreasures = FieldName.forField("ReceivedTreasures");

      static final FieldName processes = FieldName.forField("Processes");
    }
  }
}
