Sparky983 / vision-gui

A minimal GUI API for Paper
http://vision.sparky983.me
MIT License
15 stars 0 forks source link

`Bordered` interface #162

Open Sparky983 opened 1 year ago

Sparky983 commented 1 year ago

Represents something with a border.

Bordered:

Bordered.Builder

Sparky983 commented 5 months ago

Should we instead be exploring less ad-hoc ways of setting multiple slots?

A quick and simple approach would be:

interface {
  slots(Slots slots, Button button) {
    for (var slot : slots.for(gui)) {
      slot(slot, button)
    }
  }
}

interface Slots {
  Iterable<Slot> for(Gui gui);
}

Gui gui = Gui.chest()
    .rows(6)
    .build()
    .slots(Slots.TOP, Button.of(ItemType.GRAY_STAINED_GLASS_PANE))
    .slots(Slots.EMPTY, Button.of(ItemType.DIAMOND))
    .slots(Slots.column(1), Button.of(ItemType.EMERALD))
    .slots(Slots.rows(4, 5), Button.of(ItemType.GOLD_INGOT));