InventoryComponent class

Пакет: com.hypixel.hytale.server.core.inventory

Файл: com/hypixel/hytale/server/core/inventory/InventoryComponent.java

implements: Component<EntityStore>

Поля (53)

МодификаторыТипИмя
ARMOR_HOTBAR_UTILITY_STORAGE
BACKPACK_HOTBAR_STORAGE
BACKPACK_STORAGE_HOTBAR
public static final BuilderCodec<InventoryComponent.Armor> CODEC
public static final BuilderCodec<InventoryComponent.Backpack> CODEC
public static final BuilderCodec<InventoryComponent.Hotbar> CODEC
public static final BuilderCodec<InventoryComponent.Storage> CODEC
public static final BuilderCodec<InventoryComponent.Tool> CODEC
public static final BuilderCodec<InventoryComponent.Utility> CODEC
EVERYTHING
HOTBAR_FIRST
HOTBAR_STORAGE_BACKPACK
HOTBAR_UTILITY_CONSUMABLE_STORAGE
final byte INACTIVE_SLOT_INDEX
STORAGE_FIRST
STORAGE_HOTBAR_BACKPACK
private final Object2ObjectOpenCustomHashMap<ComponentType[], CombinedItemContainer> inventories
protected boolean outdatedEquipment
protected boolean outdatedEquipment
protected boolean outdatedEquipment
protected boolean usingToolsItem
InventoryComponent.Tool var1
boolean var1
InventoryComponent.Armor var1
InventoryComponent.Backpack var1
boolean var1
InventoryComponent.Hotbar var1
InventoryComponent.Storage var1
InventoryComponent.Tool var1
boolean var1
InventoryComponent.Utility var1
InventoryComponent var13
CombinedItemContainer var14
var14
InventoryComponent var14
int var16
ItemContainer[] var16
ItemContainer[] var17
int var17
int var18
InventoryComponent.Tool var2
InventoryComponent.Hotbar var2
InventoryComponent.Combined var3
var3
InventoryComponent.Hotbar var3
InventoryComponent.Combined var4
var4
InventoryComponent.Combined var5
CombinedItemContainer var5
var5
Archetype var6
int var6
Archetype var7

Методы (82)

