PortalDef.java
package com.hypixel.hytale.protocol.packets.interface_;
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 PortalDef {
public static final int NULLABLE_BIT_FIELD_SIZE = 1;
public static final int FIXED_BLOCK_SIZE = 9;
public static final int VARIABLE_FIELD_COUNT = 1;
public static final int VARIABLE_BLOCK_START = 9;
public static final ;
String nameKey;
explorationSeconds;
breachSeconds;
{
}
{
.nameKey = nameKey;
.explorationSeconds = explorationSeconds;
.breachSeconds = breachSeconds;
}
{
.nameKey = other.nameKey;
.explorationSeconds = other.explorationSeconds;
.breachSeconds = other.breachSeconds;
}
PortalDef {
();
buf.getByte(offset);
obj.explorationSeconds = buf.getIntLE(offset + );
obj.breachSeconds = buf.getIntLE(offset + );
offset + ;
((nullBits & ) != ) {
VarInt.peek(buf, pos);
(nameKeyLen < ) {
ProtocolException.negativeLength(, nameKeyLen);
}
(nameKeyLen > ) {
ProtocolException.stringTooLong(, nameKeyLen, );
}
VarInt.length(buf, pos);
obj.nameKey = PacketIO.readVarString(buf, pos, PacketIO.UTF8);
pos + nameKeyVarLen + nameKeyLen;
}
obj;
}
{
buf.getByte(offset);
offset + ;
((nullBits & ) != ) {
VarInt.peek(buf, pos);
pos += VarInt.length(buf, pos) + sl;
}
pos - offset;
}
{
;
(.nameKey != ) {
nullBits = ()(nullBits | );
}
buf.writeByte(nullBits);
buf.writeIntLE(.explorationSeconds);
buf.writeIntLE(.breachSeconds);
(.nameKey != ) {
PacketIO.writeVarString(buf, .nameKey, );
}
}
{
;
(.nameKey != ) {
size += PacketIO.stringSize(.nameKey);
}
size;
}
ValidationResult {
(buffer.readableBytes() - offset < ) {
ValidationResult.error();
} {
buffer.getByte(offset);
offset + ;
((nullBits & ) != ) {
VarInt.peek(buffer, pos);
(nameKeyLen < ) {
ValidationResult.error();
}
(nameKeyLen > ) {
ValidationResult.error();
}
pos += VarInt.length(buffer, pos);
pos += nameKeyLen;
(pos > buffer.writerIndex()) {
ValidationResult.error();
}
}
ValidationResult.OK;
}
}
PortalDef {
();
copy.nameKey = .nameKey;
copy.explorationSeconds = .explorationSeconds;
copy.breachSeconds = .breachSeconds;
copy;
}
{
( == obj) {
;
} (!(obj PortalDef)) {
;
} {
(PortalDef)obj;
Objects.equals(.nameKey, other.nameKey) && .explorationSeconds == other.explorationSeconds && .breachSeconds == other.breachSeconds;
}
}
{
Objects.hash( []{.nameKey, .explorationSeconds, .breachSeconds});
}
}