Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions .poggit.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
--- # Poggit-CI Manifest. Open the CI at https://poggit.pmmp.io/ci/Muqsit/CustomSizedInvMenu
--- # Poggit-CI Manifest. Open the CI at https://poggit.pmmp.io/ci/ClickedTran/CustomSizedInvMenu
build-by-default: true
branches:
- master
projects:
CustomSizedInvMenu:
path: ""
libs:
- src: muqsit/InvMenu/InvMenu
branch: pm5
version: ^4.6.4
- src: muqsit/InvMenu/InvMenu
branch: pm5
version: ^4.6.5
...
7 changes: 1 addition & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# CustomSizedInvMenu
To be able to build custom-sized `InvMenu` instances, you must install the [tedo0627/InventoryUIResourcePack](https://github.com/tedo0627/InventoryUIResourcePack) resource pack on your server.
Now to be able to build custom-sized [`InvMenu`](https://github.com/muqsit/InvMenu) instances, you no longer need to install the [`tedo0627/InventoryUIResourcePack`](https://github.com/tedo0627/InventoryUIResourcePack) resource pack on your server as new version has it built into the plugin. However, you need to install the virion [`libBedrock`](https://github.com/NhanAZ/libBedrock) to your server so that errors do not occur during use

A custom-sized InvMenu provides several advantages over traditional ways of displaying menus (`InvMenu::TYPE_CHEST`, `InvMenu::TYPE_DOUBLE_CHEST`):
1. **Dynamic:** To create a menu that can hold `n` items, you need not know the size of a chest or a double chest inventory. Instead, simply create a menu of the preferred size: `CustomSizedInvMenu::create(n)`.
Expand All @@ -25,8 +25,3 @@ Run `/cinvmenu <numSlots> [title]` to open an InvMenu of `numSlots` number of sl
- `/cinvmenu 59 "59-slot Inventory"`

![image](https://github.com/Muqsit/CustomSizedInvMenu/assets/15074389/602e2fdc-b675-4b7f-9e2e-b76c700c64a3)


### Resources
- [tedo0627/InventoryUI](https://github.com/tedo0627/InventoryUI)
- [tedo0627/InventoryUIResourcePack](https://github.com/tedo0627/InventoryUIResourcePack)
14 changes: 2 additions & 12 deletions plugin.yml
Original file line number Diff line number Diff line change
@@ -1,15 +1,5 @@
name: CustomSizedInvMenu
main: muqsit\customsizedinvmenu\CustomSizedInvMenu
api: 5.0.0
version: 0.0.2

commands:
cinvmenu:
usage: /cinvmenu <numSlots> [title]
description: Opens a custom-sized inventory menu
permission: customsizedinvmenu.command

permissions:
customsizedinvmenu.command:
description: Allows using the /cinvmenu command
default: true
version: 0.0.3
virion: ["InvMenu", "libBedrock"]
18 changes: 18 additions & 0 deletions resources/CustomSizedInvMenu Pack/manifest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"format_version": 2,
"header": {
"name": "CustomSizedInvMenu Resource Pack",
"description": "CustomSizedInvMenu Resource Pack",
"uuid": "7ca75eab-549d-45e4-b5b8-56d44209abf1",
"version": [1, 1, 0],
"min_engine_version": [1, 18, 0]
},
"modules": [
{
"type": "resources",
"description": "CustomSizedInvMenu Resource Pack",
"uuid": "dce102e8-6112-4190-a363-d6ee18bac0d2",
"version": [1, 1, 0]
}
]
}
Binary file added resources/CustomSizedInvMenu Pack/pack_icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 6 additions & 0 deletions resources/CustomSizedInvMenu Pack/ui/_ui_defs.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"ui_defs": [
"ui/custom_pocket_containers.json",
"ui/custom_scroll_screen.json"
]
}
136 changes: 136 additions & 0 deletions resources/CustomSizedInvMenu Pack/ui/chest_screen.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,136 @@
{
"namespace": "chest",

"small_chest_screen@common.inventory_screen_common": {
"$close_on_player_hurt|default": true,
"close_on_player_hurt": "$close_on_player_hurt",

"$keyword1": "§1§0§r§r§r§r§r§r§r§r§r",
"$keyword2": "§2§0§r§r§r§r§r§r§r§r§r",
"$keyword3": "§3§0§r§r§r§r§r§r§r§r§r",
"$keyword4": "§4§0§r§r§r§r§r§r§r§r§r",
"$keyword5": "§5§0§r§r§r§r§r§r§r§r§r",
"$keyword6": "§6§0§r§r§r§r§r§r§r§r§r",

"$keyword_scroll1": "§1§1§r§r§r§r§r§r§r§r§r",
"$keyword_scroll2": "§2§1§r§r§r§r§r§r§r§r§r",
"$keyword_scroll3": "§3§1§r§r§r§r§r§r§r§r§r",
"$keyword_scroll4": "§4§1§r§r§r§r§r§r§r§r§r",
"$keyword_scroll5": "§5§1§r§r§r§r§r§r§r§r§r",
"$keyword_scroll6": "§6§1§r§r§r§r§r§r§r§r§r",

"$keyword_pocket": "§r§r§r§r§r§r§r§r§r",

"$container_title_copy": "$container_title",

"variables": [
{
"requires": "$desktop_screen",
"$screen_content": "chest.small_chest_panel",
"$screen_bg_content": "common.screen_background"
},
{
"requires": "$pocket_screen",
"$screen_content": "pocket_containers.small_chest_panel"
},

// desktop not scroll

{ // 9 * 1
"requires": "(not (($container_title_copy - $keyword1) = $container_title_copy)) and $desktop_screen",
"$root_panel_size": [ 176, 130 ],
"$panel_top_half_size": [ "100%", 42 ],
"$scrolling_panel_size": [ 162, 18 ],
"$screen_content": "custom_scroll_screen.custom_scroll_panel"
},
{ // 9 * 2
"requires": "(not (($container_title_copy - $keyword2) = $container_title_copy)) and $desktop_screen",
"$root_panel_size": [ 176, 148 ],
"$panel_top_half_size": [ "100%", 60 ],
"$scrolling_panel_size": [ 162, 36 ],
"$screen_content": "custom_scroll_screen.custom_scroll_panel"
},
{ // 9 * 3
"requires": "(not (($container_title_copy - $keyword3) = $container_title_copy)) and $desktop_screen",
"$root_panel_size": [ 176, 166 ],
"$panel_top_half_size": [ "100%", 78 ],
"$scrolling_panel_size": [ 162, 54 ],
"$screen_content": "custom_scroll_screen.custom_scroll_panel"
},
{ // 9 * 4
"requires": "(not (($container_title_copy - $keyword4) = $container_title_copy)) and $desktop_screen",
"$root_panel_size": [ 176, 184 ],
"$panel_top_half_size": [ "100%", 96 ],
"$scrolling_panel_size": [ 162, 72 ],
"$screen_content": "custom_scroll_screen.custom_scroll_panel"
},
{ // 9 * 5
"requires": "(not (($container_title_copy - $keyword5) = $container_title_copy)) and $desktop_screen",
"$root_panel_size": [ 176, 202 ],
"$panel_top_half_size": [ "100%", 114 ],
"$scrolling_panel_size": [ 162, 90 ],
"$screen_content": "custom_scroll_screen.custom_scroll_panel"
},
{ // 9 * 6
"requires": "(not (($container_title_copy - $keyword6) = $container_title_copy)) and $desktop_screen",
"$root_panel_size": [ 176, 220 ],
"$panel_top_half_size": [ "100%", 132 ],
"$scrolling_panel_size": [ 162, 108 ],
"$screen_content": "custom_scroll_screen.custom_scroll_panel"
},

// desktop scroll

{ // 9 * 1
"requires": "(not (($container_title_copy - $keyword_scroll1) = $container_title_copy)) and $desktop_screen",
"$root_panel_size": [ 184, 130 ],
"$panel_top_half_size": [ "100%", 42 ],
"$scrolling_panel_size": [ 168, 18 ],
"$screen_content": "custom_scroll_screen.custom_scroll_panel"
},
{ // 9 * 2
"requires": "(not (($container_title_copy - $keyword_scroll2) = $container_title_copy)) and $desktop_screen",
"$root_panel_size": [ 184, 148 ],
"$panel_top_half_size": [ "100%", 60 ],
"$scrolling_panel_size": [ 168, 36 ],
"$screen_content": "custom_scroll_screen.custom_scroll_panel"
},
{ // 9 * 3
"requires": "(not (($container_title_copy - $keyword_scroll3) = $container_title_copy)) and $desktop_screen",
"$root_panel_size": [ 184, 166 ],
"$panel_top_half_size": [ "100%", 78 ],
"$scrolling_panel_size": [ 168, 54 ],
"$screen_content": "custom_scroll_screen.custom_scroll_panel"
},
{ // 9 * 4
"requires": "(not (($container_title_copy - $keyword_scroll4) = $container_title_copy)) and $desktop_screen",
"$root_panel_size": [ 184, 184 ],
"$panel_top_half_size": [ "100%", 96 ],
"$scrolling_panel_size": [ 168, 72 ],
"$screen_content": "custom_scroll_screen.custom_scroll_panel"
},
{ // 9 * 5
"requires": "(not (($container_title_copy - $keyword_scroll5) = $container_title_copy)) and $desktop_screen",
"$root_panel_size": [ 184, 202 ],
"$panel_top_half_size": [ "100%", 114 ],
"$scrolling_panel_size": [ 168, 90 ],
"$screen_content": "custom_scroll_screen.custom_scroll_panel"
},
{ // 9 * 6
"requires": "(not (($container_title_copy - $keyword_scroll6) = $container_title_copy)) and $desktop_screen",
"$root_panel_size": [ 184, 220 ],
"$panel_top_half_size": [ "100%", 132 ],
"$scrolling_panel_size": [ 168, 108 ],
"$screen_content": "custom_scroll_screen.custom_scroll_panel"
},

// pocket

{
"requires": "(not (($container_title_copy - $keyword_pocket) = $container_title_copy)) and $pocket_screen",
"$screen_content": "custom_pocket_containers.panel"

}
]
}
}
75 changes: 75 additions & 0 deletions resources/CustomSizedInvMenu Pack/ui/custom_pocket_containers.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
{
"namespace" : "custom_pocket_containers",

"custom_pocket_container_grid@common.container_grid": {
"layer": 3,
"$item_collection_name": "container_items",
"grid_item_template": "common.pocket_ui_container_item"
},

"inventory_panel": {
"type": "panel",
//"size": [ "80%", "95%" ],
"size": [ "84%", "95%" ], // change
"anchor_to": "center",
"anchor_from": "center",
"controls": [
{
"scrolling_panel@common.scrolling_panel": {
"$allow_scrolling_even_when_content_fits": false,
"layer": 1,
"$scrolling_pane_size": [ "100%", "100%-2px" ],
//"$scrolling_content": "pocket_containers.inventory_grid",
"$scrolling_content": "custom_pocket_containers.custom_pocket_container_grid", // change
"$scroll_box_mouse_image_control": "common-classic.button_state_default",
"$scroll_size": [ "8px", "100%" ]
}
}
]
},

"half_screen": {
"type": "panel",
"size": [ "50%", "100%-27px" ],
"offset": [ 0, 27 ],
"anchor_from": "top_left",
"anchor_to": "top_left",
"controls": [
{ "inventory_panel@inventory_panel": {} }
]
},

"panel": {
"type": "panel",
"controls": [
{ "container_gamepad_helpers@common.container_gamepad_helpers": { "layer": 3 } },
//{ "header@header_area": { "layer": 2 } },
{ "header@pocket_containers.header_area": { "layer": 2 } }, // change
//{ "bg@background_panel": { "layer": 0 } },
{ "bg@pocket_containers.background_panel": { "layer": 0 } }, // change
{
//"inventory@half_screen": {
"inventory@pocket_containers.half_screen": { // change
"$container_size": 36,
"$pane_collection": "combined_hotbar_and_inventory_items"
}
},
{
"container@half_screen": {
"anchor_from": "top_middle",
"$pane_collection": "container_items"
}
},
{ "selected_item_details_factory@common.selected_item_details_factory": {} },
{
"item_lock_notification_factory@common.item_lock_notification_factory": {
"$offset": [ 0, "85%" ]
}
},
{ "gamepad_cursor@common.gamepad_cursor_button": {} },
{ "inventory_selected_icon_button@common.inventory_selected_icon_button": {} },
{ "hold_icon@common.inventory_take_progress_icon_button": {} },
{ "flying_item_renderer@common.flying_item_renderer": {} }
]
}
}
71 changes: 71 additions & 0 deletions resources/CustomSizedInvMenu Pack/ui/custom_scroll_screen.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
{
"namespace": "custom_scroll_screen",

"custom_container_grid@common.container_grid": {
"layer": 3,
"$item_collection_name": "container_items"
},

"custom_scroll_panel_top_half": {
"type": "panel",
"$panel_top_half_size|default": [ "100%", 132 ], // large_chest_panel_top_half
"size": "$panel_top_half_size",
"offset": [ 0, 11 ],
"anchor_from": "top_left",
"anchor_to": "top_left",
"controls": [
{ "chest_label@chest.chest_label": {} },
{
"scrolling_panel@common.container_scroll_panel": {
"$scroll_view_port_size": [ "100%", "100%" ],
"$scroll_view_port_size_touch": [ "100%", "100%" ],
"$scroll_view_port_offset": [ 0, 0 ],
"$scroll_view_port_offset_touch": [ 0, 0 ],
"$scroll_bar_left_padding_size": [ 0, 0 ],
"$scroll_bar_right_padding_size": [ 0, 0 ],
"$scrolling_panel_size|default": [ 162, 108 ], // large_chest_grid
"size": "$scrolling_panel_size",
"$scrolling_content": "custom_scroll_screen.custom_container_grid"
}
}
]
},

"custom_scroll_panel": {
"type": "panel",
"controls": [
{ "container_gamepad_helpers@common.container_gamepad_helpers": {} },
{
"flying_item_renderer@common.flying_item_renderer": {
"layer": 14
}
},
{ "selected_item_details_factory@common.selected_item_details_factory": {} },
{ "item_lock_notification_factory@common.item_lock_notification_factory": {} },
{
"root_panel@common.root_panel": {
"$root_panel_size|default": [ 176, 220 ], // large_chest_panel
"size": "$root_panel_size",
"layer": 1,
"controls": [
{ "common_panel@common.common_panel": {} },
{
"chest_panel": {
"type": "panel",
"layer": 5,
"controls": [
{ "small_chest_panel_top_half@custom_scroll_screen.custom_scroll_panel_top_half": {} },
{ "inventory_panel_bottom_half_with_label@common.inventory_panel_bottom_half_with_label": {} },
{ "hotbar_grid@common.hotbar_grid_template": {} },
{ "inventory_take_progress_icon_button@common.inventory_take_progress_icon_button": {} }
]
}
},
{ "inventory_selected_icon_button@common.inventory_selected_icon_button": {} },
{ "gamepad_cursor@common.gamepad_cursor_button": {} }
]
}
}
]
}
}
Loading