МодификаторыВозвратСигнатура
public Armorpublic Armor()
public Armorpublic Armor(short var1)
public Armorpublic Armor(ItemContainer var1)
public Backpackpublic Backpack()
public Backpackpublic Backpack(short var1)
public Backpackpublic Backpack(ItemContainer var1)
public Combinedpublic Combined()
public Hotbarpublic Hotbar()
public Hotbarpublic Hotbar(short var1)
public Hotbarpublic Hotbar(ItemContainer var1, byte var2)
public Storagepublic Storage()
public Storagepublic Storage(short var1)
public Storagepublic Storage(ItemContainer var1)
public Toolpublic Tool()
public Toolpublic Tool(short var1)
public Toolpublic Tool(ItemContainer var1, byte var2)
public Utilitypublic Utility()
public Utilitypublic Utility(short var1)
public Utilitypublic Utility(ItemContainer var1, byte var2)
private void afterDecodeprivate void afterDecode()
private void afterDecodeprivate void afterDecode()
protected void clampActiveSlotprotected void clampActiveSlot()
public Component<EntityStore> clonepublic Component<EntityStore> clone()
public Component<EntityStore> clonepublic Component<EntityStore> clone()
public Component<EntityStore> clonepublic Component<EntityStore> clone()
public Component<EntityStore> clonepublic Component<EntityStore> clone()
public Component<EntityStore> clonepublic Component<EntityStore> clone()
public Component<EntityStore> clonepublic Component<EntityStore> clone()
public Component<EntityStore> clonepublic Component<EntityStore> clone()
public boolean consumeIsDirtyboolean consumeIsDirty()
public boolean consumeNeedsSavingboolean consumeNeedsSaving()
public boolean consumeOutdatedEquipmentpublic boolean consumeOutdatedEquipment()
public boolean consumeOutdatedEquipmentpublic boolean consumeOutdatedEquipment()
public boolean consumeOutdatedEquipmentpublic boolean consumeOutdatedEquipment()
public void ensureCapacityvoid ensureCapacity(short var1, @Nonnull List<ItemStack> var2)
public void ensureCapacitypublic void ensureCapacity(short var1, @Nonnull List<ItemStack> var2)
public void ensureCapacitypublic void ensureCapacity(short var1, @Nonnull List<ItemStack> var2)
public boolean equalspublic boolean equals(ComponentType[] var1, ComponentType[] var2)
for for(ComponentType var10 : var2)
for for(ComponentType var12 : var2)
for for(ComponentType var11 : var3)
for for(ComponentType var13 : var3)
public ConcurrentLinkedQueue<ItemContainer.ItemContainerChangeEvent> getChangeEventsConcurrentLinkedQueue<ItemContainer.ItemContainerChangeEvent> getChangeEvents()
public static ComponentType<EntityStore, InventoryComponent.Armor> getComponentTypepublic static ComponentType<EntityStore, InventoryComponent.Armor> getComponentType()
public static ComponentType<EntityStore, InventoryComponent.Backpack> getComponentTypepublic static ComponentType<EntityStore, InventoryComponent.Backpack> getComponentType()
public static ComponentType<EntityStore, InventoryComponent.Combined> getComponentTypepublic static ComponentType<EntityStore, InventoryComponent.Combined> getComponentType()
public static ComponentType<EntityStore, InventoryComponent.Hotbar> getComponentTypepublic static ComponentType<EntityStore, InventoryComponent.Hotbar> getComponentType()
public static ComponentType<EntityStore, InventoryComponent.Storage> getComponentTypepublic static ComponentType<EntityStore, InventoryComponent.Storage> getComponentType()
public static ComponentType<EntityStore, InventoryComponent.Tool> getComponentTypepublic static ComponentType<EntityStore, InventoryComponent.Tool> getComponentType()
public static ComponentType<EntityStore, InventoryComponent.Utility> getComponentTypepublic static ComponentType<EntityStore, InventoryComponent.Utility> getComponentType()
public Object2ObjectOpenCustomHashMap<ComponentType[], CombinedItemContainer> getInventoriespublic Object2ObjectOpenCustomHashMap<ComponentType[], CombinedItemContainer> getInventories()
public ItemContainer getInventoryItemContainer getInventory()
public int getSectionIdpublic int getSectionId()
public int getSectionIdpublic int getSectionId()
public int getSectionIdpublic int getSectionId()
public int hashCodepublic int hashCode(ComponentType[] var1)
if if(var1 > 0)
if if(this.inventory != EmptyItemContainer.INSTANCE)
if if(this.changeEvent != null)
if if(var0 >= 0)
if if(var3 == null)
if if(var0 instanceof Store var4)
if if(var14 != null)
if if(var13 != null)
if if(var4 == null)
if if(var5 != null)
if if(var14 != null)
if if(var1 > 0)
public boolean isUsingToolsItempublic boolean isUsingToolsItem()
protected void markChangedvoid markChanged()
public void markDirtyvoid markDirty()
private void postDecodevoid postDecode()
protected void registerChangeEventvoid registerChangeEvent()
public void resizepublic void resize(short var1, @Nullable List<ItemStack> var2)
public void setOutdatedEquipmentpublic void setOutdatedEquipment(boolean var1)
public void setOutdatedEquipmentpublic void setOutdatedEquipment(boolean var1)
public void setOutdatedEquipmentpublic void setOutdatedEquipment(boolean var1)
public void setUsingToolsItempublic void setUsingToolsItem(boolean var1)
static void setupCombinedvoid setupCombined(@Nonnull ComponentType<EntityStore, InventoryComponent.Storage> var0, @Nonnull ComponentType<EntityStore, InventoryComponent.Armor> var1, @Nonnull ComponentType<EntityStore, InventoryComponent.Hotbar> var2, @Nonnull ComponentType<EntityStore, InventoryComponent.Utility> var3, @Nonnull ComponentType<EntityStore, InventoryComponent.Backpack> var4, @Nonnull ComponentType<EntityStore, InventoryComponent.Tool> var5)
abstract super super(var1)
return switchreturn switch(var0)
protected void unregisterChangeEventvoid unregisterChangeEvent()

Исходный код

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

