MemoriesConditionInteraction.java
package com.hypixel.hytale.protocol;
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 java.util.HashMap;
import java.util.Map;
import java.util.Objects;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
public class MemoriesConditionInteraction extends Interaction {
public static final int NULLABLE_BIT_FIELD_SIZE = 1;
public static final int FIXED_BLOCK_SIZE = 15;
public static final int VARIABLE_FIELD_COUNT = 6;
public static final int VARIABLE_BLOCK_START ;
;
Map<Integer, Integer> memoriesNext;
-;
{
}
{
.waitForDataFrom = waitForDataFrom;
.effects = effects;
.horizontalSpeedMultiplier = horizontalSpeedMultiplier;
.runTime = runTime;
.cancelOnItemChange = cancelOnItemChange;
.settings = settings;
.rules = rules;
.tags = tags;
.camera = camera;
.memoriesNext = memoriesNext;
.failed = failed;
}
{
.waitForDataFrom = other.waitForDataFrom;
.effects = other.effects;
.horizontalSpeedMultiplier = other.horizontalSpeedMultiplier;
.runTime = other.runTime;
.cancelOnItemChange = other.cancelOnItemChange;
.settings = other.settings;
.rules = other.rules;
.tags = other.tags;
.camera = other.camera;
.memoriesNext = other.memoriesNext;
.failed = other.failed;
}
MemoriesConditionInteraction {
();
buf.getByte(offset);
obj.waitForDataFrom = WaitForDataFrom.fromValue(buf.getByte(offset + ));
obj.horizontalSpeedMultiplier = buf.getFloatLE(offset + );
obj.runTime = buf.getFloatLE(offset + );
obj.cancelOnItemChange = buf.getByte(offset + ) != ;
obj.failed = buf.getIntLE(offset + );
((nullBits & ) != ) {
offset + + buf.getIntLE(offset + );
obj.effects = InteractionEffects.deserialize(buf, varPos0);
}
((nullBits & ) != ) {
offset + + buf.getIntLE(offset + );
VarInt.peek(buf, varPos1);
(settingsCount < ) {
ProtocolException.negativeLength(, settingsCount);
}
(settingsCount > ) {
ProtocolException.dictionaryTooLarge(, settingsCount, );
}
VarInt.length(buf, varPos1);
obj.settings = (settingsCount);
varPos1 + varIntLen;
( ; i < settingsCount; ++i) {
GameMode.fromValue(buf.getByte(dictPos));
++dictPos;
InteractionSettings.deserialize(buf, dictPos);
dictPos += InteractionSettings.computeBytesConsumed(buf, dictPos);
(obj.settings.put(key, val) != ) {
ProtocolException.duplicateKey(, key);
}
}
}
((nullBits & ) != ) {
offset + + buf.getIntLE(offset + );
obj.rules = InteractionRules.deserialize(buf, varPos2);
}
((nullBits & ) != ) {
offset + + buf.getIntLE(offset + );
VarInt.peek(buf, varPos3);
(tagsCount < ) {
ProtocolException.negativeLength(, tagsCount);
}
(tagsCount > ) {
ProtocolException.arrayTooLong(, tagsCount, );
}
VarInt.length(buf, varPos3);
(()(varPos3 + varIntLen) + ()tagsCount * > ()buf.readableBytes()) {
ProtocolException.bufferTooSmall(, varPos3 + varIntLen + tagsCount * , buf.readableBytes());
}
obj.tags = [tagsCount];
( ; i < tagsCount; ++i) {
obj.tags[i] = buf.getIntLE(varPos3 + varIntLen + i * );
}
}
((nullBits & ) != ) {
offset + + buf.getIntLE(offset + );
obj.camera = InteractionCameraSettings.deserialize(buf, varPos4);
}
((nullBits & ) != ) {
offset + + buf.getIntLE(offset + );
VarInt.peek(buf, varPos5);
(memoriesNextCount < ) {
ProtocolException.negativeLength(, memoriesNextCount);
}
(memoriesNextCount > ) {
ProtocolException.dictionaryTooLarge(, memoriesNextCount, );
}
VarInt.length(buf, varPos5);
obj.memoriesNext = (memoriesNextCount);
varPos5 + varIntLen;
( ; i < memoriesNextCount; ++i) {
buf.getIntLE(dictPos);
dictPos += ;
buf.getIntLE(dictPos);
dictPos += ;
(obj.memoriesNext.put(key, val) != ) {
ProtocolException.duplicateKey(, key);
}
}
}
obj;
}
{
buf.getByte(offset);
;
((nullBits & ) != ) {
buf.getIntLE(offset + );
offset + + fieldOffset0;
pos0 += InteractionEffects.computeBytesConsumed(buf, pos0);
(pos0 - offset > maxEnd) {
maxEnd = pos0 - offset;
}
}
((nullBits & ) != ) {
buf.getIntLE(offset + );
offset + + fieldOffset1;
VarInt.peek(buf, pos1);
pos1 += VarInt.length(buf, pos1);
( ; i < dictLen; ++i) {
++pos1;
pos1 += InteractionSettings.computeBytesConsumed(buf, pos1);
}
(pos1 - offset > maxEnd) {
maxEnd = pos1 - offset;
}
}
((nullBits & ) != ) {
buf.getIntLE(offset + );
offset + + fieldOffset2;
pos2 += InteractionRules.computeBytesConsumed(buf, pos2);
(pos2 - offset > maxEnd) {
maxEnd = pos2 - offset;
}
}
((nullBits & ) != ) {
buf.getIntLE(offset + );
offset + + fieldOffset3;
VarInt.peek(buf, pos3);
pos3 += VarInt.length(buf, pos3) + arrLen * ;
(pos3 - offset > maxEnd) {
maxEnd = pos3 - offset;
}
}
((nullBits & ) != ) {
buf.getIntLE(offset + );
offset + + fieldOffset4;
pos4 += InteractionCameraSettings.computeBytesConsumed(buf, pos4);
(pos4 - offset > maxEnd) {
maxEnd = pos4 - offset;
}
}
((nullBits & ) != ) {
buf.getIntLE(offset + );
offset + + fieldOffset5;
VarInt.peek(buf, pos5);
pos5 += VarInt.length(buf, pos5);
( ; i < dictLen; ++i) {
pos5 += ;
pos5 += ;
}
(pos5 - offset > maxEnd) {
maxEnd = pos5 - offset;
}
}
maxEnd;
}
{
buf.writerIndex();
;
(.effects != ) {
nullBits = ()(nullBits | );
}
(.settings != ) {
nullBits = ()(nullBits | );
}
(.rules != ) {
nullBits = ()(nullBits | );
}
(.tags != ) {
nullBits = ()(nullBits | );
}
(.camera != ) {
nullBits = ()(nullBits | );
}
(.memoriesNext != ) {
nullBits = ()(nullBits | );
}
buf.writeByte(nullBits);
buf.writeByte(.waitForDataFrom.getValue());
buf.writeFloatLE(.horizontalSpeedMultiplier);
buf.writeFloatLE(.runTime);
buf.writeByte(.cancelOnItemChange ? : );
buf.writeIntLE(.failed);
buf.writerIndex();
buf.writeIntLE();
buf.writerIndex();
buf.writeIntLE();
buf.writerIndex();
buf.writeIntLE();
buf.writerIndex();
buf.writeIntLE();
buf.writerIndex();
buf.writeIntLE();
buf.writerIndex();
buf.writeIntLE();
buf.writerIndex();
(.effects != ) {
buf.setIntLE(effectsOffsetSlot, buf.writerIndex() - varBlockStart);
.effects.serialize(buf);
} {
buf.setIntLE(effectsOffsetSlot, -);
}
(.settings != ) {
buf.setIntLE(settingsOffsetSlot, buf.writerIndex() - varBlockStart);
(.settings.size() > ) {
ProtocolException.dictionaryTooLarge(, .settings.size(), );
}
VarInt.write(buf, .settings.size());
(Map.Entry<GameMode, InteractionSettings> e : .settings.entrySet()) {
buf.writeByte(((GameMode)e.getKey()).getValue());
((InteractionSettings)e.getValue()).serialize(buf);
}
} {
buf.setIntLE(settingsOffsetSlot, -);
}
(.rules != ) {
buf.setIntLE(rulesOffsetSlot, buf.writerIndex() - varBlockStart);
.rules.serialize(buf);
} {
buf.setIntLE(rulesOffsetSlot, -);
}
(.tags != ) {
buf.setIntLE(tagsOffsetSlot, buf.writerIndex() - varBlockStart);
(.tags.length > ) {
ProtocolException.arrayTooLong(, .tags.length, );
}
VarInt.write(buf, .tags.length);
( item : .tags) {
buf.writeIntLE(item);
}
} {
buf.setIntLE(tagsOffsetSlot, -);
}
(.camera != ) {
buf.setIntLE(cameraOffsetSlot, buf.writerIndex() - varBlockStart);
.camera.serialize(buf);
} {
buf.setIntLE(cameraOffsetSlot, -);
}
(.memoriesNext != ) {
buf.setIntLE(memoriesNextOffsetSlot, buf.writerIndex() - varBlockStart);
(.memoriesNext.size() > ) {
ProtocolException.dictionaryTooLarge(, .memoriesNext.size(), );
}
VarInt.write(buf, .memoriesNext.size());
(Map.Entry<Integer, Integer> e : .memoriesNext.entrySet()) {
buf.writeIntLE((Integer)e.getKey());
buf.writeIntLE((Integer)e.getValue());
}
} {
buf.setIntLE(memoriesNextOffsetSlot, -);
}
buf.writerIndex() - startPos;
}
{
;
(.effects != ) {
size += .effects.computeSize();
}
(.settings != ) {
size += VarInt.size(.settings.size()) + .settings.size() * ;
}
(.rules != ) {
size += .rules.computeSize();
}
(.tags != ) {
size += VarInt.size(.tags.length) + .tags.length * ;
}
(.camera != ) {
size += .camera.computeSize();
}
(.memoriesNext != ) {
size += VarInt.size(.memoriesNext.size()) + .memoriesNext.size() * ;
}
size;
}
ValidationResult {
(buffer.readableBytes() - offset < ) {
ValidationResult.error();
} {
buffer.getByte(offset);
((nullBits & ) != ) {
buffer.getIntLE(offset + );
(effectsOffset < ) {
ValidationResult.error();
}
offset + + effectsOffset;
(pos >= buffer.writerIndex()) {
ValidationResult.error();
}
InteractionEffects.validateStructure(buffer, pos);
(!effectsResult.isValid()) {
ValidationResult.error( + effectsResult.error());
}
pos += InteractionEffects.computeBytesConsumed(buffer, pos);
}
((nullBits & ) != ) {
buffer.getIntLE(offset + );
(settingsOffset < ) {
ValidationResult.error();
}
offset + + settingsOffset;
(pos >= buffer.writerIndex()) {
ValidationResult.error();
}
VarInt.peek(buffer, pos);
(settingsCount < ) {
ValidationResult.error();
}
(settingsCount > ) {
ValidationResult.error();
}
pos += VarInt.length(buffer, pos);
( ; i < settingsCount; ++i) {
++pos;
++pos;
}
}
((nullBits & ) != ) {
buffer.getIntLE(offset + );
(rulesOffset < ) {
ValidationResult.error();
}
offset + + rulesOffset;
(pos >= buffer.writerIndex()) {
ValidationResult.error();
}
InteractionRules.validateStructure(buffer, pos);
(!rulesResult.isValid()) {
ValidationResult.error( + rulesResult.error());
}
pos += InteractionRules.computeBytesConsumed(buffer, pos);
}
((nullBits & ) != ) {
buffer.getIntLE(offset + );
(tagsOffset < ) {
ValidationResult.error();
}
offset + + tagsOffset;
(pos >= buffer.writerIndex()) {
ValidationResult.error();
}
VarInt.peek(buffer, pos);
(tagsCount < ) {
ValidationResult.error();
}
(tagsCount > ) {
ValidationResult.error();
}
pos += VarInt.length(buffer, pos);
pos += tagsCount * ;
(pos > buffer.writerIndex()) {
ValidationResult.error();
}
}
((nullBits & ) != ) {
buffer.getIntLE(offset + );
(cameraOffset < ) {
ValidationResult.error();
}
offset + + cameraOffset;
(pos >= buffer.writerIndex()) {
ValidationResult.error();
}
InteractionCameraSettings.validateStructure(buffer, pos);
(!cameraResult.isValid()) {
ValidationResult.error( + cameraResult.error());
}
pos += InteractionCameraSettings.computeBytesConsumed(buffer, pos);
}
((nullBits & ) != ) {
buffer.getIntLE(offset + );
(memoriesNextOffset < ) {
ValidationResult.error();
}
offset + + memoriesNextOffset;
(pos >= buffer.writerIndex()) {
ValidationResult.error();
}
VarInt.peek(buffer, pos);
(memoriesNextCount < ) {
ValidationResult.error();
}
(memoriesNextCount > ) {
ValidationResult.error();
}
pos += VarInt.length(buffer, pos);
( ; i < memoriesNextCount; ++i) {
pos += ;
(pos > buffer.writerIndex()) {
ValidationResult.error();
}
pos += ;
(pos > buffer.writerIndex()) {
ValidationResult.error();
}
}
}
ValidationResult.OK;
}
}
MemoriesConditionInteraction {
();
copy.waitForDataFrom = .waitForDataFrom;
copy.effects = .effects != ? .effects.clone() : ;
copy.horizontalSpeedMultiplier = .horizontalSpeedMultiplier;
copy.runTime = .runTime;
copy.cancelOnItemChange = .cancelOnItemChange;
(.settings != ) {
Map<GameMode, InteractionSettings> m = ();
(Map.Entry<GameMode, InteractionSettings> e : .settings.entrySet()) {
m.put((GameMode)e.getKey(), ((InteractionSettings)e.getValue()).clone());
}
copy.settings = m;
}
copy.rules = .rules != ? .rules.clone() : ;
copy.tags = .tags != ? Arrays.copyOf(.tags, .tags.length) : ;
copy.camera = .camera != ? .camera.clone() : ;
copy.memoriesNext = .memoriesNext != ? (.memoriesNext) : ;
copy.failed = .failed;
copy;
}
{
( == obj) {
;
} (!(obj MemoriesConditionInteraction)) {
;
} {
(MemoriesConditionInteraction)obj;
Objects.equals(.waitForDataFrom, other.waitForDataFrom) && Objects.equals(.effects, other.effects) && .horizontalSpeedMultiplier == other.horizontalSpeedMultiplier && .runTime == other.runTime && .cancelOnItemChange == other.cancelOnItemChange && Objects.equals(.settings, other.settings) && Objects.equals(.rules, other.rules) && Arrays.equals(.tags, other.tags) && Objects.equals(.camera, other.camera) && Objects.equals(.memoriesNext, other.memoriesNext) && .failed == other.failed;
}
}
{
;
result = * result + Objects.hashCode(.waitForDataFrom);
result = * result + Objects.hashCode(.effects);
result = * result + Float.hashCode(.horizontalSpeedMultiplier);
result = * result + Float.hashCode(.runTime);
result = * result + Boolean.hashCode(.cancelOnItemChange);
result = * result + Objects.hashCode(.settings);
result = * result + Objects.hashCode(.rules);
result = * result + Arrays.hashCode(.tags);
result = * result + Objects.hashCode(.camera);
result = * result + Objects.hashCode(.memoriesNext);
result = * result + Integer.hashCode(.failed);
result;
}
}