Skip to content

Commit 278e8a3

Browse files
committed
Add documentation & code example for new inventory module tags
1 parent 756ea70 commit 278e8a3

File tree

2 files changed

+54
-10
lines changed

2 files changed

+54
-10
lines changed

bukkit-example-common/src/main/java/com/lunarclient/apollo/example/module/impl/InventoryExample.java

Lines changed: 23 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,8 @@ public void inventoryModuleCommandExample(Player player) {
5050
player.performCommand("summon item ~ ~1 ~ {Item:{id:\"minecraft:torch\",Count:1b,components:{\"minecraft:custom_name\":\"OPEN URL\",\"minecraft:custom_data\":{lunar:{unclickable:true,openUrl:\"https://lunarclient.com\"}}}}}");
5151
player.performCommand("summon item ~ ~1 ~ {Item:{id:\"minecraft:book\",Count:1b,components:{\"minecraft:custom_name\":\"SUGGEST COMMAND\",\"minecraft:custom_data\":{lunar:{unclickable:true,suggestCommand:\"/apollo\"}}}}}");
5252
player.performCommand("summon item ~ ~1 ~ {Item:{id:\"minecraft:writable_book\",Count:1b,components:{\"minecraft:custom_name\":\"RUN COMMAND\",\"minecraft:custom_data\":{lunar:{unclickable:true,runCommand:\"/apollo\"}}}}}");
53+
player.performCommand("summon item ~ ~1 ~ {Item:{id:\"minecraft:sponge\",Count:1b,components:{\"minecraft:custom_name\":\"HIDE ITEM TOOLTIP\",\"minecraft:custom_data\":{lunar:{unclickable:true,hideItemTooltip:true}}}}}");
54+
player.performCommand("summon item ~ ~1 ~ {Item:{id:\"minecraft:dirt\",Count:1b,components:{\"minecraft:custom_name\":\"HIDE SLOT HIGHTLIGHT\",\"minecraft:custom_data\":{lunar:{unclickable:true,hideSlotHighlight:true}}}}}");
5355
}
5456

5557
public void inventoryModuleNMSExample(Player player) {
@@ -60,39 +62,55 @@ public void inventoryModuleNMSExample(Player player) {
6062
ChatColor.RED.toString() + ChatColor.BOLD + "UNCLICKABLE"
6163
);
6264

63-
inventory.setItem(11, ItemUtil.addTag(unclickableItem, "unclickable", true));
65+
inventory.setItem(10, ItemUtil.addTag(unclickableItem, "unclickable", true));
6466

6567
ItemStack copyToClipboardItem = ItemUtil.itemWithName(
6668
Material.PAPER,
6769
ChatColor.BLUE.toString() + ChatColor.BOLD + "COPY TO CLIPBOARD"
6870
);
6971

7072
copyToClipboardItem = ItemUtil.addTag(copyToClipboardItem, "unclickable", true);
71-
inventory.setItem(14, ItemUtil.addTag(copyToClipboardItem, "copyToClipboard", "lunarclient.com"));
73+
inventory.setItem(12, ItemUtil.addTag(copyToClipboardItem, "copyToClipboard", "lunarclient.com"));
7274

7375
ItemStack openUrlItem = ItemUtil.itemWithName(
7476
Material.TORCH,
7577
ChatColor.GOLD.toString() + ChatColor.BOLD + "OPEN URL"
7678
);
7779

7880
openUrlItem = ItemUtil.addTag(openUrlItem, "unclickable", true);
79-
inventory.setItem(17, ItemUtil.addTag(openUrlItem, "openUrl", "https://lunarclient.com"));
81+
inventory.setItem(14, ItemUtil.addTag(openUrlItem, "openUrl", "https://lunarclient.com"));
8082

8183
ItemStack suggestCommandItem = ItemUtil.itemWithName(
8284
Material.BOOK,
8385
ChatColor.GREEN.toString() + ChatColor.BOLD + "SUGGEST COMMAND"
8486
);
8587

8688
suggestCommandItem = ItemUtil.addTag(suggestCommandItem, "unclickable", true);
87-
inventory.setItem(29, ItemUtil.addTag(suggestCommandItem, "suggestCommand", "/apollo"));
89+
inventory.setItem(16, ItemUtil.addTag(suggestCommandItem, "suggestCommand", "/apollo"));
8890

8991
ItemStack runCommandItem = ItemUtil.itemWithName(
9092
Material.ENCHANTED_BOOK,
9193
ChatColor.LIGHT_PURPLE.toString() + ChatColor.BOLD + "RUN COMMAND"
9294
);
9395

9496
runCommandItem = ItemUtil.addTag(runCommandItem, "unclickable", true);
95-
inventory.setItem(33, ItemUtil.addTag(runCommandItem, "runCommand", "/apollo"));
97+
inventory.setItem(29, ItemUtil.addTag(runCommandItem, "runCommand", "/apollo"));
98+
99+
ItemStack hideTooltipItem = ItemUtil.itemWithName(
100+
Material.SPONGE,
101+
ChatColor.GRAY.toString() + ChatColor.BOLD + "HIDE ITEM TOOLTIP"
102+
);
103+
104+
hideTooltipItem = ItemUtil.addTag(hideTooltipItem, "unclickable", true);
105+
inventory.setItem(31, ItemUtil.addTag(hideTooltipItem, "hideItemTooltip", true));
106+
107+
ItemStack hideHighlightItem = ItemUtil.itemWithName(
108+
Material.DIRT,
109+
ChatColor.DARK_GRAY.toString() + ChatColor.BOLD + "HIDE SLOT HIGHTLIGHT"
110+
);
111+
112+
hideHighlightItem = ItemUtil.addTag(hideHighlightItem, "unclickable", true);
113+
inventory.setItem(33, ItemUtil.addTag(hideHighlightItem, "hideSlotHighlight", true));
96114

97115
player.openInventory(inventory);
98116
}

