use of gg.projecteden.nexus.features.menus.api.content.SlotIterator in project Nexus by ProjectEdenGG.
the class AdventMenu method init.
@Override
public void init() {
int row = 1;
int column = Pugmas21.EPOCH.getDayOfWeek().getValue() + 1;
final SlotIterator slotIterator = innerSlotIterator(contents, SlotPos.of(row, column));
for (int day = 1; day <= 25; day++) {
final int _day = day;
final LocalDate date = Pugmas21.EPOCH.plusDays(_day - 1);
final Icon icon = getIcon(date);
final ItemBuilder item = new ItemBuilder(icon.getItem(_day));
ClickableItem clickableItem = ClickableItem.empty(item.build());
if (user.advent().hasFound(_day)) {
item.lore("", "&aShow Waypoint");
clickableItem = ClickableItem.of(item.build(), e -> {
player.closeInventory();
Advent.glow(user, _day);
});
}
slotIterator.next().set(clickableItem);
}
updateTask(player, contents);
}
use of gg.projecteden.nexus.features.menus.api.content.SlotIterator in project Nexus by ProjectEdenGG.
the class MenuUtils method innerSlotIterator.
public static SlotIterator innerSlotIterator(InventoryContents contents, SlotPos start) {
final SlotIterator slotIterator = contents.newIterator(Type.HORIZONTAL, start);
final int rows = contents.inventory().getRows();
for (int i = 0; i < rows * COLUMNS; i++) if (i < COLUMNS || i % COLUMNS == 0 || (i + 1) % COLUMNS == 0 || i >= (rows - 1) * COLUMNS)
slotIterator.blacklist(i);
return slotIterator;
}
Aggregations