SetMachinimaActorModel.java
package com.hypixel.hytale.protocol.packets.machinima;
import com.hypixel.hytale.protocol.Model;
import com.hypixel.hytale.protocol.Packet;
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 SetMachinimaActorModel implements Packet {
public static final int PACKET_ID = 261;
public static final boolean IS_COMPRESSED = false;
public static final int NULLABLE_BIT_FIELD_SIZE = 1;
public static final int ;
;
;
;
Model model;
String sceneName;
String actorName;
{
;
}
{
}
{
.model = model;
.sceneName = sceneName;
.actorName = actorName;
}
{
.model = other.model;
.sceneName = other.sceneName;
.actorName = other.actorName;
}
SetMachinimaActorModel {
();
buf.getByte(offset);
((nullBits & ) != ) {
offset + + buf.getIntLE(offset + );
obj.model = Model.deserialize(buf, varPos0);
}
((nullBits & ) != ) {
offset + + buf.getIntLE(offset + );
VarInt.peek(buf, varPos1);
(sceneNameLen < ) {
ProtocolException.negativeLength(, sceneNameLen);
}
(sceneNameLen > ) {
ProtocolException.stringTooLong(, sceneNameLen, );
}
obj.sceneName = PacketIO.readVarString(buf, varPos1, PacketIO.UTF8);
}
((nullBits & ) != ) {
offset + + buf.getIntLE(offset + );
VarInt.peek(buf, varPos2);
(actorNameLen < ) {
ProtocolException.negativeLength(, actorNameLen);
}
(actorNameLen > ) {
ProtocolException.stringTooLong(, actorNameLen, );
}
obj.actorName = PacketIO.readVarString(buf, varPos2, PacketIO.UTF8);
}
obj;
}
{
buf.getByte(offset);
;
((nullBits & ) != ) {
buf.getIntLE(offset + );
offset + + fieldOffset0;
pos0 += Model.computeBytesConsumed(buf, pos0);
(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;
}
}
((nullBits & ) != ) {
buf.getIntLE(offset + );
offset + + fieldOffset2;
VarInt.peek(buf, pos2);
pos2 += VarInt.length(buf, pos2) + sl;
(pos2 - offset > maxEnd) {
maxEnd = pos2 - offset;
}
}
maxEnd;
}
{
buf.writerIndex();
;
(.model != ) {
nullBits = ()(nullBits | );
}
(.sceneName != ) {
nullBits = ()(nullBits | );
}
(.actorName != ) {
nullBits = ()(nullBits | );
}
buf.writeByte(nullBits);
buf.writerIndex();
buf.writeIntLE();
buf.writerIndex();
buf.writeIntLE();
buf.writerIndex();
buf.writeIntLE();
buf.writerIndex();
(.model != ) {
buf.setIntLE(modelOffsetSlot, buf.writerIndex() - varBlockStart);
.model.serialize(buf);
} {
buf.setIntLE(modelOffsetSlot, -);
}
(.sceneName != ) {
buf.setIntLE(sceneNameOffsetSlot, buf.writerIndex() - varBlockStart);
PacketIO.writeVarString(buf, .sceneName, );
} {
buf.setIntLE(sceneNameOffsetSlot, -);
}
(.actorName != ) {
buf.setIntLE(actorNameOffsetSlot, buf.writerIndex() - varBlockStart);
PacketIO.writeVarString(buf, .actorName, );
} {
buf.setIntLE(actorNameOffsetSlot, -);
}
}
{
;
(.model != ) {
size += .model.computeSize();
}
(.sceneName != ) {
size += PacketIO.stringSize(.sceneName);
}
(.actorName != ) {
size += PacketIO.stringSize(.actorName);
}
size;
}
ValidationResult {
(buffer.readableBytes() - offset < ) {
ValidationResult.error();
} {
buffer.getByte(offset);
((nullBits & ) != ) {
buffer.getIntLE(offset + );
(modelOffset < ) {
ValidationResult.error();
}
offset + + modelOffset;
(pos >= buffer.writerIndex()) {
ValidationResult.error();
}
Model.validateStructure(buffer, pos);
(!modelResult.isValid()) {
ValidationResult.error( + modelResult.error());
}
pos += Model.computeBytesConsumed(buffer, pos);
}
((nullBits & ) != ) {
buffer.getIntLE(offset + );
(sceneNameOffset < ) {
ValidationResult.error();
}
offset + + sceneNameOffset;
(pos >= buffer.writerIndex()) {
ValidationResult.error();
}
VarInt.peek(buffer, pos);
(sceneNameLen < ) {
ValidationResult.error();
}
(sceneNameLen > ) {
ValidationResult.error();
}
pos += VarInt.length(buffer, pos);
pos += sceneNameLen;
(pos > buffer.writerIndex()) {
ValidationResult.error();
}
}
((nullBits & ) != ) {
buffer.getIntLE(offset + );
(actorNameOffset < ) {
ValidationResult.error();
}
offset + + actorNameOffset;
(pos >= buffer.writerIndex()) {
ValidationResult.error();
}
VarInt.peek(buffer, pos);
(actorNameLen < ) {
ValidationResult.error();
}
(actorNameLen > ) {
ValidationResult.error();
}
pos += VarInt.length(buffer, pos);
pos += actorNameLen;
(pos > buffer.writerIndex()) {
ValidationResult.error();
}
}
ValidationResult.OK;
}
}
SetMachinimaActorModel {
();
copy.model = .model != ? .model.clone() : ;
copy.sceneName = .sceneName;
copy.actorName = .actorName;
copy;
}
{
( == obj) {
;
} (!(obj SetMachinimaActorModel)) {
;
} {
(SetMachinimaActorModel)obj;
Objects.equals(.model, other.model) && Objects.equals(.sceneName, other.sceneName) && Objects.equals(.actorName, other.actorName);
}
}
{
Objects.hash( []{.model, .sceneName, .actorName});
}
}