class="kw">import com.hypixel.hytale.codec.KeyedCodec;
class="kw">import com.hypixel.hytale.codec.builder.BuilderCodec;
class="kw">import com.hypixel.hytale.component.Archetype;
class="kw">import com.hypixel.hytale.component.ArchetypeChunk;
class="kw">import com.hypixel.hytale.component.CommandBuffer;
class="kw">import com.hypixel.hytale.component.Component;
class="kw">import com.hypixel.hytale.component.ComponentAccessor;
class="kw">import com.hypixel.hytale.component.ComponentType;
class="kw">import com.hypixel.hytale.component.Holder;
class="kw">import com.hypixel.hytale.component.Ref;
class="kw">import com.hypixel.hytale.component.Store;
class="kw">import com.hypixel.hytale.event.EventRegistration;
class="kw">import com.hypixel.hytale.protocol.ItemArmorSlot;
class="kw">import com.hypixel.hytale.server.core.inventory.container.CombinedItemContainer;
class="kw">import com.hypixel.hytale.server.core.inventory.container.EmptyItemContainer;
class="kw">import com.hypixel.hytale.server.core.inventory.container.FetchedItemContainer;
class="kw">import com.hypixel.hytale.server.core.inventory.container.ItemContainer;
class="kw">import com.hypixel.hytale.server.core.inventory.container.ItemContainerUtil;
class="kw">import com.hypixel.hytale.server.core.inventory.container.SimpleItemContainer;
class="kw">import com.hypixel.hytale.server.core.modules.entity.EntityModule;
class="kw">import com.hypixel.hytale.server.core.universe.world.storage.EntityStore;
class="kw">import it.unimi.dsi.fastutil.Hash.Strategy;
class="kw">import it.unimi.dsi.fastutil.objects.Object2ObjectOpenCustomHashMap;
class="kw">import java.util.Arrays;
class="kw">import java.util.List;
class="kw">import java.util.concurrent.ConcurrentLinkedQueue;
class="kw">import java.util.concurrent.atomic.AtomicBoolean;
class="kw">import javax.annotation.Nonnull;
class="kw">import javax.annotation.Nullable;

class="kw">public class="kw">abstract class InventoryComponent class="kw">implements Component<EntityStore> {
   class="kw">public class="kw">static class="kw">final byte INACTIVE_SLOT_INDEX = -1;
   class="kw">public class="kw">static class="kw">final short DEFAULT_HOTBAR_CAPACITY = 9;
   class="kw">public class="kw">static class="kw">final short DEFAULT_UTILITY_CAPACITY = 4;
   class="kw">public class="kw">static class="kw">final short DEFAULT_TOOLS_CAPACITY = 23;
   class="kw">public class="kw">static class="kw">final short DEFAULT_ARMOR_CAPACITY = (short)ItemArmorSlot.VALUES.length;
   class="kw">public class="kw">static class="kw">final short DEFAULT_STORAGE_ROWS = 4;
   class="kw">public class="kw">static class="kw">final short DEFAULT_STORAGE_COLUMNS = 9;
   class="kw">public class="kw">static class="kw">final short DEFAULT_STORAGE_CAPACITY = 36;
   class="kw">public class="kw">static class="kw">final int HOTBAR_SECTION_ID = -1;
   class="kw">public class="kw">static class="kw">final int STORAGE_SECTION_ID = -2;
   class="kw">public class="kw">static class="kw">final int ARMOR_SECTION_ID = -3;
   class="kw">public class="kw">static class="kw">final int UTILITY_SECTION_ID = -5;
   class="kw">public class="kw">static class="kw">final int TOOLS_SECTION_ID = -8;
   class="kw">public class="kw">static class="kw">final int BACKPACK_SECTION_ID = -9;
   class="kw">public class="kw">static class="kw">final int DUMMY_SECTION_ID = -10;
   class="kw">public class="kw">static class="kw">final BuilderCodec<InventoryComponent> CODEC = BuilderCodec.abstractBuilder(InventoryComponent.class)
      .append(new KeyedCodec<>("Inventory", ItemContainer.CODEC), (var0, var1) -> var0.inventory = var1, var0 -> var0.inventory)
      .add()
      .afterDecode(InventoryComponent::postDecode)
      .build();
   class="kw">protected class="kw">final AtomicBoolean isDirty = new AtomicBoolean();
   class="kw">protected class="kw">final AtomicBoolean needsSaving = new AtomicBoolean();
   class="kw">protected ItemContainer inventory = EmptyItemContainer.INSTANCE;
   @Nullable
   class="kw">protected EventRegistration<Void, ItemContainer.ItemContainerChangeEvent> changeEvent;
   class="kw">protected ConcurrentLinkedQueue<ItemContainer.ItemContainerChangeEvent> changeEvents = new ConcurrentLinkedQueue<>();
   class="kw">public class="kw">static ComponentType<EntityStore, ? class="kw">extends InventoryComponent>[] HOTBAR_STORAGE_BACKPACK;
   class="kw">public class="kw">static ComponentType<EntityStore, ? class="kw">extends InventoryComponent>[] HOTBAR_FIRST;
   class="kw">public class="kw">static ComponentType<EntityStore, ? class="kw">extends InventoryComponent>[] STORAGE_FIRST;
   class="kw">public class="kw">static ComponentType<EntityStore, ? class="kw">extends InventoryComponent>[] BACKPACK_STORAGE_HOTBAR;
   class="kw">public class="kw">static ComponentType<EntityStore, ? class="kw">extends InventoryComponent>[] BACKPACK_HOTBAR_STORAGE;
   class="kw">public class="kw">static ComponentType<EntityStore, ? class="kw">extends InventoryComponent>[] STORAGE_HOTBAR_BACKPACK;
   class="kw">public class="kw">static ComponentType<EntityStore, ? class="kw">extends InventoryComponent>[] ARMOR_HOTBAR_UTILITY_STORAGE;
   class="kw">public class="kw">static ComponentType<EntityStore, ? class="kw">extends InventoryComponent>[] HOTBAR_UTILITY_CONSUMABLE_STORAGE;
   class="kw">public class="kw">static ComponentType<EntityStore, ? class="kw">extends InventoryComponent>[] EVERYTHING;

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

