UpdateItemSoundSets class

Пакет: com.hypixel.hytale.protocol.packets.assets

Файл: com/hypixel/hytale/protocol/packets/assets/UpdateItemSoundSets.java

implements: Packet, ToClientPacket

Поля (31)

МодификаторыТипИмя
final int PACKET_ID
int var1
UpdateItemSoundSets var1
ItemSoundSet var10
int var10
int var12
ItemSoundSet var13
UpdateItemSoundSets var16
long var2
ReadCursor var2
byte var2
int var2
Map var2
int var3
var3
int var3
byte var3
var3
long var4
int var4
var4
int var4
ReadCursor var5
int var6
Map var6
var6
Map var7
int var7
var7
long var8
int var9

Методы (29)

МодификаторыВозвратСигнатура
public UpdateItemSoundSets cloneUpdateItemSoundSets clone()
for for(int var8 = 0; var8 < var6; var8++)
for for(int var11 = 0; var11 < var10; var11++)
abstract return getItemSoundSetsreturn getItemSoundSets(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 hasItemSoundSetsboolean hasItemSoundSets(MemorySegment var0, int var1)
if if(var1 < 0)
if if(var4 == -1L)
if if(var6 > 4096000)
if if(var8 == -1L)
if if(var10 > 4096000)
if if(var2 != null)
if if(this.itemSoundSets != null)
if if(this.itemSoundSets != null)
if if(this.itemSoundSets != null)
if if(this.itemSoundSets != null)
if if(this == var1)
static void requireBoundsvoid requireBounds(MemorySegment var0, int var1)
abstract requireBounds requireBounds(var0, var1)
static UpdateItemSoundSets toObjectUpdateItemSoundSets toObject(MemorySegment var0)
static UpdateItemSoundSets toObjectUpdateItemSoundSets toObject(MemorySegment var0, int var1)
static UpdateItemSoundSets toObjectUpdateItemSoundSets 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.ItemSoundSet;
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.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 UpdateItemSoundSets class="kw">implements Packet, ToClientPacket {
   class="kw">public class="kw">static class="kw">final int PACKET_ID = 43;
   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, ItemSoundSet> itemSoundSets;

   @Override
   class="kw">public int getId() {
      class="kw">return 43;
   }

   @Override
   class="kw">public NetworkChannel getChannel() {
      class="kw">return NetworkChannel.Default;
   }

   class="kw">public UpdateItemSoundSets() {
   }

   class="kw">public UpdateItemSoundSets(@Nonnull UpdateType var1, int var2, @Nullable Map<Integer, ItemSoundSet> var3) {
      this.type = var1;
      this.maxId = var2;
      this.itemSoundSets = var3;
   }

   class="kw">public UpdateItemSoundSets(@Nonnull UpdateItemSoundSets var1) {
      this.type = var1.type;
      this.maxId = var1.maxId;
      this.itemSoundSets = var1.itemSoundSets;
   }

   class="kw">public class="kw">static void requireBounds(MemorySegment var0, int var1) {
      if (var1 < 0) {
         throw ProtocolException.invalidOffset("UpdateItemSoundSets", var1, (int)var0.byteSize());
      }

      long var2 = var1 + 6L;
      if (var2 > var0.byteSize()) {
         throw ProtocolException.bufferTooSmall("UpdateItemSoundSets", (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, ItemSoundSet> getItemSoundSets(MemorySegment var0) {
      class="kw">return getItemSoundSets(var0, 0);
   }

   @Nullable
   class="kw">public class="kw">static Map<Integer, ItemSoundSet> getItemSoundSets(MemorySegment var0, int var1) {
      if (!hasItemSoundSets(var0, var1)) {
         class="kw">return null;
      }

      ReadCursor var2 = new ReadCursor();
      int var3 = var1 + 6;
      long var4 = VarInt.getWithLength(var0, var3);
      if (var4 == -1L) {
         throw ProtocolException.invalidVarInt("ItemSoundSets");
      }

      int var6 = (int)var4;
      if (var6 > 4096000) {
         throw ProtocolException.dictionaryTooLarge("ItemSoundSets", var6, 4096000);
      }

      var3 += (int)(var4 >>> 32);
      if (var3 + var6 * 13L > var0.byteSize()) {
         throw ProtocolException.bufferTooSmall("ItemSoundSets", (int)Math.min(var3 + var6 * 13L, 2147483647L), (int)var0.byteSize());
      }

      Map var7 = new HashMap<>(var6);

      for (int var8 = 0; var8 < var6; var8++) {
         int var9 = var0.get(PacketIO.PROTO_INT, var3);
         var3 += 4;
         ItemSoundSet var10 = ItemSoundSet.toObject(var0, var3, var2);
         var3 = var2.position;
         if (var7.put(var9, var10) != null) {
            throw ProtocolException.duplicateKey("ItemSoundSets", var9);
         }
      }

      class="kw">return var7;
   }

   class="kw">public class="kw">static boolean hasItemSoundSets(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 UpdateItemSoundSets toObject(MemorySegment var0) {
      class="kw">return toObject(var0, 0, null);
   }

   class="kw">public class="kw">static UpdateItemSoundSets toObject(MemorySegment var0, int var1) {
      class="kw">return toObject(var0, var1, null);
   }

   class="kw">public class="kw">static UpdateItemSoundSets toObject(MemorySegment var0, int var1, @Nullable ReadCursor var2) {
      requireBounds(var0, var1);
      int var3 = var1 + 6;
      int var4 = 0;
      ReadCursor var5 = var2 != null ? var2 : new ReadCursor();
      Map var6 = null;
      if (hasItemSoundSets(var0, var1)) {
         int var7 = var3 + var4;
         long var8 = VarInt.getWithLength(var0, var7);
         if (var8 == -1L) {
            throw ProtocolException.invalidVarInt("ItemSoundSets");
         }

         int var10 = (int)var8;
         if (var10 > 4096000) {
            throw ProtocolException.dictionaryTooLarge("ItemSoundSets", var10, 4096000);
         }

         var7 += (int)(var8 >>> 32);
         if (var7 + var10 * 13L > var0.byteSize()) {
            throw ProtocolException.bufferTooSmall("ItemSoundSets", (int)Math.min(var7 + var10 * 13L, 2147483647L), (int)var0.byteSize());
         }

         var6 = new HashMap<>(var10);

         for (int var11 = 0; var11 < var10; var11++) {
            int var12 = var0.get(PacketIO.PROTO_INT, var7);
            var7 += 4;
            ItemSoundSet var13 = ItemSoundSet.toObject(var0, var7, var5);
            var7 = var5.position;
            if (var6.put(var12, var13) != null) {
               throw ProtocolException.duplicateKey("ItemSoundSets", var12);
            }
         }

         var4 = var7 - var3;
      }

      UpdateItemSoundSets var16 = new UpdateItemSoundSets(
         UpdateType.fromValue(var0.get(PacketIO.PROTO_BYTE, var1 + 1)), var0.get(PacketIO.PROTO_INT, var1 + 2), var6
      );
      if (var2 != null) {
         var2.position = var3 + var4;
      }

      class="kw">return var16;
   }

   @Override
   class="kw">public int serialize(@Nonnull MemorySegment var1, int var2) {
      byte var3 = 0;
      if (this.itemSoundSets != 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.itemSoundSets != null) {
         if (this.itemSoundSets.size() > 4096000) {
            throw ProtocolException.dictionaryTooLarge("ItemSoundSets", this.itemSoundSets.size(), 4096000);
         }

         var4 += VarInt.set(var1, var4, this.itemSoundSets.size());

         for (Entry var6 : this.itemSoundSets.entrySet()) {
            var1.set(PacketIO.PROTO_INT, var4, var6.getKey());
            var4 += 4;
            var4 += var6.getValue().serialize(var1, var4);
         }
      }

      class="kw">return var4 - var2;
   }

   @Override
   class="kw">public int computeSize() {
      int var1 = 6;
      if (this.itemSoundSets != null) {
         int var2 = 0;

         for (Entry var4 : this.itemSoundSets.entrySet()) {
            var2 += 4 + var4.getValue().computeSize();
         }

         var1 += VarInt.size(this.itemSoundSets.size()) + var2;
      }

      class="kw">return var1;
   }

   class="kw">public UpdateItemSoundSets clone() {
      UpdateItemSoundSets var1 = new UpdateItemSoundSets();
      var1.type = this.type;
      var1.maxId = this.maxId;
      if (this.itemSoundSets != null) {
         Map var2 = new HashMap<>();

         for (Entry var4 : this.itemSoundSets.entrySet()) {
            var2.put(var4.getKey(), var4.getValue().clone());
         }

         var1.itemSoundSets = 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 UpdateItemSoundSets var2)
            ? false
            : Objects.equals(this.type, var2.type) && this.maxId == var2.maxId && Objects.equals(this.itemSoundSets, var2.itemSoundSets);
      }
   }

   @Override
   class="kw">public int hashCode() {
      class="kw">return Objects.hash(this.type, this.maxId, this.itemSoundSets);
   }
}