Class CreatedSlots.Builder

java.lang.Object
com.trevlar.slotkit.api.slot.CreatedSlots.Builder
Enclosing class:
CreatedSlots

public static final class CreatedSlots.Builder extends Object
Configures one group of slots. Ends with register().
  • Method Details

    • panel

      public CreatedSlots.Builder panel(String id)
      Panel id, unique per group. Used for inertness and render anchoring.
    • group

      public CreatedSlots.Builder group(String id)
      Slot-group id within the panel.
    • category

      public CreatedSlots.Builder category(SlotGroupCategory category)
      What the group is, in the slot group registry's terms. Required; see SlotSpec.at(String, SlotGroupCategory) for why there is no default. The group is listed under it in SlotGroupCategories.of(menu) on every menu it sits on.
    • storage

      public CreatedSlots.Builder storage(Storage storage)
      Where items live. Required. Use storage bound from a StorageAttachment to persist content, or a KeyedStorage (which declares its own PersistentContainerKey) to persist per-slot state as well.
    • activeCount

      @Internal public CreatedSlots.Builder activeCount(IntSupplier count)
      Library use: slots from this count on are inert, on both sides (SlotSpec.activeCount).
    • replacing

      @Internal public CreatedSlots.Builder replacing(int flatStart)
      Library use: put the slots in place of the ones at flatStart onward (an on-demand instance reusing a removed one's), instead of appending them.
    • revealWhen

      public CreatedSlots.Builder revealWhen(BooleanSupplier clientReveal)
      Client-side reveal predicate. The panel, and so the whole group, is visible and usable on the client only while this returns true; the server keeps the slots syncing either way (see the class doc). Must be client-safe. If unset, the group is always visible on the client.
    • label

      public CreatedSlots.Builder label(String displayLabel)
      Display label for these slots' names. Each slot is named "<label> <ordinal>", or just "<label>" for a single slot, registered against the slot's address so WindowSignals.hoveredName() and a consumer's SlotNames lookup return it. Defaults to the capitalized groupId. A consumer can still set a specific name for one slot with SlotNames.override(address, name) afterwards.
    • register

      public CreatedSlots.RegisteredSlots register()
      Builds the standalone MenuPanel and CreatedSlotGroup, creates the CreatedSlots over a StorageContainerAdapter, and appends them to the menu through vanilla's addSlot, which keeps the sync-tracking lists consistent. Returns the result.