   class="kw">public InventoryComponent(short var1) {
      this.inventory = var1 == 0 ? EmptyItemContainer.INSTANCE : new SimpleItemContainer(var1);
      this.registerChangeEvent();
   }

   class="kw">public void ensureCapacity(short var1, @Nonnull List<ItemStack> var2) {
      if (this.inventory.getCapacity() != var1) {
         this.unregisterChangeEvent();
         if (var1 > 0) {
            this.inventory = ItemContainer.ensureContainerCapacity(this.inventory, var1, SimpleItemContainer::new, var2);
         } else {
            this.inventory = ItemContainer.copy(this.inventory, EmptyItemContainer.INSTANCE, var2);
         }

         this.registerChangeEvent();
      }
   }

   class="kw">protected void registerChangeEvent() {
      if (this.inventory != EmptyItemContainer.INSTANCE) {
         this.changeEvent = this.inventory.registerChangeEvent(var1 -> {
            this.markChanged();
            this.changeEvents.add(var1);
         });
      }
   }

   class="kw">protected void unregisterChangeEvent() {
      if (this.changeEvent != null) {
         this.changeEvent.unregister();
         this.changeEvent = null;
      }
   }

   class="kw">protected void markChanged() {
      this.isDirty.set(true);
      this.needsSaving.set(true);
   }

   class="kw">public void markDirty() {
      this.isDirty.set(true);
   }

   class="kw">public boolean consumeIsDirty() {
      class="kw">return this.isDirty.getAndSet(false);
   }

   class="kw">public boolean consumeNeedsSaving() {
      class="kw">return this.needsSaving.getAndSet(false);
   }

   class="kw">public ItemContainer getInventory() {
      class="kw">return this.inventory;
   }

   class="kw">private void postDecode() {
      this.registerChangeEvent();
   }

   class="kw">public ConcurrentLinkedQueue<ItemContainer.ItemContainerChangeEvent> getChangeEvents() {
      class="kw">return this.changeEvents;
   }

   @Nullable
   @Override
   class="kw">public class="kw">abstract Component<EntityStore> clone();

   class="kw">public class="kw">static void setupCombined(
      @Nonnull ComponentType<EntityStore, InventoryComponent.Storage> var0,
      @Nonnull ComponentType<EntityStore, InventoryComponent.Armor> var1,
      @Nonnull ComponentType<EntityStore, InventoryComponent.Hotbar> var2,
      @Nonnull ComponentType<EntityStore, InventoryComponent.Utility> var3,
      @Nonnull ComponentType<EntityStore, InventoryComponent.Backpack> var4,
      @Nonnull ComponentType<EntityStore, InventoryComponent.Tool> var5
   ) {
      HOTBAR_STORAGE_BACKPACK = new ComponentType[]{var2, var0, var4};
      HOTBAR_FIRST = new ComponentType[]{var2, var0};
      STORAGE_FIRST = new ComponentType[]{var0, var2};
      BACKPACK_STORAGE_HOTBAR = new ComponentType[]{var4, var0, var2};
      BACKPACK_HOTBAR_STORAGE = new ComponentType[]{var4, var2, var0};
      STORAGE_HOTBAR_BACKPACK = new ComponentType[]{var0, var2, var4};
      ARMOR_HOTBAR_UTILITY_STORAGE = new ComponentType[]{var1, var2, var3, var0};
      HOTBAR_UTILITY_CONSUMABLE_STORAGE = new ComponentType[]{var2, var3, var0};
      EVERYTHING = new ComponentType[]{var1, var2, var3, var0, var4};
   }

