Interface ResourceContainer

All Known Implementing Classes:
ExportedResourcesContainer, ResourceContainerImpl

@API(status=STABLE, since="2.0.0-milestone.2.13") public interface ResourceContainer
Represents a Container that can hold any ResourceType.
  • Method Details

    • setListener

      void setListener(@Nullable Runnable listener)
    • change

      void change(int index, net.minecraft.world.item.ItemStack stack, boolean tryAlternatives)
    • set

      void set(int index, ResourceAmount resourceAmount)
    • getAmount

      long getAmount(int index)
    • grow

      void grow(int index, long amount)
    • shrink

      void shrink(int index, long amount)
    • setAmount

      void setAmount(int index, long amount)
    • getMaxAmount

      long getMaxAmount(ResourceKey resource)
    • isValid

      boolean isValid(ResourceKey resource)
    • remove

      void remove(int index)
    • clear

      void clear()
    • size

      int size()
    • isEmpty

      default boolean isEmpty()
    • isEmpty

      default boolean isEmpty(int index)
    • get

      @Nullable ResourceAmount get(int index)
    • getResource

      @Nullable PlatformResourceKey getResource(int index)
    • getStackRepresentation

      net.minecraft.world.item.ItemStack getStackRepresentation(int index)
    • getUniqueResources

      Set<ResourceKey> getUniqueResources()
    • getResources

      List<ResourceKey> getResources()
    • toTag

      net.minecraft.nbt.CompoundTag toTag(net.minecraft.core.HolderLookup.Provider provider)
    • fromTag

      void fromTag(net.minecraft.nbt.CompoundTag tag, net.minecraft.core.HolderLookup.Provider provider)
    • getPrimaryResourceFactory

      ResourceFactory getPrimaryResourceFactory()
    • getAlternativeResourceFactories

      Set<ResourceFactory> getAlternativeResourceFactories()
    • toItemContainer

      net.minecraft.world.Container toItemContainer()
    • insert

      long insert(ResourceKey resource, long amount, Action action)
    • extract

      long extract(ResourceKey resource, long amount, Action action)
    • copy