BiomeData.java
package com.hypixel.hytale.protocol.packets.worldmap;
import com.hypixel.hytale.protocol.io.PacketIO;
import com.hypixel.hytale.protocol.io.ProtocolException;
import com.hypixel.hytale.protocol.io.ValidationResult;
import com.hypixel.hytale.protocol.io.VarInt;
import io.netty.buffer.ByteBuf;
import java.util.Objects;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
public class BiomeData {
public static final int NULLABLE_BIT_FIELD_SIZE = 1;
public static final int FIXED_BLOCK_SIZE = 9;
public static final int VARIABLE_FIELD_COUNT = 2;
public static final int VARIABLE_BLOCK_START = 17;
public static final ;
zoneId;
String zoneName;
String biomeName;
biomeColor;
{
}
{
.zoneId = zoneId;
.zoneName = zoneName;
.biomeName = biomeName;
.biomeColor = biomeColor;
}
{
.zoneId = other.zoneId;
.zoneName = other.zoneName;
.biomeName = other.biomeName;
.biomeColor = other.biomeColor;
}
BiomeData {
();
buf.getByte(offset);
obj.zoneId = buf.getIntLE(offset + );
obj.biomeColor = buf.getIntLE(offset + );
((nullBits & ) != ) {
offset + + buf.getIntLE(offset + );
VarInt.peek(buf, varPos0);
(zoneNameLen < ) {
ProtocolException.negativeLength(, zoneNameLen);
}
(zoneNameLen > ) {
ProtocolException.stringTooLong(, zoneNameLen, );
}
obj.zoneName = PacketIO.readVarString(buf, varPos0, PacketIO.UTF8);
}
((nullBits & ) != ) {
offset + + buf.getIntLE(offset + );
VarInt.peek(buf, varPos1);
(biomeNameLen < ) {
ProtocolException.negativeLength(, biomeNameLen);
}
(biomeNameLen > ) {
ProtocolException.stringTooLong(, biomeNameLen, );
}
obj.biomeName = PacketIO.readVarString(buf, varPos1, PacketIO.UTF8);
}
obj;
}
{
buf.getByte(offset);
;
((nullBits & ) != ) {
buf.getIntLE(offset + );
offset + + fieldOffset0;
VarInt.peek(buf, pos0);
pos0 += VarInt.length(buf, pos0) + sl;
(pos0 - offset > maxEnd) {
maxEnd = pos0 - offset;
}
}
((nullBits & ) != ) {
buf.getIntLE(offset + );
offset + + fieldOffset1;
VarInt.peek(buf, pos1);
pos1 += VarInt.length(buf, pos1) + sl;
(pos1 - offset > maxEnd) {
maxEnd = pos1 - offset;
}
}
maxEnd;
}
{
buf.writerIndex();
;
(.zoneName != ) {
nullBits = ()(nullBits | );
}
(.biomeName != ) {
nullBits = ()(nullBits | );
}
buf.writeByte(nullBits);
buf.writeIntLE(.zoneId);
buf.writeIntLE(.biomeColor);
buf.writerIndex();
buf.writeIntLE();
buf.writerIndex();
buf.writeIntLE();
buf.writerIndex();
(.zoneName != ) {
buf.setIntLE(zoneNameOffsetSlot, buf.writerIndex() - varBlockStart);
PacketIO.writeVarString(buf, .zoneName, );
} {
buf.setIntLE(zoneNameOffsetSlot, -);
}
(.biomeName != ) {
buf.setIntLE(biomeNameOffsetSlot, buf.writerIndex() - varBlockStart);
PacketIO.writeVarString(buf, .biomeName, );
} {
buf.setIntLE(biomeNameOffsetSlot, -);
}
}
{
;
(.zoneName != ) {
size += PacketIO.stringSize(.zoneName);
}
(.biomeName != ) {
size += PacketIO.stringSize(.biomeName);
}
size;
}
ValidationResult {
(buffer.readableBytes() - offset < ) {
ValidationResult.error();
} {
buffer.getByte(offset);
((nullBits & ) != ) {
buffer.getIntLE(offset + );
(zoneNameOffset < ) {
ValidationResult.error();
}
offset + + zoneNameOffset;
(pos >= buffer.writerIndex()) {
ValidationResult.error();
}
VarInt.peek(buffer, pos);
(zoneNameLen < ) {
ValidationResult.error();
}
(zoneNameLen > ) {
ValidationResult.error();
}
pos += VarInt.length(buffer, pos);
pos += zoneNameLen;
(pos > buffer.writerIndex()) {
ValidationResult.error();
}
}
((nullBits & ) != ) {
buffer.getIntLE(offset + );
(biomeNameOffset < ) {
ValidationResult.error();
}
offset + + biomeNameOffset;
(pos >= buffer.writerIndex()) {
ValidationResult.error();
}
VarInt.peek(buffer, pos);
(biomeNameLen < ) {
ValidationResult.error();
}
(biomeNameLen > ) {
ValidationResult.error();
}
pos += VarInt.length(buffer, pos);
pos += biomeNameLen;
(pos > buffer.writerIndex()) {
ValidationResult.error();
}
}
ValidationResult.OK;
}
}
BiomeData {
();
copy.zoneId = .zoneId;
copy.zoneName = .zoneName;
copy.biomeName = .biomeName;
copy.biomeColor = .biomeColor;
copy;
}
{
( == obj) {
;
} (!(obj BiomeData)) {
;
} {
(BiomeData)obj;
.zoneId == other.zoneId && Objects.equals(.zoneName, other.zoneName) && Objects.equals(.biomeName, other.biomeName) && .biomeColor == other.biomeColor;
}
}
{
Objects.hash( []{.zoneId, .zoneName, .biomeName, .biomeColor});
}
}