   @Nullable
   class="kw">public class="kw">static ComponentType<EntityStore, ? class="kw">extends InventoryComponent> getComponentTypeById(int var0) {
      if (var0 >= 0) {
         class="kw">return null;
      }

      class="kw">return class="kw">switch (var0) {
         case -9 -> InventoryComponent.Backpack.getComponentType();
         case -8 -> InventoryComponent.Tool.getComponentType();
         class="kw">default -> null;
         case -5 -> InventoryComponent.Utility.getComponentType();
         case -3 -> InventoryComponent.Armor.getComponentType();
         case -2 -> InventoryComponent.Storage.getComponentType();
         case -1 -> InventoryComponent.Hotbar.getComponentType();
      };
   }

   @Nonnull
   @SafeVarargs
   class="kw">public class="kw">static CombinedItemContainer getCombined(
      @Nonnull ComponentAccessor<EntityStore> var0, @Nonnull Ref<EntityStore> var1, @Nonnull ComponentType<EntityStore, ? class="kw">extends InventoryComponent>... var2
   ) {
      InventoryComponent.Combined var3 = var0.getComponent(var1, InventoryComponent.Combined.getComponentType());
      if (var3 == null) {
         var3 = new InventoryComponent.Combined();
         if (var0 class="kw">instanceof Store var4) {
            if (var4.isProcessing()) {
               InventoryComponent.Combined var5 = var3;
               var4.getExternalData().getWorld().execute(() -> {
                  if (var1.isValid()) {
                     var4.putComponent(var1, InventoryComponent.Combined.getComponentType(), var5);
                  }
               });
            } else {
               var0.putComponent(var1, InventoryComponent.Combined.getComponentType(), var3);
            }
         } else {
            var0.putComponent(var1, InventoryComponent.Combined.getComponentType(), var3);
         }
      }

      CombinedItemContainer var14 = (CombinedItemContainer)var3.inventories.get(var2);
      if (var14 != null) {
         class="kw">return var14;
      }

      int var16 = 0;
      Archetype var6 = var0.getArchetype(var1);

      for (ComponentType var10 : var2) {
         if (var6.contains(var10)) {
            var16++;
         }
      }

      ItemContainer[] var17 = new ItemContainer[var16];
      int var18 = 0;

      for (ComponentType var12 : var2) {
         InventoryComponent var13 = var0.getComponent(var1, var12);
         if (var13 != null) {
            var17[var18++] = new FetchedItemContainer(var13::getInventory);
         }
      }

      var14 = new CombinedItemContainer(var17);
      var3.inventories.put(var2, var14);
      class="kw">return var14;
   }

   @Nonnull
   @SafeVarargs
   class="kw">public class="kw">static CombinedItemContainer getCombined(
      @Nonnull CommandBuffer<EntityStore> var0,
      @Nonnull ArchetypeChunk<EntityStore> var1,
      int var2,
      @Nonnull ComponentType<EntityStore, ? class="kw">extends InventoryComponent>... var3
   ) {
      InventoryComponent.Combined var4 = var1.getComponent(var2, InventoryComponent.Combined.getComponentType());
      if (var4 == null) {
         var4 = new InventoryComponent.Combined();
         var0.putComponent(var1.getReferenceTo(var2), InventoryComponent.Combined.getComponentType(), var4);
      }

      CombinedItemContainer var5 = (CombinedItemContainer)var4.inventories.get(var3);
      if (var5 != null) {
         class="kw">return var5;
      }

      int var6 = 0;
      Archetype var7 = var1.getArchetype();

      for (ComponentType var11 : var3) {
         if (var7.contains(var11)) {
            var6++;
         }
      }

      ItemContainer[] var16 = new ItemContainer[var6];
      int var17 = 0;

      for (ComponentType var13 : var3) {
         InventoryComponent var14 = var1.getComponent(var2, var13);
         if (var14 != null) {
            var16[var17++] = new FetchedItemContainer(var14::getInventory);
         }
      }

      var5 = new CombinedItemContainer(var16);
      var4.inventories.put(var3, var5);
      class="kw">return var5;
   }

