UpdateBlockHitboxes class
Пакет: com.hypixel.hytale.protocol.packets.assets
Файл: com/hypixel/hytale/protocol/packets/assets/UpdateBlockHitboxes.java
implements: Packet, ToClientPacket
Поля (33)
| Модификаторы | Тип | Имя |
|---|---|---|
final |
int |
PACKET_ID |
|
int |
var1 |
|
UpdateBlockHitboxes |
var1 |
|
int |
var11 |
|
int |
var11 |
|
int |
var12 |
|
long |
var12 |
|
Hitbox[] |
var13 |
|
int |
var14 |
|
int |
var15 |
|
Hitbox[] |
var16 |
|
long |
var2 |
|
int |
var2 |
|
byte |
var2 |
|
int |
var2 |
|
Map |
var2 |
|
UpdateBlockHitboxes |
var20 |
|
long |
var3 |
|
int |
var3 |
|
byte |
var3 |
|
|
var3 |
|
int |
var4 |
|
|
var4 |
|
int |
var4 |
|
int |
var5 |
|
Map |
var5 |
|
|
var5 |
|
Map |
var6 |
|
int |
var6 |
|
long |
var7 |
|
int |
var8 |
|
long |
var9 |
|
int |
var9 |
Методы (35)
| Модификаторы | Возврат | Сигнатура |
|---|---|---|
public |
UpdateBlockHitboxes |
cloneUpdateBlockHitboxes clone() |
|
|
for for(int var7 = 0; var7 < var5; var7++) |
|
|
for for(int var14 = 0; var14 < var11; var14++) |
|
|
for for(int var10 = 0; var10 < var9; var10++) |
|
|
for for(int var17 = 0; var17 < var14; var17++) |
abstract |
return |
getBlockBaseHitboxesreturn getBlockBaseHitboxes(var0, 0) |
static |
int |
getMaxIdint getMaxId(MemorySegment var0) |
static |
int |
getMaxIdint getMaxId(MemorySegment var0, int var1) |
abstract |
return |
getMaxIdreturn getMaxId(var0, 0) |
static |
UpdateType |
getTypeUpdateType getType(MemorySegment var0) |
static |
UpdateType |
getTypeUpdateType getType(MemorySegment var0, int var1) |
abstract |
return |
getTypereturn getType(var0, 0) |
static |
boolean |
hasBlockBaseHitboxesboolean hasBlockBaseHitboxes(MemorySegment var0, int var1) |
|
|
if if(var1 < 0) |
|
|
if if(var3 == -1L) |
|
|
if if(var5 > 4096000) |
|
|
if if(var9 == -1L) |
|
|
if if(var11 > 4096000) |
|
|
if if(var7 == -1L) |
|
|
if if(var9 > 4096000) |
|
|
if if(var12 == -1L) |
|
|
if if(var14 > 4096000) |
|
|
if if(var2 != null) |
|
|
if if(this.blockBaseHitboxes != null) |
|
|
if if(this.blockBaseHitboxes != null) |
|
|
if if(this.blockBaseHitboxes != null) |
|
|
if if(this.blockBaseHitboxes != null) |
|
|
if if(this == var1) |
static |
void |
requireBoundsvoid requireBounds(MemorySegment var0, int var1) |
abstract |
|
requireBounds requireBounds(var0, var1) |
static |
UpdateBlockHitboxes |
toObjectUpdateBlockHitboxes toObject(MemorySegment var0) |
static |
UpdateBlockHitboxes |
toObjectUpdateBlockHitboxes toObject(MemorySegment var0, int var1) |
static |
UpdateBlockHitboxes |
toObjectUpdateBlockHitboxes 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.assets;
class="kw">import com.hypixel.hytale.protocol.Hitbox;
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.UpdateType;
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.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 UpdateBlockHitboxes class="kw">implements Packet, ToClientPacket {
class="kw">public class="kw">static class="kw">final int PACKET_ID = 41;
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 = 6;
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 = 6;
class="kw">public class="kw">static class="kw">final int MAX_SIZE = 1677721600;
@Nonnull
class="kw">public UpdateType type = UpdateType.Init;
class="kw">public int maxId;
@Nullable
class="kw">public Map<Integer, Hitbox[]> blockBaseHitboxes;
@Override
class="kw">public int getId() {
class="kw">return 41;
}
@Override
class="kw">public NetworkChannel getChannel() {
class="kw">return NetworkChannel.Default;
}
class="kw">public UpdateBlockHitboxes() {
}
class="kw">public UpdateBlockHitboxes(@Nonnull UpdateType var1, int var2, @Nullable Map<Integer, Hitbox[]> var3) {
this.type = var1;
this.maxId = var2;
this.blockBaseHitboxes = var3;
}
class="kw">public UpdateBlockHitboxes(@Nonnull UpdateBlockHitboxes var1) {
this.type = var1.type;
this.maxId = var1.maxId;
this.blockBaseHitboxes = var1.blockBaseHitboxes;
}
class="kw">public class="kw">static void requireBounds(MemorySegment var0, int var1) {
if (var1 < 0) {
throw ProtocolException.invalidOffset("UpdateBlockHitboxes", var1, (int)var0.byteSize());
}
long var2 = var1 + 6L;
if (var2 > var0.byteSize()) {
throw ProtocolException.bufferTooSmall("UpdateBlockHitboxes", (int)Math.min(var2, 2147483647L), (int)var0.byteSize());
}
}
class="kw">public class="kw">static UpdateType getType(MemorySegment var0) {
class="kw">return getType(var0, 0);
}
class="kw">public class="kw">static UpdateType getType(MemorySegment var0, int var1) {
class="kw">return UpdateType.fromValue(var0.get(PacketIO.PROTO_BYTE, var1 + 1));
}
class="kw">public class="kw">static int getMaxId(MemorySegment var0) {
class="kw">return getMaxId(var0, 0);
}
class="kw">public class="kw">static int getMaxId(MemorySegment var0, int var1) {
class="kw">return var0.get(PacketIO.PROTO_INT, var1 + 2);
}
@Nullable
class="kw">public class="kw">static Map<Integer, Hitbox[]> getBlockBaseHitboxes(MemorySegment var0) {
class="kw">return getBlockBaseHitboxes(var0, 0);
}
@Nullable
class="kw">public class="kw">static Map<Integer, Hitbox[]> getBlockBaseHitboxes(MemorySegment var0, int var1) {
if (!hasBlockBaseHitboxes(var0, var1)) {
class="kw">return null;
}
int var2 = var1 + 6;
long var3 = VarInt.getWithLength(var0, var2);
if (var3 == -1L) {
throw ProtocolException.invalidVarInt("BlockBaseHitboxes");
}
int var5 = (int)var3;
if (var5 > 4096000) {
throw ProtocolException.dictionaryTooLarge("BlockBaseHitboxes", var5, 4096000);
}
var2 += (int)(var3 >>> 32);
if (var2 + var5 * 5L > var0.byteSize()) {
throw ProtocolException.bufferTooSmall("BlockBaseHitboxes", (int)Math.min(var2 + var5 * 5L, 2147483647L), (int)var0.byteSize());
}
Map var6 = new HashMap<>(var5);
for (int var7 = 0; var7 < var5; var7++) {
int var8 = var0.get(PacketIO.PROTO_INT, var2);
var2 += 4;
long var9 = VarInt.getWithLength(var0, var2);
if (var9 == -1L) {
throw ProtocolException.invalidVarInt("value");
}
int var11 = (int)var9;
int var12 = (int)(var9 >>> 32);
if (var11 > 4096000) {
throw ProtocolException.arrayTooLong("value", var11, 4096000);
}
if (var2 + var12 + var11 * 24L > var0.byteSize()) {
throw ProtocolException.bufferTooSmall("value", var2 + var12 + var11 * 24, (int)var0.byteSize());
}
var2 += var12;
Hitbox[] var13 = new Hitbox[var11];
for (int var14 = 0; var14 < var11; var14++) {
var13[var14] = Hitbox.toObject(var0, var2);
var2 += 24;
}
if (var6.put(var8, var13) != null) {
throw ProtocolException.duplicateKey("BlockBaseHitboxes", var8);
}
}
class="kw">return var6;
}
class="kw">public class="kw">static boolean hasBlockBaseHitboxes(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 UpdateBlockHitboxes toObject(MemorySegment var0) {
class="kw">return toObject(var0, 0, null);
}
class="kw">public class="kw">static UpdateBlockHitboxes toObject(MemorySegment var0, int var1) {
class="kw">return toObject(var0, var1, null);
}
class="kw">public class="kw">static UpdateBlockHitboxes toObject(MemorySegment var0, int var1, @Nullable ReadCursor var2) {
requireBounds(var0, var1);
int var3 = var1 + 6;
int var4 = 0;
Map var5 = null;
if (hasBlockBaseHitboxes(var0, var1)) {
int var6 = var3 + var4;
long var7 = VarInt.getWithLength(var0, var6);
if (var7 == -1L) {
throw ProtocolException.invalidVarInt("BlockBaseHitboxes");
}
int var9 = (int)var7;
if (var9 > 4096000) {
throw ProtocolException.dictionaryTooLarge("BlockBaseHitboxes", var9, 4096000);
}
var6 += (int)(var7 >>> 32);
if (var6 + var9 * 5L > var0.byteSize()) {
throw ProtocolException.bufferTooSmall("BlockBaseHitboxes", (int)Math.min(var6 + var9 * 5L, 2147483647L), (int)var0.byteSize());
}
var5 = new HashMap<>(var9);
for (int var10 = 0; var10 < var9; var10++) {
int var11 = var0.get(PacketIO.PROTO_INT, var6);
var6 += 4;
long var12 = VarInt.getWithLength(var0, var6);
if (var12 == -1L) {
throw ProtocolException.invalidVarInt("value");
}
int var14 = (int)var12;
int var15 = (int)(var12 >>> 32);
if (var14 > 4096000) {
throw ProtocolException.arrayTooLong("value", var14, 4096000);
}
if (var6 + var15 + var14 * 24L > var0.byteSize()) {
throw ProtocolException.bufferTooSmall("value", var6 + var15 + var14 * 24, (int)var0.byteSize());
}
var6 += var15;
Hitbox[] var16 = new Hitbox[var14];
for (int var17 = 0; var17 < var14; var17++) {
var16[var17] = Hitbox.toObject(var0, var6);
var6 += 24;
}
if (var5.put(var11, var16) != null) {
throw ProtocolException.duplicateKey("BlockBaseHitboxes", var11);
}
}
var4 = var6 - var3;
}
UpdateBlockHitboxes var20 = new UpdateBlockHitboxes(
UpdateType.fromValue(var0.get(PacketIO.PROTO_BYTE, var1 + 1)), var0.get(PacketIO.PROTO_INT, var1 + 2), var5
);
if (var2 != null) {
var2.position = var3 + var4;
}
class="kw">return var20;
}
@Override
class="kw">public int serialize(@Nonnull MemorySegment var1, int var2) {
byte var3 = 0;
if (this.blockBaseHitboxes != null) {
var3 = (byte)(var3 | 1);
}
var1.set(PacketIO.PROTO_BYTE, var2 + 0, var3);
var1.set(PacketIO.PROTO_BYTE, var2 + 1, (byte)this.type.getValue());
var1.set(PacketIO.PROTO_INT, var2 + 2, this.maxId);
int var4 = var2 + 6;
if (this.blockBaseHitboxes != null) {
if (this.blockBaseHitboxes.size() > 4096000) {
throw ProtocolException.dictionaryTooLarge("BlockBaseHitboxes", this.blockBaseHitboxes.size(), 4096000);
}
var4 += VarInt.set(var1, var4, this.blockBaseHitboxes.size());
for (Entry var6 : this.blockBaseHitboxes.entrySet()) {
var1.set(PacketIO.PROTO_INT, var4, var6.getKey());
var4 += 4;
var4 += VarInt.set(var1, var4, var6.getValue().length);
for (Hitbox var10 : var6.getValue()) {
var4 += var10.serialize(var1, var4);
}
}
}
class="kw">return var4 - var2;
}
@Override
class="kw">public int computeSize() {
int var1 = 6;
if (this.blockBaseHitboxes != null) {
int var2 = 0;
for (Entry var4 : this.blockBaseHitboxes.entrySet()) {
var2 += 4 + VarInt.size(var4.getValue().length) + ((Hitbox[])var4.getValue()).length * 24;
}
var1 += VarInt.size(this.blockBaseHitboxes.size()) + var2;
}
class="kw">return var1;
}
class="kw">public UpdateBlockHitboxes clone() {
UpdateBlockHitboxes var1 = new UpdateBlockHitboxes();
var1.type = this.type;
var1.maxId = this.maxId;
if (this.blockBaseHitboxes != null) {
Map var2 = new HashMap<>();
for (Entry var4 : this.blockBaseHitboxes.entrySet()) {
var2.put(var4.getKey(), Arrays.stream(var4.getValue()).map(var0 -> var0.clone()).toArray(Hitbox[]::new));
}
var1.blockBaseHitboxes = var2;
}
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 UpdateBlockHitboxes var2)
? false
: Objects.equals(this.type, var2.type) && this.maxId == var2.maxId && Objects.equals(this.blockBaseHitboxes, var2.blockBaseHitboxes);
}
}
@Override
class="kw">public int hashCode() {
class="kw">return Objects.hash(this.type, this.maxId, this.blockBaseHitboxes);
}
}