InteractionPriority class
Пакет: com.hypixel.hytale.protocol
Файл: com/hypixel/hytale/protocol/InteractionPriority.java
Поля (25)
| Модификаторы | Тип | Имя |
|---|---|---|
final |
int |
NULLABLE_BIT_FIELD_SIZE |
|
int |
var1 |
|
InteractionPriority |
var1 |
|
PrioritySlot |
var11 |
|
int |
var12 |
|
InteractionPriority |
var15 |
|
long |
var2 |
|
int |
var2 |
|
byte |
var2 |
|
long |
var3 |
|
int |
var3 |
|
byte |
var3 |
|
|
var3 |
|
int |
var4 |
|
|
var4 |
|
int |
var4 |
|
int |
var5 |
|
Map |
var5 |
|
|
var5 |
|
Map |
var6 |
|
int |
var6 |
|
long |
var7 |
|
PrioritySlot |
var8 |
|
int |
var9 |
|
int |
var9 |
Методы (24)
| Модификаторы | Возврат | Сигнатура |
|---|---|---|
public |
InteractionPriority |
cloneInteractionPriority clone() |
public |
int |
computeSizeint computeSize() |
|
|
for for(int var7 = 0; var7 < var5; var7++) |
|
|
for for(int var10 = 0; var10 < var9; var10++) |
abstract |
return |
getValuesreturn getValues(var0, 0) |
static |
boolean |
hasValuesboolean hasValues(MemorySegment var0, int var1) |
|
|
if if(var1 < 0) |
|
|
if if(var3 == -1L) |
|
|
if if(var5 > 4096000) |
|
|
if if(var7 == -1L) |
|
|
if if(var9 > 4096000) |
|
|
if if(var2 != null) |
|
|
if if(this.values != null) |
|
|
if if(this.values != null) |
|
|
if if(this.values != null) |
|
|
if if(this == var1) |
static |
void |
requireBoundsvoid requireBounds(MemorySegment var0, int var1) |
abstract |
|
requireBounds requireBounds(var0, var1) |
public |
int |
serializeint serialize(@Nonnull MemorySegment var1, int var2) |
static |
InteractionPriority |
toObjectInteractionPriority toObject(MemorySegment var0) |
static |
InteractionPriority |
toObjectInteractionPriority toObject(MemorySegment var0, int var1) |
static |
InteractionPriority |
toObjectInteractionPriority 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;
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.HashMap;
class="kw">import java.util.Map;
class="kw">import java.util.Objects;
class="kw">import java.util.Map.Entry;
class="kw">import javax.annotation.Nonnull;
class="kw">import javax.annotation.Nullable;
class="kw">public class InteractionPriority {
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 = 1;
class="kw">public class="kw">static class="kw">final int VARIABLE_FIELD_COUNT = 1;
class="kw">public class="kw">static class="kw">final int VARIABLE_BLOCK_START = 1;
class="kw">public class="kw">static class="kw">final int MAX_SIZE = 20480006;
@Nullable
class="kw">public Map<PrioritySlot, Integer> values;
class="kw">public InteractionPriority() {
}
class="kw">public InteractionPriority(@Nullable Map<PrioritySlot, Integer> var1) {
this.values = var1;
}
class="kw">public InteractionPriority(@Nonnull InteractionPriority var1) {
this.values = var1.values;
}
class="kw">public class="kw">static void requireBounds(MemorySegment var0, int var1) {
if (var1 < 0) {
throw ProtocolException.invalidOffset("InteractionPriority", var1, (int)var0.byteSize());
}
long var2 = var1 + 1L;
if (var2 > var0.byteSize()) {
throw ProtocolException.bufferTooSmall("InteractionPriority", (int)Math.min(var2, 2147483647L), (int)var0.byteSize());
}
}
@Nullable
class="kw">public class="kw">static Map<PrioritySlot, Integer> getValues(MemorySegment var0) {
class="kw">return getValues(var0, 0);
}
@Nullable
class="kw">public class="kw">static Map<PrioritySlot, Integer> getValues(MemorySegment var0, int var1) {
if (!hasValues(var0, var1)) {
class="kw">return null;
}
int var2 = var1 + 1;
long var3 = VarInt.getWithLength(var0, var2);
if (var3 == -1L) {
throw ProtocolException.invalidVarInt("Values");
}
int var5 = (int)var3;
if (var5 > 4096000) {
throw ProtocolException.dictionaryTooLarge("Values", var5, 4096000);
}
var2 += (int)(var3 >>> 32);
if (var2 + var5 * 5L > var0.byteSize()) {
throw ProtocolException.bufferTooSmall("Values", (int)Math.min(var2 + var5 * 5L, 2147483647L), (int)var0.byteSize());
}
Map var6 = new HashMap<>(var5);
for (int var7 = 0; var7 < var5; var7++) {
PrioritySlot var8 = PrioritySlot.fromValue(var0.get(PacketIO.PROTO_BYTE, var2));
int var9 = var0.get(PacketIO.PROTO_INT, ++var2);
var2 += 4;
if (var6.put(var8, var9) != null) {
throw ProtocolException.duplicateKey("Values", var8);
}
}
class="kw">return var6;
}
class="kw">public class="kw">static boolean hasValues(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 InteractionPriority toObject(MemorySegment var0) {
class="kw">return toObject(var0, 0, null);
}
class="kw">public class="kw">static InteractionPriority toObject(MemorySegment var0, int var1) {
class="kw">return toObject(var0, var1, null);
}
class="kw">public class="kw">static InteractionPriority toObject(MemorySegment var0, int var1, @Nullable ReadCursor var2) {
requireBounds(var0, var1);
int var3 = var1 + 1;
int var4 = 0;
Map var5 = null;
if (hasValues(var0, var1)) {
int var6 = var3 + var4;
long var7 = VarInt.getWithLength(var0, var6);
if (var7 == -1L) {
throw ProtocolException.invalidVarInt("Values");
}
int var9 = (int)var7;
if (var9 > 4096000) {
throw ProtocolException.dictionaryTooLarge("Values", var9, 4096000);
}
var6 += (int)(var7 >>> 32);
if (var6 + var9 * 5L > var0.byteSize()) {
throw ProtocolException.bufferTooSmall("Values", (int)Math.min(var6 + var9 * 5L, 2147483647L), (int)var0.byteSize());
}
var5 = new HashMap<>(var9);
for (int var10 = 0; var10 < var9; var10++) {
PrioritySlot var11 = PrioritySlot.fromValue(var0.get(PacketIO.PROTO_BYTE, var6));
int var12 = var0.get(PacketIO.PROTO_INT, ++var6);
var6 += 4;
if (var5.put(var11, var12) != null) {
throw ProtocolException.duplicateKey("Values", var11);
}
}
var4 = var6 - var3;
}
InteractionPriority var15 = new InteractionPriority(var5);
if (var2 != null) {
var2.position = var3 + var4;
}
class="kw">return var15;
}
class="kw">public int serialize(@Nonnull MemorySegment var1, int var2) {
byte var3 = 0;
if (this.values != null) {
var3 = (byte)(var3 | 1);
}
var1.set(PacketIO.PROTO_BYTE, var2 + 0, var3);
int var4 = var2 + 1;
if (this.values != null) {
if (this.values.size() > 4096000) {
throw ProtocolException.dictionaryTooLarge("Values", this.values.size(), 4096000);
}
var4 += VarInt.set(var1, var4, this.values.size());
for (Entry var6 : this.values.entrySet()) {
var1.set(PacketIO.PROTO_BYTE, var4, (byte)var6.getKey().getValue());
var1.set(PacketIO.PROTO_INT, ++var4, var6.getValue());
var4 += 4;
}
}
class="kw">return var4 - var2;
}
class="kw">public int computeSize() {
int var1 = 1;
if (this.values != null) {
var1 += VarInt.size(this.values.size()) + this.values.size() * 5;
}
class="kw">return var1;
}
class="kw">public InteractionPriority clone() {
InteractionPriority var1 = new InteractionPriority();
var1.values = this.values != null ? new HashMap<>(this.values) : 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 InteractionPriority var2 ? Objects.equals(this.values, var2.values) : false;
}
}
@Override
class="kw">public int hashCode() {
class="kw">return Objects.hash(this.values);
}
}