   @Nullable
   class="kw">public class="kw">static ItemStack getItemInHand(@Nonnull ComponentAccessor<EntityStore> var0, @Nonnull Ref<EntityStore> var1) {
      InventoryComponent.Tool var2 = var0.getComponent(var1, InventoryComponent.Tool.getComponentType());
      if (var2 != null && var2.isUsingToolsItem()) {
         class="kw">return var2.getActiveItem();
      }

      InventoryComponent.Hotbar var3 = var0.getComponent(var1, InventoryComponent.Hotbar.getComponentType());
      class="kw">return var3 != null ? var3.getActiveItem() : null;
   }

   @Nullable
   class="kw">public class="kw">static ItemStack getItemInHand(@Nonnull Holder<EntityStore> var0) {
      InventoryComponent.Tool var1 = var0.getComponent(InventoryComponent.Tool.getComponentType());
      if (var1 != null && var1.isUsingToolsItem()) {
         class="kw">return var1.getActiveItem();
      }

      InventoryComponent.Hotbar var2 = var0.getComponent(InventoryComponent.Hotbar.getComponentType());
      class="kw">return var2 != null ? var2.getActiveItem() : null;
   }

   class="kw">public class="kw">static class Armor class="kw">extends InventoryComponent {
      @Nonnull
      class="kw">public class="kw">static class="kw">final BuilderCodec<InventoryComponent.Armor> CODEC = BuilderCodec.<InventoryComponent>builder(
            InventoryComponent.Armor.class, InventoryComponent.Armor::new, InventoryComponent.CODEC
         )
         .afterDecode(InventoryComponent.Armor::afterDecode)
         .build();
      class="kw">protected boolean outdatedEquipment;

      class="kw">public class="kw">static ComponentType<EntityStore, InventoryComponent.Armor> getComponentType() {
         class="kw">return EntityModule.get().getArmorInventoryComponentType();
      }

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

      class="kw">public Armor(short var1) {
         super(var1);
         this.afterDecode();
      }

      class="kw">public Armor(ItemContainer var1) {
         this.inventory = var1;
         this.registerChangeEvent();
         this.afterDecode();
      }

      class="kw">private void afterDecode() {
         this.inventory = ItemContainerUtil.trySetArmorFilters(this.inventory);
      }

      @Override
      class="kw">public void ensureCapacity(short var1, @Nonnull List<ItemStack> var2) {
         super.ensureCapacity(var1, var2);
         this.inventory = ItemContainerUtil.trySetArmorFilters(this.inventory);
      }

      class="kw">public boolean consumeOutdatedEquipment() {
         boolean var1 = this.outdatedEquipment;
         this.outdatedEquipment = false;
         class="kw">return var1;
      }

      class="kw">public void setOutdatedEquipment(boolean var1) {
         this.outdatedEquipment = var1;
      }

      @Nullable
      @Override
      class="kw">public Component<EntityStore> clone() {
         InventoryComponent.Armor var1 = new InventoryComponent.Armor();
         var1.inventory = this.inventory.clone();
         var1.outdatedEquipment = this.outdatedEquipment;
         class="kw">return var1;
      }
   }

   class="kw">public class="kw">static class Backpack class="kw">extends InventoryComponent {
      class="kw">public class="kw">static class="kw">final BuilderCodec<InventoryComponent.Backpack> CODEC = BuilderCodec.builder(
            InventoryComponent.Backpack.class, InventoryComponent.Backpack::new, InventoryComponent.CODEC
         )
         .build();

      class="kw">public class="kw">static ComponentType<EntityStore, InventoryComponent.Backpack> getComponentType() {
         class="kw">return EntityModule.get().getBackpackInventoryComponentType();
      }

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

      class="kw">public Backpack(short var1) {
         super(var1);
      }

      class="kw">public Backpack(ItemContainer var1) {
         this.inventory = var1;
         this.registerChangeEvent();
      }

