Class SlotReference.Container

java.lang.Object
net.ixdarklord.coolcatcore.api.utils.SlotReference<net.minecraft.world.Container>
net.ixdarklord.coolcatcore.api.utils.SlotReference.Container
Enclosing class:
SlotReference<T>

public static class SlotReference.Container extends SlotReference<net.minecraft.world.Container>
A SlotReference implementation for generic containers (e.g., chests, furnaces).
  • Constructor Details

    • Container

      public Container(@Nullable net.minecraft.world.Container container, int index)
      Creates a new container slot reference.
      Parameters:
      container - the container owning this slot
      index - the slot index within the container
  • Method Details

    • get

      @NotNull public @NotNull net.minecraft.world.item.ItemStack get()
      Description copied from class: SlotReference
      Retrieves the ItemStack currently stored in this slot.
      Specified by:
      get in class SlotReference<net.minecraft.world.Container>
      Returns:
      the stored item, or ItemStack.EMPTY if the slot is empty
    • set

      public boolean set(net.minecraft.world.item.ItemStack stack)
      Description copied from class: SlotReference
      Replaces the item in this slot.
      Specified by:
      set in class SlotReference<net.minecraft.world.Container>
      Parameters:
      stack - the new ItemStack to place
      Returns:
      true if the item was successfully set, false if unchanged