ItemSoundSetPacketGenerator class

Пакет: com.hypixel.hytale.server.core.asset.type.itemsound

Файл: com/hypixel/hytale/server/core/asset/type/itemsound/ItemSoundSetPacketGenerator.java

extends: SimpleAssetPacketGenerator<String, ItemSoundSet, IndexedLookupTableAssetMap<String, ItemSoundSet>>

Поля (8)

МодификаторыТипИмя
UpdateItemSoundSets var3
UpdateItemSoundSets var3
UpdateItemSoundSets var3
String var6
String var6
int var6
int var7
int var7

Методы (6)

МодификаторыВозвратСигнатура
abstract throw new IllegalArgumentExceptionthrow new IllegalArgumentException("Unknown key! " + var6)
abstract throw new IllegalArgumentExceptionthrow new IllegalArgumentException("Unknown key! " + var5)
for for(String var5 : var2)
if if(var7 == Integer.MIN_VALUE)
if if(var7 == Integer.MIN_VALUE)
if if(var6 == Integer.MIN_VALUE)

Исходный код

Показать/скрыть
class="kw">package com.hypixel.hytale.server.core.asset.type.itemsound;

class="kw">import com.hypixel.hytale.assetstore.map.IndexedLookupTableAssetMap;
class="kw">import com.hypixel.hytale.protocol.ToClientPacket;
class="kw">import com.hypixel.hytale.protocol.UpdateType;
class="kw">import com.hypixel.hytale.protocol.packets.assets.UpdateItemSoundSets;
class="kw">import com.hypixel.hytale.server.core.asset.packet.SimpleAssetPacketGenerator;
class="kw">import com.hypixel.hytale.server.core.asset.type.itemsound.config.ItemSoundSet;
class="kw">import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap;
class="kw">import java.util.Map;
class="kw">import java.util.Set;
class="kw">import java.util.Map.Entry;
class="kw">import javax.annotation.Nonnull;

class="kw">public class ItemSoundSetPacketGenerator class="kw">extends SimpleAssetPacketGenerator<String, ItemSoundSet, IndexedLookupTableAssetMap<String, ItemSoundSet>> {
   class="kw">public ItemSoundSetPacketGenerator() {
   }

   @Nonnull
   class="kw">public ToClientPacket generateInitPacket(@Nonnull IndexedLookupTableAssetMap<String, ItemSoundSet> var1, @Nonnull Map<String, ItemSoundSet> var2) {
      UpdateItemSoundSets var3 = new UpdateItemSoundSets();
      var3.type = UpdateType.Init;
      var3.itemSoundSets = new Int2ObjectOpenHashMap();

      for (Entry var5 : var2.entrySet()) {
         String var6 = var5.getKey();
         int var7 = var1.getIndex(var6);
         if (var7 == Integer.MIN_VALUE) {
            throw new IllegalArgumentException("Unknown key! " + var6);
         }

         var3.itemSoundSets.put(var7, var5.getValue().toPacket());
      }

      var3.maxId = var1.getNextIndex();
      class="kw">return var3;
   }

   @Nonnull
   class="kw">public ToClientPacket generateUpdatePacket(@Nonnull IndexedLookupTableAssetMap<String, ItemSoundSet> var1, @Nonnull Map<String, ItemSoundSet> var2) {
      UpdateItemSoundSets var3 = new UpdateItemSoundSets();
      var3.type = UpdateType.AddOrUpdate;
      var3.itemSoundSets = new Int2ObjectOpenHashMap();

      for (Entry var5 : var2.entrySet()) {
         String var6 = var5.getKey();
         int var7 = var1.getIndex(var6);
         if (var7 == Integer.MIN_VALUE) {
            throw new IllegalArgumentException("Unknown key! " + var6);
         }

         var3.itemSoundSets.put(var7, var5.getValue().toPacket());
      }

      var3.maxId = var1.getNextIndex();
      class="kw">return var3;
   }

   @Nonnull
   class="kw">public ToClientPacket generateRemovePacket(@Nonnull IndexedLookupTableAssetMap<String, ItemSoundSet> var1, @Nonnull Set<String> var2) {
      UpdateItemSoundSets var3 = new UpdateItemSoundSets();
      var3.type = UpdateType.Remove;
      var3.itemSoundSets = new Int2ObjectOpenHashMap();

      for (String var5 : var2) {
         int var6 = var1.getIndex(var5);
         if (var6 == Integer.MIN_VALUE) {
            throw new IllegalArgumentException("Unknown key! " + var5);
         }

         var3.itemSoundSets.put(var6, null);
      }

      var3.maxId = var1.getNextIndex();
      class="kw">return var3;
   }
}