      class="kw">public void resize(short var1, @Nullable List<ItemStack> var2) {
         this.unregisterChangeEvent();
         if (var1 > 0) {
            this.inventory = ItemContainer.ensureContainerCapacity(this.inventory, var1, SimpleItemContainer::new, var2);
         } else {
            this.inventory = ItemContainer.copy(this.inventory, EmptyItemContainer.INSTANCE, var2);
         }

         this.registerChangeEvent();
         this.markChanged();
      }

      @Nullable
      @Override
      class="kw">public Component<EntityStore> clone() {
         InventoryComponent.Backpack var1 = new InventoryComponent.Backpack();
         var1.inventory = this.inventory.clone();
         class="kw">return var1;
      }
   }

   class="kw">public class="kw">static class Combined class="kw">implements Component<EntityStore> {
      class="kw">private class="kw">final Object2ObjectOpenCustomHashMap<ComponentType[], CombinedItemContainer> inventories = new Object2ObjectOpenCustomHashMap(
         new Strategy<ComponentType[]>() {
            class="kw">public int hashCode(ComponentType[] var1) {
               class="kw">return Arrays.hashCode(var1);
            }

            class="kw">public boolean equals(ComponentType[] var1, ComponentType[] var2) {
               class="kw">return Arrays.equals(var1, var2);
            }
         }
      );

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

      class="kw">public Object2ObjectOpenCustomHashMap<ComponentType[], CombinedItemContainer> getInventories() {
         class="kw">return this.inventories;
      }

      class="kw">public class="kw">static ComponentType<EntityStore, InventoryComponent.Combined> getComponentType() {
         class="kw">return EntityModule.get().getCombinedInventoryComponentType();
      }

      @Nullable
      @Override
      class="kw">public Component<EntityStore> clone() {
         class="kw">return new InventoryComponent.Combined();
      }
   }

   class="kw">public class="kw">static class Hotbar class="kw">extends ActiveSlotInventoryComponent {
      @Nonnull
      class="kw">public class="kw">static class="kw">final BuilderCodec<InventoryComponent.Hotbar> CODEC = BuilderCodec.builder(
            InventoryComponent.Hotbar.class, InventoryComponent.Hotbar::new, ActiveSlotInventoryComponent.CODEC
         )
         .build();
      class="kw">protected boolean outdatedEquipment;

      class="kw">public class="kw">static ComponentType<EntityStore, InventoryComponent.Hotbar> getComponentType() {
         class="kw">return EntityModule.get().getHotbarInventoryComponentType();
      }

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

      class="kw">public Hotbar(short var1) {
         super(var1);
      }

      class="kw">public Hotbar(ItemContainer var1, byte var2) {
         this.inventory = var1;
         this.activeSlot = var2;
         this.registerChangeEvent();
         this.clampActiveSlot();
      }

      @Override
      class="kw">public int getSectionId() {
         class="kw">return -1;
      }

      @Override
      class="kw">protected void clampActiveSlot() {
         if (this.activeSlot < 0 || this.activeSlot >= this.inventory.getCapacity()) {
            this.activeSlot = (byte)(this.inventory.getCapacity() > 0 ? 0 : -1);
         }
      }

      class="kw">public boolean consumeOutdatedEquipment() {
         boolean var1 = this.outdatedEquipment;
         this.outdatedEquipment = false;
         class="kw">return var1;
      }

      class="kw">public void setOutdatedEquipment(boolean var1) {
         this.outdatedEquipment = var1;
      }

      @Nullable
      @Override
      class="kw">public Component<EntityStore> clone() {
         InventoryComponent.Hotbar var1 = new InventoryComponent.Hotbar();
         var1.inventory = this.inventory.clone();
         var1.activeSlot = this.activeSlot;
         var1.outdatedEquipment = this.outdatedEquipment;
         class="kw">return var1;
      }
   }

   class="kw">public class="kw">static class Storage class="kw">extends InventoryComponent {
      @Nonnull
      class="kw">public class="kw">static class="kw">final BuilderCodec<InventoryComponent.Storage> CODEC = BuilderCodec.builder(
            InventoryComponent.Storage.class, InventoryComponent.Storage::new, InventoryComponent.CODEC
         )
         .build();

      class="kw">public class="kw">static ComponentType<EntityStore, InventoryComponent.Storage> getComponentType() {
         class="kw">return EntityModule.get().getStorageInventoryComponentType();
      }

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

      class="kw">public Storage(short var1) {
         super(var1);
      }

