CustomPage class
Пакет: com.hypixel.hytale.protocol.packets.interface_
Файл: com/hypixel/hytale/protocol/packets/interface_/CustomPage.java
implements: Packet, ToClientPacket
Поля (65)
| Модификаторы | Тип | Имя |
|---|---|---|
final |
int |
PACKET_ID |
|
int |
var1 |
|
CustomPage |
var1 |
|
int |
var1 |
|
|
var1 |
|
|
var1 |
|
|
var1 |
|
|
var1 |
|
|
var1 |
|
long |
var10 |
|
int |
var10 |
|
int |
var11 |
|
int |
var12 |
|
CustomUICommand[] |
var15 |
|
|
var15 |
|
int |
var16 |
|
|
var16 |
|
CustomUIEventBinding[] |
var18 |
|
|
var18 |
|
int |
var19 |
|
|
var19 |
|
long |
var2 |
|
ReadCursor |
var2 |
|
ReadCursor |
var2 |
|
byte |
var2 |
|
byte |
var2 |
|
byte |
var2 |
|
int |
var2 |
|
CustomPage |
var21 |
|
int |
var22 |
|
int |
var23 |
|
int |
var3 |
|
|
var3 |
|
int |
var3 |
|
|
var3 |
|
int |
var3 |
|
byte |
var3 |
|
|
var3 |
|
|
var3 |
|
|
var3 |
|
long |
var4 |
|
long |
var4 |
|
int |
var4 |
|
int |
var4 |
|
|
var4 |
|
|
var4 |
|
byte |
var4 |
|
|
var4 |
|
|
var4 |
|
int |
var5 |
|
ReadCursor |
var5 |
|
int |
var5 |
|
int |
var6 |
|
int |
var6 |
|
String |
var6 |
|
|
var6 |
|
int |
var6 |
|
int |
var7 |
|
int |
var7 |
|
int |
var7 |
|
int |
var7 |
|
CustomUICommand[] |
var8 |
|
CustomUIEventBinding[] |
var8 |
|
long |
var8 |
|
long |
var9 |
Методы (64)
| Модификаторы | Возврат | Сигнатура |
|---|---|---|
public |
CustomPage |
cloneCustomPage clone() |
|
|
for for(int var9 = 0; var9 < var6; var9++) |
|
|
for for(int var9 = 0; var9 < var6; var9++) |
|
|
for for(int var13 = 0; var13 < var11; var13++) |
|
|
for for(int var14 = 0; var14 < var22; var14++) |
|
|
for for(int var7 = 0; var7 < this.commands.length; var7++) |
|
|
for for(int var11 = 0; var11 < this.eventBindings.length; var11++) |
|
|
for for(CustomUICommand var6 : this.commands) |
|
|
for for(CustomUIEventBinding var11 : this.eventBindings) |
static |
boolean |
getClearboolean getClear(MemorySegment var0) |
static |
boolean |
getClearboolean getClear(MemorySegment var0, int var1) |
abstract |
return |
getClearreturn getClear(var0, 0) |
abstract |
return |
getCommandsreturn getCommands(var0, 0) |
abstract |
return |
getEventBindingsreturn getEventBindings(var0, 0) |
static |
boolean |
getIsInitialboolean getIsInitial(MemorySegment var0) |
static |
boolean |
getIsInitialboolean getIsInitial(MemorySegment var0, int var1) |
abstract |
return |
getIsInitialreturn getIsInitial(var0, 0) |
abstract |
return |
getKeyreturn getKey(var0, 0) |
static |
CustomPageLifetime |
getLifetimeCustomPageLifetime getLifetime(MemorySegment var0) |
static |
CustomPageLifetime |
getLifetimeCustomPageLifetime getLifetime(MemorySegment var0, int var1) |
abstract |
return |
getLifetimereturn getLifetime(var0, 0) |
static |
int |
getValidatedOffsetint getValidatedOffset(MemorySegment var0, int var1, int var2, int var3, String var4) |
static |
boolean |
hasCommandsboolean hasCommands(MemorySegment var0, int var1) |
static |
boolean |
hasEventBindingsboolean hasEventBindings(MemorySegment var0, int var1) |
static |
boolean |
hasKeyboolean hasKey(MemorySegment var0, int var1) |
|
|
if if(var1 < 0) |
|
|
if if(var4 == -1L) |
|
|
if if(var6 > 4096000) |
|
|
if if(var4 == -1L) |
|
|
if if(var6 > 4096000) |
|
|
if if(var4 != var2) |
|
|
if if(var9 == -1L) |
|
|
if if(var11 > 4096000) |
|
|
if if(var10 == -1L) |
|
|
if if(var22 > 4096000) |
|
|
if if(var2 != null) |
|
|
if if(this.key != null) |
|
|
if if(this.commands != null) |
|
|
if if(this.eventBindings != null) |
|
|
if if(this.isInitial) |
|
|
if if(this.clear) |
|
|
if if(this.key != null) |
|
|
if if(this.commands != null) |
|
|
if if(this.commands.length > 4096000) |
|
|
if if(this.eventBindings != null) |
|
|
if if(this.eventBindings.length > 4096000) |
|
|
if if(this.key != null) |
|
|
if if(this.commands != null) |
|
|
if if(this.eventBindings != null) |
|
|
if if(this == var1) |
static |
void |
requireBoundsvoid requireBounds(MemorySegment var0, int var1) |
abstract |
|
requireBounds requireBounds(var0, var1) |
static |
void |
requireSlotvoid requireSlot(MemorySegment var0, int var1, int var2, String var3) |
abstract |
|
requireSlot requireSlot(var0, var1 + 3, var4, "Key") |
abstract |
|
requireSlot requireSlot(var0, var1 + 3, -1, "Key") |
abstract |
|
requireSlot requireSlot(var0, var1 + 7, var4, "Commands") |
abstract |
|
requireSlot requireSlot(var0, var1 + 7, -1, "Commands") |
abstract |
|
requireSlot requireSlot(var0, var1 + 11, var4, "EventBindings") |
abstract |
|
requireSlot requireSlot(var0, var1 + 11, -1, "EventBindings") |
static |
CustomPage |
toObjectCustomPage toObject(MemorySegment var0) |
static |
CustomPage |
toObjectCustomPage toObject(MemorySegment var0, int var1) |
static |
CustomPage |
toObjectCustomPage toObject(MemorySegment var0, int var1, @Nullable ReadCursor var2) |
abstract |
return |
toObjectreturn toObject(var0, 0, null) |
abstract |
return |
toObjectreturn toObject(var0, var1, null) |
Исходный код
Показать/скрыть
class="kw">package com.hypixel.hytale.protocol.packets.interface_;
class="kw">import com.hypixel.hytale.protocol.NetworkChannel;
class="kw">import com.hypixel.hytale.protocol.Packet;
class="kw">import com.hypixel.hytale.protocol.ToClientPacket;
class="kw">import com.hypixel.hytale.protocol.io.PacketIO;
class="kw">import com.hypixel.hytale.protocol.io.ProtocolException;
class="kw">import com.hypixel.hytale.protocol.io.ReadCursor;
class="kw">import com.hypixel.hytale.protocol.io.VarInt;
class="kw">import java.lang.foreign.MemorySegment;
class="kw">import java.util.Arrays;
class="kw">import java.util.Objects;
class="kw">import javax.annotation.Nonnull;
class="kw">import javax.annotation.Nullable;
class="kw">public class CustomPage class="kw">implements Packet, ToClientPacket {
class="kw">public class="kw">static class="kw">final int PACKET_ID = 218;
class="kw">public class="kw">static class="kw">final boolean IS_COMPRESSED = true;
class="kw">public class="kw">static class="kw">final int NULLABLE_BIT_FIELD_SIZE = 1;
class="kw">public class="kw">static class="kw">final int FIXED_BLOCK_SIZE = 3;
class="kw">public class="kw">static class="kw">final int VARIABLE_FIELD_COUNT = 3;
class="kw">public class="kw">static class="kw">final int VARIABLE_BLOCK_START = 15;
class="kw">public class="kw">static class="kw">final int MAX_SIZE = 1677721600;
@Nullable
class="kw">public String key;
class="kw">public boolean isInitial;
class="kw">public boolean clear;
@Nonnull
class="kw">public CustomPageLifetime lifetime = CustomPageLifetime.CantClose;
@Nullable
class="kw">public CustomUICommand[] commands;
@Nullable
class="kw">public CustomUIEventBinding[] eventBindings;
@Override
class="kw">public int getId() {
class="kw">return 218;
}
@Override
class="kw">public NetworkChannel getChannel() {
class="kw">return NetworkChannel.Default;
}
class="kw">public CustomPage() {
}
class="kw">public CustomPage(
@Nullable String var1,
boolean var2,
boolean var3,
@Nonnull CustomPageLifetime var4,
@Nullable CustomUICommand[] var5,
@Nullable CustomUIEventBinding[] var6
) {
this.key = var1;
this.isInitial = var2;
this.clear = var3;
this.lifetime = var4;
this.commands = var5;
this.eventBindings = var6;
}
class="kw">public CustomPage(@Nonnull CustomPage var1) {
this.key = var1.key;
this.isInitial = var1.isInitial;
this.clear = var1.clear;
this.lifetime = var1.lifetime;
this.commands = var1.commands;
this.eventBindings = var1.eventBindings;
}
class="kw">public class="kw">static void requireBounds(MemorySegment var0, int var1) {
if (var1 < 0) {
throw ProtocolException.invalidOffset("CustomPage", var1, (int)var0.byteSize());
}
long var2 = var1 + 15L;
if (var2 > var0.byteSize()) {
throw ProtocolException.bufferTooSmall("CustomPage", (int)Math.min(var2, 2147483647L), (int)var0.byteSize());
}
}
@Nullable
class="kw">public class="kw">static String getKey(MemorySegment var0) {
class="kw">return getKey(var0, 0);
}
@Nullable
class="kw">public class="kw">static String getKey(MemorySegment var0, int var1) {
class="kw">return hasKey(var0, var1) ? PacketIO.readVarString("Key", var0, var1 + getValidatedOffset(var0, var1, 3, 15, "Key"), 4096000) : null;
}
class="kw">public class="kw">static boolean getIsInitial(MemorySegment var0) {
class="kw">return getIsInitial(var0, 0);
}
class="kw">public class="kw">static boolean getIsInitial(MemorySegment var0, int var1) {
class="kw">return (var0.get(PacketIO.PROTO_BYTE, var1 + 1) & 1) != 0;
}
class="kw">public class="kw">static boolean getClear(MemorySegment var0) {
class="kw">return getClear(var0, 0);
}
class="kw">public class="kw">static boolean getClear(MemorySegment var0, int var1) {
class="kw">return (var0.get(PacketIO.PROTO_BYTE, var1 + 1) & 2) != 0;
}
class="kw">public class="kw">static CustomPageLifetime getLifetime(MemorySegment var0) {
class="kw">return getLifetime(var0, 0);
}
class="kw">public class="kw">static CustomPageLifetime getLifetime(MemorySegment var0, int var1) {
class="kw">return CustomPageLifetime.fromValue(var0.get(PacketIO.PROTO_BYTE, var1 + 2));
}
@Nullable
class="kw">public class="kw">static CustomUICommand[] getCommands(MemorySegment var0) {
class="kw">return getCommands(var0, 0);
}
@Nullable
class="kw">public class="kw">static CustomUICommand[] getCommands(MemorySegment var0, int var1) {
if (!hasCommands(var0, var1)) {
class="kw">return null;
}
ReadCursor var2 = new ReadCursor();
int var3 = var1 + getValidatedOffset(var0, var1, 7, 15, "Commands");
long var4 = VarInt.getWithLength(var0, var3);
if (var4 == -1L) {
throw ProtocolException.invalidVarInt("Commands");
}
int var6 = (int)var4;
if (var6 > 4096000) {
throw ProtocolException.arrayTooLong("Commands", var6, 4096000);
}
int var7 = (int)(var4 >>> 32);
if (var3 + var7 + var6 * 14L > var0.byteSize()) {
throw ProtocolException.bufferTooSmall("Commands", (int)Math.min(var3 + var7 + var6 * 14L, 2147483647L), (int)var0.byteSize());
}
var3 += var7;
CustomUICommand[] var8 = new CustomUICommand[var6];
for (int var9 = 0; var9 < var6; var9++) {
var8[var9] = CustomUICommand.toObject(var0, var3, var2);
var3 = var2.position;
}
class="kw">return var8;
}
@Nullable
class="kw">public class="kw">static CustomUIEventBinding[] getEventBindings(MemorySegment var0) {
class="kw">return getEventBindings(var0, 0);
}
@Nullable
class="kw">public class="kw">static CustomUIEventBinding[] getEventBindings(MemorySegment var0, int var1) {
if (!hasEventBindings(var0, var1)) {
class="kw">return null;
}
ReadCursor var2 = new ReadCursor();
int var3 = var1 + getValidatedOffset(var0, var1, 11, 15, "EventBindings");
long var4 = VarInt.getWithLength(var0, var3);
if (var4 == -1L) {
throw ProtocolException.invalidVarInt("EventBindings");
}
int var6 = (int)var4;
if (var6 > 4096000) {
throw ProtocolException.arrayTooLong("EventBindings", var6, 4096000);
}
int var7 = (int)(var4 >>> 32);
if (var3 + var7 + var6 * 11L > var0.byteSize()) {
throw ProtocolException.bufferTooSmall("EventBindings", (int)Math.min(var3 + var7 + var6 * 11L, 2147483647L), (int)var0.byteSize());
}
var3 += var7;
CustomUIEventBinding[] var8 = new CustomUIEventBinding[var6];
for (int var9 = 0; var9 < var6; var9++) {
var8[var9] = CustomUIEventBinding.toObject(var0, var3, var2);
var3 = var2.position;
}
class="kw">return var8;
}
class="kw">public class="kw">static boolean hasKey(MemorySegment var0, int var1) {
byte var2 = var0.get(PacketIO.PROTO_BYTE, var1 + 0);
class="kw">return (var2 & 1) != 0;
}
class="kw">public class="kw">static boolean hasCommands(MemorySegment var0, int var1) {
byte var2 = var0.get(PacketIO.PROTO_BYTE, var1 + 0);
class="kw">return (var2 & 2) != 0;
}
class="kw">public class="kw">static boolean hasEventBindings(MemorySegment var0, int var1) {
byte var2 = var0.get(PacketIO.PROTO_BYTE, var1 + 0);
class="kw">return (var2 & 4) != 0;
}
class="kw">private class="kw">static int getValidatedOffset(MemorySegment var0, int var1, int var2, int var3, String var4) {
int var5 = var0.get(PacketIO.PROTO_INT, var1 + var2);
if (var5 >= 0 && var5 <= var0.byteSize() - var1 - var3) {
class="kw">return var3 + var5;
} else {
throw ProtocolException.invalidOffset(var4, var5, (int)var0.byteSize());
}
}
class="kw">private class="kw">static void requireSlot(MemorySegment var0, int var1, int var2, String var3) {
int var4 = var0.get(PacketIO.PROTO_INT, var1);
if (var4 != var2) {
throw ProtocolException.nonCanonicalLayout(var3, var4, var2);
}
}
class="kw">public class="kw">static CustomPage toObject(MemorySegment var0) {
class="kw">return toObject(var0, 0, null);
}
class="kw">public class="kw">static CustomPage toObject(MemorySegment var0, int var1) {
class="kw">return toObject(var0, var1, null);
}
class="kw">public class="kw">static CustomPage toObject(MemorySegment var0, int var1, @Nullable ReadCursor var2) {
requireBounds(var0, var1);
int var3 = var1 + 15;
int var4 = 0;
ReadCursor var5 = var2 != null ? var2 : new ReadCursor();
String var6 = null;
if (hasKey(var0, var1)) {
requireSlot(var0, var1 + 3, var4, "Key");
int var7 = var3 + var4;
long var8 = VarInt.getWithLength(var0, var7);
var6 = PacketIO.readVarString("Key", var0, var7, 0, 4096000, var8);
var4 += (int)var8 + (int)(var8 >>> 32);
} else {
requireSlot(var0, var1 + 3, -1, "Key");
}
CustomUICommand[] var15 = null;
if (hasCommands(var0, var1)) {
requireSlot(var0, var1 + 7, var4, "Commands");
int var16 = var3 + var4;
long var9 = VarInt.getWithLength(var0, var16);
if (var9 == -1L) {
throw ProtocolException.invalidVarInt("Commands");
}
int var11 = (int)var9;
if (var11 > 4096000) {
throw ProtocolException.arrayTooLong("Commands", var11, 4096000);
}
int var12 = (int)(var9 >>> 32);
if (var16 + var12 + var11 * 14L > var0.byteSize()) {
throw ProtocolException.bufferTooSmall("Commands", (int)Math.min(var16 + var12 + var11 * 14L, 2147483647L), (int)var0.byteSize());
}
var16 += var12;
var15 = new CustomUICommand[var11];
for (int var13 = 0; var13 < var11; var13++) {
var15[var13] = CustomUICommand.toObject(var0, var16, var5);
var16 = var5.position;
}
var4 = var16 - var3;
} else {
requireSlot(var0, var1 + 7, -1, "Commands");
}
CustomUIEventBinding[] var18 = null;
if (hasEventBindings(var0, var1)) {
requireSlot(var0, var1 + 11, var4, "EventBindings");
int var19 = var3 + var4;
long var10 = VarInt.getWithLength(var0, var19);
if (var10 == -1L) {
throw ProtocolException.invalidVarInt("EventBindings");
}
int var22 = (int)var10;
if (var22 > 4096000) {
throw ProtocolException.arrayTooLong("EventBindings", var22, 4096000);
}
int var23 = (int)(var10 >>> 32);
if (var19 + var23 + var22 * 11L > var0.byteSize()) {
throw ProtocolException.bufferTooSmall("EventBindings", (int)Math.min(var19 + var23 + var22 * 11L, 2147483647L), (int)var0.byteSize());
}
var19 += var23;
var18 = new CustomUIEventBinding[var22];
for (int var14 = 0; var14 < var22; var14++) {
var18[var14] = CustomUIEventBinding.toObject(var0, var19, var5);
var19 = var5.position;
}
var4 = var19 - var3;
} else {
requireSlot(var0, var1 + 11, -1, "EventBindings");
}
CustomPage var21 = new CustomPage(
var6,
(var0.get(PacketIO.PROTO_BYTE, var1 + 1) & 1) != 0,
(var0.get(PacketIO.PROTO_BYTE, var1 + 1) & 2) != 0,
CustomPageLifetime.fromValue(var0.get(PacketIO.PROTO_BYTE, var1 + 2)),
var15,
var18
);
if (var2 != null) {
var2.position = var3 + var4;
}
class="kw">return var21;
}
@Override
class="kw">public int serialize(@Nonnull MemorySegment var1, int var2) {
byte var3 = 0;
if (this.key != null) {
var3 = (byte)(var3 | 1);
}
if (this.commands != null) {
var3 = (byte)(var3 | 2);
}
if (this.eventBindings != null) {
var3 = (byte)(var3 | 4);
}
var1.set(PacketIO.PROTO_BYTE, var2 + 0, var3);
byte var4 = 0;
if (this.isInitial) {
var4 = (byte)(var4 | 1);
}
if (this.clear) {
var4 = (byte)(var4 | 2);
}
var1.set(PacketIO.PROTO_BYTE, var2 + 1 + 0, var4);
var1.set(PacketIO.PROTO_BYTE, var2 + 2, (byte)this.lifetime.getValue());
int var5 = var2 + 15;
if (this.key != null) {
var1.set(PacketIO.PROTO_INT, var2 + 3, var5 - var2 - 15);
var5 += PacketIO.writeVarString(var1, var5, this.key, 4096000);
} else {
var1.set(PacketIO.PROTO_INT, var2 + 3, -1);
}
if (this.commands != null) {
var1.set(PacketIO.PROTO_INT, var2 + 7, var5 - var2 - 15);
if (this.commands.length > 4096000) {
throw ProtocolException.arrayTooLong("Commands", this.commands.length, 4096000);
}
var5 += VarInt.set(var1, var5, this.commands.length);
int var6 = 0;
for (int var7 = 0; var7 < this.commands.length; var7++) {
var6 += this.commands[var7].serialize(var1, var5 + var6);
}
var5 += var6;
} else {
var1.set(PacketIO.PROTO_INT, var2 + 7, -1);
}
if (this.eventBindings != null) {
var1.set(PacketIO.PROTO_INT, var2 + 11, var5 - var2 - 15);
if (this.eventBindings.length > 4096000) {
throw ProtocolException.arrayTooLong("EventBindings", this.eventBindings.length, 4096000);
}
var5 += VarInt.set(var1, var5, this.eventBindings.length);
int var10 = 0;
for (int var11 = 0; var11 < this.eventBindings.length; var11++) {
var10 += this.eventBindings[var11].serialize(var1, var5 + var10);
}
var5 += var10;
} else {
var1.set(PacketIO.PROTO_INT, var2 + 11, -1);
}
class="kw">return var5 - var2;
}
@Override
class="kw">public int computeSize() {
int var1 = 15;
if (this.key != null) {
var1 += PacketIO.stringSize(this.key);
}
if (this.commands != null) {
int var2 = 0;
for (CustomUICommand var6 : this.commands) {
var2 += var6.computeSize();
}
var1 += VarInt.size(this.commands.length) + var2;
}
if (this.eventBindings != null) {
int var7 = 0;
for (CustomUIEventBinding var11 : this.eventBindings) {
var7 += var11.computeSize();
}
var1 += VarInt.size(this.eventBindings.length) + var7;
}
class="kw">return var1;
}
class="kw">public CustomPage clone() {
CustomPage var1 = new CustomPage();
var1.key = this.key;
var1.isInitial = this.isInitial;
var1.clear = this.clear;
var1.lifetime = this.lifetime;
var1.commands = this.commands != null ? Arrays.stream(this.commands).map(var0 -> var0.clone()).toArray(CustomUICommand[]::new) : null;
var1.eventBindings = this.eventBindings != null ? Arrays.stream(this.eventBindings).map(var0 -> var0.clone()).toArray(CustomUIEventBinding[]::new) : null;
class="kw">return var1;
}
@Override
class="kw">public boolean equals(Object var1) {
if (this == var1) {
class="kw">return true;
} else {
class="kw">return !(var1 class="kw">instanceof CustomPage var2)
? false
: Objects.equals(this.key, var2.key)
&& this.isInitial == var2.isInitial
&& this.clear == var2.clear
&& Objects.equals(this.lifetime, var2.lifetime)
&& Arrays.equals(this.commands, var2.commands)
&& Arrays.equals(this.eventBindings, var2.eventBindings);
}
}
@Override
class="kw">public int hashCode() {
int var1 = 1;
var1 = 31 * var1 + Objects.hashCode(this.key);
var1 = 31 * var1 + Boolean.hashCode(this.isInitial);
var1 = 31 * var1 + Boolean.hashCode(this.clear);
var1 = 31 * var1 + Objects.hashCode(this.lifetime);
var1 = 31 * var1 + Arrays.hashCode(this.commands);
class="kw">return 31 * var1 + Arrays.hashCode(this.eventBindings);
}
}