SyncInteractionChains.java
package com.hypixel.hytale.protocol.packets.interaction;
import com.hypixel.hytale.protocol.Packet;
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.Arrays;
import javax.annotation.Nonnull;
public class SyncInteractionChains implements Packet {
public static final int PACKET_ID = 290;
public static final boolean IS_COMPRESSED = false;
public static final int NULLABLE_BIT_FIELD_SIZE = 0;
public static final int FIXED_BLOCK_SIZE = 0;
public static ;
;
;
SyncInteractionChain[] updates = [];
{
;
}
{
}
{
.updates = updates;
}
{
.updates = other.updates;
}
SyncInteractionChains {
();
offset + ;
VarInt.peek(buf, pos);
(updatesCount < ) {
ProtocolException.negativeLength(, updatesCount);
} (updatesCount > ) {
ProtocolException.arrayTooLong(, updatesCount, );
} {
VarInt.size(updatesCount);
(()(pos + updatesVarLen) + ()updatesCount * > ()buf.readableBytes()) {
ProtocolException.bufferTooSmall(, pos + updatesVarLen + updatesCount * , buf.readableBytes());
} {
pos += updatesVarLen;
obj.updates = [updatesCount];
( ; i < updatesCount; ++i) {
obj.updates[i] = SyncInteractionChain.deserialize(buf, pos);
pos += SyncInteractionChain.computeBytesConsumed(buf, pos);
}
obj;
}
}
}
{
offset + ;
VarInt.peek(buf, pos);
pos += VarInt.length(buf, pos);
( ; i < arrLen; ++i) {
pos += SyncInteractionChain.computeBytesConsumed(buf, pos);
}
pos - offset;
}
{
(.updates.length > ) {
ProtocolException.arrayTooLong(, .updates.length, );
} {
VarInt.write(buf, .updates.length);
(SyncInteractionChain item : .updates) {
item.serialize(buf);
}
}
}
{
;
;
(SyncInteractionChain elem : .updates) {
updatesSize += elem.computeSize();
}
size += VarInt.size(.updates.length) + updatesSize;
size;
}
ValidationResult {
(buffer.readableBytes() - offset < ) {
ValidationResult.error();
} {
offset + ;
VarInt.peek(buffer, pos);
(updatesCount < ) {
ValidationResult.error();
} (updatesCount > ) {
ValidationResult.error();
} {
pos += VarInt.length(buffer, pos);
( ; i < updatesCount; ++i) {
SyncInteractionChain.validateStructure(buffer, pos);
(!structResult.isValid()) {
ValidationResult.error( + i + + structResult.error());
}
pos += SyncInteractionChain.computeBytesConsumed(buffer, pos);
}
ValidationResult.OK;
}
}
}
SyncInteractionChains {
();
copy.updates = (SyncInteractionChain[])Arrays.stream(.updates).map((e) -> e.clone()).toArray((x$) -> [x$]);
copy;
}
{
( == obj) {
;
} (obj SyncInteractionChains) {
(SyncInteractionChains)obj;
Arrays.equals(.updates, other.updates);
} {
;
}
}
{
;
result = * result + Arrays.hashCode(.updates);
result;
}
}