      class="kw">public Storage(ItemContainer var1) {
         this.inventory = var1;
         this.registerChangeEvent();
      }

      @Nullable
      @Override
      class="kw">public Component<EntityStore> clone() {
         InventoryComponent.Storage var1 = new InventoryComponent.Storage();
         var1.inventory = this.inventory.clone();
         class="kw">return var1;
      }
   }

   class="kw">public class="kw">static class Tool class="kw">extends ActiveSlotInventoryComponent {
      class="kw">public class="kw">static class="kw">final BuilderCodec<InventoryComponent.Tool> CODEC = BuilderCodec.builder(
            InventoryComponent.Tool.class, InventoryComponent.Tool::new, ActiveSlotInventoryComponent.CODEC
         )
         .build();
      class="kw">protected boolean usingToolsItem;

      class="kw">public class="kw">static ComponentType<EntityStore, InventoryComponent.Tool> getComponentType() {
         class="kw">return EntityModule.get().getToolInventoryComponentType();
      }

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

      class="kw">public Tool(short var1) {
         super(var1);
      }

      class="kw">public Tool(ItemContainer var1, byte var2) {
         this.inventory = var1;
         this.activeSlot = var2;
         this.registerChangeEvent();
         this.clampActiveSlot();
      }

      @Override
      class="kw">public int getSectionId() {
         class="kw">return -8;
      }

      class="kw">public boolean isUsingToolsItem() {
         class="kw">return this.usingToolsItem;
      }

      class="kw">public void setUsingToolsItem(boolean var1) {
         this.usingToolsItem = var1;
      }

      @Nullable
      @Override
      class="kw">public Component<EntityStore> clone() {
         InventoryComponent.Tool var1 = new InventoryComponent.Tool();
         var1.inventory = this.inventory.clone();
         var1.activeSlot = this.activeSlot;
         var1.usingToolsItem = this.usingToolsItem;
         class="kw">return var1;
      }
   }

   class="kw">public class="kw">static class Utility class="kw">extends ActiveSlotInventoryComponent {
      class="kw">public class="kw">static class="kw">final BuilderCodec<InventoryComponent.Utility> CODEC = BuilderCodec.<ActiveSlotInventoryComponent>builder(
            InventoryComponent.Utility.class, InventoryComponent.Utility::new, ActiveSlotInventoryComponent.CODEC
         )
         .afterDecode(InventoryComponent.Utility::afterDecode)
         .build();
      class="kw">protected boolean outdatedEquipment;

      class="kw">public class="kw">static ComponentType<EntityStore, InventoryComponent.Utility> getComponentType() {
         class="kw">return EntityModule.get().getUtilityInventoryComponentType();
      }

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

      class="kw">public Utility(short var1) {
         super(var1);
         this.afterDecode();
      }

      class="kw">public Utility(ItemContainer var1, byte var2) {
         this.inventory = var1;
         this.activeSlot = var2;
         this.registerChangeEvent();
         this.afterDecode();
         this.clampActiveSlot();
      }

      @Override
      class="kw">public int getSectionId() {
         class="kw">return -5;
      }

      @Override
      class="kw">public void ensureCapacity(short var1, @Nonnull List<ItemStack> var2) {
         super.ensureCapacity(var1, var2);
         this.inventory = ItemContainerUtil.trySetSlotFilters(
            this.inventory, (var0, var1x, var2x, var3) -> var3 == null || var3.getItem().getUtility().isUsable()
         );
      }

      class="kw">private void afterDecode() {
         this.inventory = ItemContainerUtil.trySetSlotFilters(
            this.inventory, (var0, var1, var2, var3) -> var3 == null || var3.getItem().getUtility().isUsable()
         );
      }

      class="kw">public boolean consumeOutdatedEquipment() {
         boolean var1 = this.outdatedEquipment;
         this.outdatedEquipment = false;
         class="kw">return var1;
      }

      class="kw">public void setOutdatedEquipment(boolean var1) {
         this.outdatedEquipment = var1;
      }

      @Nullable
      @Override
      class="kw">public Component<EntityStore> clone() {
         InventoryComponent.Utility var1 = new InventoryComponent.Utility();
         var1.inventory = this.inventory.clone();
         var1.activeSlot = this.activeSlot;
         var1.outdatedEquipment = this.outdatedEquipment;
         class="kw">return var1;
      }
   }
}