Skip to content

翻页Gui

huanmeng_qwq edited this page Dec 27, 2024 · 4 revisions
ArrayList<Button> allButtons = new ArrayList<>();
List<ItemStack> items = IntStream.range(1, 64)
        .mapToObj(i -> new ItemStack(Material.values()[i]))
        .collect(Collectors.toList());
allButtons.addAll(Button.ofItemStacks(items));
GuiPage guiPage = new GuiPage(context.getPlayer(), allButtons, /*每页显示的数量*/27,/*使用预设的界面样式*/Slots.PATTERN_LINE_PAGE_DEFAULT);
guiPage.title("翻页");
guiPage.line(4);
// 使用默认的翻页样式: 将翻页按钮自动填充在界面的左下角和右下角,详情看下面的图
// `PageSettings` 也提供了更多方法支持更改相关的内容,当人你依然可以实现 `PageSetting` 接口来使用
guiPage.pageSetting(PageSettings.normal(guiPage));

Page

Clone this wiki locally