layout 图标

layout

作者:rebot | 分类:模组

价格:0 墨喵币 下载量:0 点赞:0 版本 2.0.0
本资源为搬运资源,原资源地址: https://modrinth.com/mod/layout
资源信息

Minecraft 版本: 1.19 1.19.1 1.19.2 1.19.3 1.19.4 1.20 1.20.1 1.20.2 1.20.3 1.20.4 1.20.5 1.20.6 1.21 1.21.1 1.21.2 1.21.3 1.21.4 1.21.5 1.21.6 1.21.7 1.21.8 1.21.9 1.21.10 1.21.11

平台: paper

标签: library

资源介绍

layout


License Discord

Layout is a modern, modular library designed to simplify the creation and management of interactive inventories in Minecraft using the Bukkit API. It provides a fluid syntax and complete control over your menu's behavior, allowing you to build GUIs quickly and efficiently.



nothing
If you need help, join the discord server.


Key Features

Sized and Fixed Inventories

Create inventories of variable size (like chests) or fixed size (like crafting tables and anvils), adapting to your project's needs.

Full Customization

Control every aspect of your menus:

  • Interactive Items: Define items with custom click logic for click events (left, right, middle).
  • Inventory Behaviors: Assign actions for events like opening, closing, or general clicks within the inventory.
  • Flexible Patterns: Design complex menus using character-based patterns to visually organize your items.

Modular Design

The library is divided into modules that facilitate organization and scalability:

  • layout: Contains the core logic for inventory construction and management.
  • item: Handles the creation and manipulation of items used in inventories.
  • plugin: Includes code examples that demonstrate the library's practical use. This module is ideal for learning the syntax and seeing how different concepts are applied.

Developer Benefits

  • Rapid Development: Drastically simplifies the menu creation process, allowing you to focus on your plugin's functionality.
  • Clean Code: The fluid syntax results in more readable and maintainable code.
  • Great Potential: Supports multiple inventory types and behaviors, making it a robust solution for a wide range of plugins.

Example usage

Click here for more usage examples and documentation.

final LayoutSizedInventory layoutSizedInventory = Layout.sized()
        .title(Component.text("This is a sized example menu!", NamedTextColor.BLACK))
        .size(5)

        // Add a clickable item with multiple click handlers
        .item(22, ClickableItemLayout.builder()
                .material(Material.NETHERITE_PICKAXE)
                .displayName(Component.text("Netherite Pickaxe", NamedTextColor.GREEN))
                .lore(
                        Component.text("Line 1", NamedTextColor.GREEN),
                        Component.text("Line 2", NamedTextColor.LIGHT_PURPLE)
                )
                .onLeftClick(clickContext -> clickContext.player().sendMessage("Left click!"))
                .onRightClick(clickContext -> clickContext.player().sendMessage("Right click!"))
                .onMiddleClick(clickContext -> clickContext.player().sendMessage("Middle click!"))
                .build()
        )

        // Fill specific rows and columns with items
        .row(1, ItemLayout.display(Material.RED_STAINED_GLASS_PANE))
        .row(3, ItemLayout.display(Material.GREEN_STAINED_GLASS_PANE))
        .column(2, ItemLayout.display(Material.LIME_STAINED_GLASS_PANE).buil)
        .column(6, ItemLayout.display(Material.LIGHT_BLUE_STAINED_GLASS_PANE))

        // Define inventory behavior
        .behavior(layoutBehaviorBuilder -> layoutBehaviorBuilder
                .cancelAllClicks(false)
                .cancelLayoutClicks(true)
                .allowPlayerInventoryClicks(true)
                .ignoreEmptySlots(true)
                .onClick(context -> context.player().sendMessage("Clicked on inventory!"))
                .onOpen(openContext -> openContext.player().sendMessage("Inventory opened!"))
                .onClose(closeContext -> closeContext.player().sendMessage("Inventory closed!"))
        )

        .build();

layoutSizedInventory.open(player);
下载太慢?试试 墨喵加速站,支持 Modrinth 和外网直链高速下载! 用的人越多,下载的越快!
下载与版本
评论(0)
登录 后发表评论。

暂无评论,抢个沙发吧~

举报此资源

请登录后举报

🔥 相关推荐
cpvp pink upgrade

价格:0 墨喵币
下载量:0

查看详情
Partner Pokémon

价格:0 墨喵币
下载量:0

查看详情
NuclearCraft Project

价格:0 墨喵币
下载量:0

查看详情
Nanite Library

价格:0 墨喵币
下载量:0

查看详情