docs/developers/modules/inventory.mdx

Lines changed: 31 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ The inventory module allows you to create customizable and professional user int
1212
- Ability to open URLs. (Respects chat privacy settings)
1313
- Ability to suggest & run commands. (Handled client-side)
1414
- Ability to copy to clipboard.
15+
- Ability to hide item tooltips.
16+
- Ability to hide slot highlighting.
1517

1618
<Callout type="info">
1719
This module is disabled by default, if you wish to use this module you will need to enable it in `config.yml`.
@@ -46,6 +48,14 @@ Explore each integration by cycling through each tab, to find the best fit for y
4648

4749
`/summon item ~ ~1 ~ {Item:{id:"minecraft:writable_book",Count:1b,components:{"minecraft:custom_name":"RUN COMMAND","minecraft:custom_data":{lunar:{unclickable:true,runCommand:"/apollo"}}}}}`
4850

51+
**Hide Item Tooltip Item**
52+
53+
`/summon item ~ ~1 ~ {Item:{id:"minecraft:sponge",Count:1b,components:{"minecraft:custom_name":"HIDE ITEM TOOLTIP","minecraft:custom_data":{lunar:{unclickable:true,hideItemTooltip:true}}}}}`
54+
55+
**Hide Slot Highlight Item**
56+
57+
`/summon item ~ ~1 ~ {Item:{id:"minecraft:dirt",Count:1b,components:{"minecraft:custom_name":"HIDE SLOT HIGHTLIGHT","minecraft:custom_data":{lunar:{unclickable:true,hideSlotHighlight:true}}}}}`
58+
4959
</Tab>
5060

5161
<Tab>
@@ -65,39 +75,55 @@ public void inventoryModuleNMSExample(Player player) {
6575
ChatColor.RED.toString() + ChatColor.BOLD + "UNCLICKABLE"
6676
);
6777

68-
inventory.setItem(11, ItemUtil.addTag(unclickableItem, "unclickable", true));
78+
inventory.setItem(10, ItemUtil.addTag(unclickableItem, "unclickable", true));
6979

7080
ItemStack copyToClipboardItem = ItemUtil.itemWithName(
7181
Material.PAPER,
7282
ChatColor.BLUE.toString() + ChatColor.BOLD + "COPY TO CLIPBOARD"
7383
);
7484

7585
copyToClipboardItem = ItemUtil.addTag(copyToClipboardItem, "unclickable", true);
76-
inventory.setItem(14, ItemUtil.addTag(copyToClipboardItem, "copyToClipboard", "lunarclient.com"));
86+
inventory.setItem(12, ItemUtil.addTag(copyToClipboardItem, "copyToClipboard", "lunarclient.com"));
7787

7888
ItemStack openUrlItem = ItemUtil.itemWithName(
7989
Material.TORCH,
8090
ChatColor.GOLD.toString() + ChatColor.BOLD + "OPEN URL"
8191
);
8292

8393
openUrlItem = ItemUtil.addTag(openUrlItem, "unclickable", true);
84-
inventory.setItem(17, ItemUtil.addTag(openUrlItem, "openUrl", "https://lunarclient.com"));
94+
inventory.setItem(14, ItemUtil.addTag(openUrlItem, "openUrl", "https://lunarclient.com"));
8595

8696
ItemStack suggestCommandItem = ItemUtil.itemWithName(
8797
Material.BOOK,
8898
ChatColor.GREEN.toString() + ChatColor.BOLD + "SUGGEST COMMAND"
8999
);
90100

91101
suggestCommandItem = ItemUtil.addTag(suggestCommandItem, "unclickable", true);
92-
inventory.setItem(29, ItemUtil.addTag(suggestCommandItem, "suggestCommand", "/apollo"));
102+
inventory.setItem(16, ItemUtil.addTag(suggestCommandItem, "suggestCommand", "/apollo"));
93103

94104
ItemStack runCommandItem = ItemUtil.itemWithName(
95105
Material.ENCHANTED_BOOK,
96106
ChatColor.LIGHT_PURPLE.toString() + ChatColor.BOLD + "RUN COMMAND"
97107
);
98108

99109
runCommandItem = ItemUtil.addTag(runCommandItem, "unclickable", true);
100-
inventory.setItem(33, ItemUtil.addTag(runCommandItem, "runCommand", "/apollo"));
110+
inventory.setItem(29, ItemUtil.addTag(runCommandItem, "runCommand", "/apollo"));
111+
112+
ItemStack hideTooltipItem = ItemUtil.itemWithName(
113+
Material.SPONGE,
114+
ChatColor.GRAY.toString() + ChatColor.BOLD + "HIDE ITEM TOOLTIP"
115+
);
116+
117+
hideTooltipItem = ItemUtil.addTag(hideTooltipItem, "unclickable", true);
118+
inventory.setItem(31, ItemUtil.addTag(hideTooltipItem, "hideItemTooltip", true));
119+
120+
ItemStack hideHighlightItem = ItemUtil.itemWithName(
121+
Material.DIRT,
122+
ChatColor.DARK_GRAY.toString() + ChatColor.BOLD + "HIDE SLOT HIGHTLIGHT"
123+
);
124+
125+
hideHighlightItem = ItemUtil.addTag(hideHighlightItem, "unclickable", true);
126+
inventory.setItem(33, ItemUtil.addTag(hideHighlightItem, "hideSlotHighlight", true));
101127

102128
player.openInventory(inventory);
103129
}

0 commit comments

Comments
 (0)