BlockSoundSet class
Пакет: com.hypixel.hytale.protocol
Файл: com/hypixel/hytale/protocol/BlockSoundSet.java
Поля (35)
| Модификаторы | Тип | Имя |
|---|---|---|
final |
int |
NULLABLE_BIT_FIELD_SIZE |
|
int |
var1 |
|
BlockSoundSet |
var1 |
|
int |
var10 |
|
BlockSoundEvent |
var12 |
|
int |
var13 |
|
Map |
var14 |
|
|
var14 |
|
int |
var15 |
|
BlockSoundSet |
var18 |
|
long |
var2 |
|
int |
var2 |
|
byte |
var2 |
|
byte |
var2 |
|
byte |
var2 |
|
long |
var3 |
|
int |
var3 |
|
byte |
var3 |
|
|
var3 |
|
|
var3 |
|
|
var3 |
|
int |
var4 |
|
int |
var4 |
|
|
var4 |
|
int |
var4 |
|
int |
var5 |
|
int |
var5 |
|
String |
var5 |
|
|
var5 |
|
Map |
var6 |
|
int |
var6 |
|
long |
var7 |
|
BlockSoundEvent |
var8 |
|
long |
var8 |
|
int |
var9 |
Методы (40)
| Модификаторы | Возврат | Сигнатура |
|---|---|---|
public |
BlockSoundSet |
cloneBlockSoundSet clone() |
public |
int |
computeSizeint computeSize() |
|
|
for for(int var7 = 0; var7 < var5; var7++) |
|
|
for for(int var11 = 0; var11 < var10; var11++) |
abstract |
return |
getIdreturn getId(var0, 0) |
abstract |
return |
getMoveInRepeatRangereturn getMoveInRepeatRange(var0, 0) |
abstract |
return |
getSoundEventIndicesreturn getSoundEventIndices(var0, 0) |
static |
int |
getValidatedOffsetint getValidatedOffset(MemorySegment var0, int var1, int var2, int var3, String var4) |
static |
boolean |
hasIdboolean hasId(MemorySegment var0, int var1) |
static |
boolean |
hasMoveInRepeatRangeboolean hasMoveInRepeatRange(MemorySegment var0, int var1) |
static |
boolean |
hasSoundEventIndicesboolean hasSoundEventIndices(MemorySegment var0, int var1) |
|
|
if if(var1 < 0) |
|
|
if if(var3 == -1L) |
|
|
if if(var5 > 4096000) |
|
|
if if(var4 != var2) |
|
|
if if(var8 == -1L) |
|
|
if if(var10 > 4096000) |
|
|
if if(var2 != null) |
|
|
if if(this.moveInRepeatRange != null) |
|
|
if if(this.id != null) |
|
|
if if(this.soundEventIndices != null) |
|
|
if if(this.moveInRepeatRange != null) |
|
|
if if(this.id != null) |
|
|
if if(this.soundEventIndices != null) |
|
|
if if(this.id != null) |
|
|
if if(this.soundEventIndices != 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 + 9, var4, "Id") |
abstract |
|
requireSlot requireSlot(var0, var1 + 9, -1, "Id") |
abstract |
|
requireSlot requireSlot(var0, var1 + 13, var4, "SoundEventIndices") |
abstract |
|
requireSlot requireSlot(var0, var1 + 13, -1, "SoundEventIndices") |
public |
int |
serializeint serialize(@Nonnull MemorySegment var1, int var2) |
static |
BlockSoundSet |
toObjectBlockSoundSet toObject(MemorySegment var0) |
static |
BlockSoundSet |
toObjectBlockSoundSet toObject(MemorySegment var0, int var1) |
static |
BlockSoundSet |
toObjectBlockSoundSet 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 BlockSoundSet {
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 = 9;
class="kw">public class="kw">static class="kw">final int VARIABLE_FIELD_COUNT = 2;
class="kw">public class="kw">static class="kw">final int VARIABLE_BLOCK_START = 17;
class="kw">public class="kw">static class="kw">final int MAX_SIZE = 36864027;
@Nullable
class="kw">public String id;
@Nullable
class="kw">public Map<BlockSoundEvent, Integer> soundEventIndices;
@Nullable
class="kw">public FloatRange moveInRepeatRange;
class="kw">public BlockSoundSet() {
}
class="kw">public BlockSoundSet(@Nullable String var1, @Nullable Map<BlockSoundEvent, Integer> var2, @Nullable FloatRange var3) {
this.id = var1;
this.soundEventIndices = var2;
this.moveInRepeatRange = var3;
}
class="kw">public BlockSoundSet(@Nonnull BlockSoundSet var1) {
this.id = var1.id;
this.soundEventIndices = var1.soundEventIndices;
this.moveInRepeatRange = var1.moveInRepeatRange;
}
class="kw">public class="kw">static void requireBounds(MemorySegment var0, int var1) {
if (var1 < 0) {
throw ProtocolException.invalidOffset("BlockSoundSet", var1, (int)var0.byteSize());
}
long var2 = var1 + 17L;
if (var2 > var0.byteSize()) {
throw ProtocolException.bufferTooSmall("BlockSoundSet", (int)Math.min(var2, 2147483647L), (int)var0.byteSize());
}
}
@Nullable
class="kw">public class="kw">static String getId(MemorySegment var0) {
class="kw">return getId(var0, 0);
}
@Nullable
class="kw">public class="kw">static String getId(MemorySegment var0, int var1) {
class="kw">return hasId(var0, var1) ? PacketIO.readVarString("Id", var0, var1 + getValidatedOffset(var0, var1, 9, 17, "Id"), 4096000) : null;
}
@Nullable
class="kw">public class="kw">static Map<BlockSoundEvent, Integer> getSoundEventIndices(MemorySegment var0) {
class="kw">return getSoundEventIndices(var0, 0);
}
@Nullable
class="kw">public class="kw">static Map<BlockSoundEvent, Integer> getSoundEventIndices(MemorySegment var0, int var1) {
if (!hasSoundEventIndices(var0, var1)) {
class="kw">return null;
}
int var2 = var1 + getValidatedOffset(var0, var1, 13, 17, "SoundEventIndices");
long var3 = VarInt.getWithLength(var0, var2);
if (var3 == -1L) {
throw ProtocolException.invalidVarInt("SoundEventIndices");
}
int var5 = (int)var3;
if (var5 > 4096000) {
throw ProtocolException.dictionaryTooLarge("SoundEventIndices", var5, 4096000);
}
var2 += (int)(var3 >>> 32);
if (var2 + var5 * 5L > var0.byteSize()) {
throw ProtocolException.bufferTooSmall("SoundEventIndices", (int)Math.min(var2 + var5 * 5L, 2147483647L), (int)var0.byteSize());
}
Map var6 = new HashMap<>(var5);
for (int var7 = 0; var7 < var5; var7++) {
BlockSoundEvent var8 = BlockSoundEvent.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("SoundEventIndices", var8);
}
}
class="kw">return var6;
}
@Nullable
class="kw">public class="kw">static FloatRange getMoveInRepeatRange(MemorySegment var0) {
class="kw">return getMoveInRepeatRange(var0, 0);
}
@Nullable
class="kw">public class="kw">static FloatRange getMoveInRepeatRange(MemorySegment var0, int var1) {
class="kw">return hasMoveInRepeatRange(var0, var1) ? FloatRange.toObject(var0, var1 + 1) : null;
}
class="kw">public class="kw">static boolean hasMoveInRepeatRange(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 hasId(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 hasSoundEventIndices(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 BlockSoundSet toObject(MemorySegment var0) {
class="kw">return toObject(var0, 0, null);
}
class="kw">public class="kw">static BlockSoundSet toObject(MemorySegment var0, int var1) {
class="kw">return toObject(var0, var1, null);
}
class="kw">public class="kw">static BlockSoundSet toObject(MemorySegment var0, int var1, @Nullable ReadCursor var2) {
requireBounds(var0, var1);
int var3 = var1 + 17;
int var4 = 0;
String var5 = null;
if (hasId(var0, var1)) {
requireSlot(var0, var1 + 9, var4, "Id");
int var6 = var3 + var4;
long var7 = VarInt.getWithLength(var0, var6);
var5 = PacketIO.readVarString("Id", var0, var6, 0, 4096000, var7);
var4 += (int)var7 + (int)(var7 >>> 32);
} else {
requireSlot(var0, var1 + 9, -1, "Id");
}
Map var14 = null;
if (hasSoundEventIndices(var0, var1)) {
requireSlot(var0, var1 + 13, var4, "SoundEventIndices");
int var15 = var3 + var4;
long var8 = VarInt.getWithLength(var0, var15);
if (var8 == -1L) {
throw ProtocolException.invalidVarInt("SoundEventIndices");
}
int var10 = (int)var8;
if (var10 > 4096000) {
throw ProtocolException.dictionaryTooLarge("SoundEventIndices", var10, 4096000);
}
var15 += (int)(var8 >>> 32);
if (var15 + var10 * 5L > var0.byteSize()) {
throw ProtocolException.bufferTooSmall("SoundEventIndices", (int)Math.min(var15 + var10 * 5L, 2147483647L), (int)var0.byteSize());
}
var14 = new HashMap<>(var10);
for (int var11 = 0; var11 < var10; var11++) {
BlockSoundEvent var12 = BlockSoundEvent.fromValue(var0.get(PacketIO.PROTO_BYTE, var15));
int var13 = var0.get(PacketIO.PROTO_INT, ++var15);
var15 += 4;
if (var14.put(var12, var13) != null) {
throw ProtocolException.duplicateKey("SoundEventIndices", var12);
}
}
var4 = var15 - var3;
} else {
requireSlot(var0, var1 + 13, -1, "SoundEventIndices");
}
BlockSoundSet var18 = new BlockSoundSet(var5, var14, hasMoveInRepeatRange(var0, var1) ? FloatRange.toObject(var0, var1 + 1) : null);
if (var2 != null) {
var2.position = var3 + var4;
}
class="kw">return var18;
}
class="kw">public int serialize(@Nonnull MemorySegment var1, int var2) {
byte var3 = 0;
if (this.moveInRepeatRange != null) {
var3 = (byte)(var3 | 1);
}
if (this.id != null) {
var3 = (byte)(var3 | 2);
}
if (this.soundEventIndices != null) {
var3 = (byte)(var3 | 4);
}
var1.set(PacketIO.PROTO_BYTE, var2 + 0, var3);
if (this.moveInRepeatRange != null) {
this.moveInRepeatRange.serialize(var1, var2 + 1);
} else {
var1.asSlice(var2 + 1, 8L).fill((byte)0);
}
int var4 = var2 + 17;
if (this.id != null) {
var1.set(PacketIO.PROTO_INT, var2 + 9, var4 - var2 - 17);
var4 += PacketIO.writeVarString(var1, var4, this.id, 4096000);
} else {
var1.set(PacketIO.PROTO_INT, var2 + 9, -1);
}
if (this.soundEventIndices != null) {
var1.set(PacketIO.PROTO_INT, var2 + 13, var4 - var2 - 17);
if (this.soundEventIndices.size() > 4096000) {
throw ProtocolException.dictionaryTooLarge("SoundEventIndices", this.soundEventIndices.size(), 4096000);
}
var4 += VarInt.set(var1, var4, this.soundEventIndices.size());
for (Entry var6 : this.soundEventIndices.entrySet()) {
var1.set(PacketIO.PROTO_BYTE, var4, (byte)var6.getKey().getValue());
var1.set(PacketIO.PROTO_INT, ++var4, var6.getValue());
var4 += 4;
}
} else {
var1.set(PacketIO.PROTO_INT, var2 + 13, -1);
}
class="kw">return var4 - var2;
}
class="kw">public int computeSize() {
int var1 = 17;
if (this.id != null) {
var1 += PacketIO.stringSize(this.id);
}
if (this.soundEventIndices != null) {
var1 += VarInt.size(this.soundEventIndices.size()) + this.soundEventIndices.size() * 5;
}
class="kw">return var1;
}
class="kw">public BlockSoundSet clone() {
BlockSoundSet var1 = new BlockSoundSet();
var1.id = this.id;
var1.soundEventIndices = this.soundEventIndices != null ? new HashMap<>(this.soundEventIndices) : null;
var1.moveInRepeatRange = this.moveInRepeatRange != null ? this.moveInRepeatRange.clone() : 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 BlockSoundSet var2)
? false
: Objects.equals(this.id, var2.id)
&& Objects.equals(this.soundEventIndices, var2.soundEventIndices)
&& Objects.equals(this.moveInRepeatRange, var2.moveInRepeatRange);
}
}
@Override
class="kw">public int hashCode() {
class="kw">return Objects.hash(this.id, this.soundEventIndices, this.moveInRepeatRange);
}
}