diff --git a/.minecraft/index.toml b/.minecraft/index.toml index 0e92d6d..2dc95b8 100644 --- a/.minecraft/index.toml +++ b/.minecraft/index.toml @@ -64,6 +64,14 @@ hash = "20a4331ae3175651ff24265d8851f45e4e8b3cc580bafc175e12a6c141c6cd2b" file = "icon.png" hash = "50f74a7debb4a852e1384434500515f2478b8dcf0d71b75eba148ca34d89715c" +[[files]] +file = "kubejs/server_scripts/onebar.js" +hash = "0c6354ac8b6f7dcd7e9fc6e8fc450823c9121fe6c1760c2a9cd8ba14244da649" + +[[files]] +file = "kubejs/startup_scripts/onebar.js" +hash = "638c7f0b15e8772020fa5e3130acd7a10bb3757150f9b61f3d0d4b64b8e86fb5" + [[files]] file = "mods/architectury-api.pw.toml" hash = "e12dce3e543168379a2856c66064ee2001e6420a9dfc6163f37b78e518947456" @@ -254,11 +262,6 @@ file = "mods/no-kebab.pw.toml" hash = "38862cdc5bed116ab7faf8e26bfabf3e098f4578374d91de0a710635ad795107" metafile = true -[[files]] -file = "mods/one-slot.pw.toml" -hash = "b2a33b058f1a21b0ed07f2ff76c52d2ea8ed1d8be3cd059d5f6c0931a0bf3516" -metafile = true - [[files]] file = "mods/one-world-folder.pw.toml" hash = "5364e86ec495b0aaeb918c1681e43c756569b6402dde602e3d670cd9b56bab46" diff --git a/.minecraft/kubejs/server_scripts/onebar.js b/.minecraft/kubejs/server_scripts/onebar.js new file mode 100644 index 0000000..5ce9c63 --- /dev/null +++ b/.minecraft/kubejs/server_scripts/onebar.js @@ -0,0 +1,49 @@ +PlayerEvents.tick(e => { + const {player, server} = e; + const {persistentData: pData} = player; + + pData.slot = player.selectedSlot; + + // ensure the player is only able to use the first 3 hotbar slots + server.scheduleInTicks(2, () => { + if([0, 1, 2].includes(pData.slot)) return; + if (player.selectedSlot === 8) { + player.setSelectedSlot(2) + } + if (player.selectedSlot >= 3) { + player.setSelectedSlot(0) + } + + }) +}) + + +// `inventory` slots 36-44 are the hotbar slots (0-8) +PlayerEvents.inventoryChanged(e => { + const { player, slot, item, level } = e; + const lockedItem = Item.of('kubejs:slotlock'); + + for (let i = 0; i < player.inventory.getSize(); i++) { + if (i >= 36 && i <= 44) { + + // TODO: Fix this as its just not working. + // The intended behavior is that for hotbar slots 4 through 9, they are permanently locked to contain `kubejs:slotlock`, + // and any instance of `kubejs:slotlock` in other slots is removed. + // if an item *somehow* gets into a locked slot, it is removed, then given back to the player after the slot is locked again. + + // Hotbar slots: Ensure they always contain `kubejs:slotlock` + if (!player.inventory.get(i).equals(lockedItem)) { + if (!player.inventory.get(i).isEmpty()) { + level.server.runCommandSilent(`clear ${player.username} ${player.inventory.get(i).id} 1`); // Remove incorrect item + level.server.runCommandSilent(`give ${player.username} ${player.inventory.get(i).id} 1`); // Return the item to the player + } + // player.inventory.set(i, lockedItem); // Force slot to contain `kubejs:slotlock` + } + } else { + // Non-hotbar slots: Remove any extra `kubejs:slotlock` + if (player.inventory.get(i)?.equals(lockedItem)) { + level.server.runCommand(`clear ${player.username} kubejs:slotlock 1 from ${i}`); // Remove extra instance from specific slot + } + } + } +}); \ No newline at end of file diff --git a/.minecraft/kubejs/startup_scripts/onebar.js b/.minecraft/kubejs/startup_scripts/onebar.js new file mode 100644 index 0000000..68c4a87 --- /dev/null +++ b/.minecraft/kubejs/startup_scripts/onebar.js @@ -0,0 +1,3 @@ +StartupEvents.registry("item", (event) => { + event.create("slotlock") // Create a new block with ID "kubejs:example_block" +}) \ No newline at end of file diff --git a/.minecraft/mods/one-slot.pw.toml b/.minecraft/mods/one-slot.pw.toml deleted file mode 100644 index 508a16b..0000000 --- a/.minecraft/mods/one-slot.pw.toml +++ /dev/null @@ -1,13 +0,0 @@ -name = "One Slot" -filename = "one_slot-1.20.1-1.1.0.jar" -side = "both" - -[download] -url = "https://cdn.modrinth.com/data/M10XRh3H/versions/rvIJXFqJ/one_slot-1.20.1-1.1.0.jar" -hash-format = "sha512" -hash = "ed6a4e8cae8d5265f0d648bcf2ac2b728d27709d06c10304b23db3f6a2b49972ffcc2102908c45168ebda7e814a28a463391e261131418004c86d2fa7c172cbd" - -[update] -[update.modrinth] -mod-id = "M10XRh3H" -version = "rvIJXFqJ" diff --git a/.minecraft/pack.toml b/.minecraft/pack.toml index 29d5915..2f531c0 100644 --- a/.minecraft/pack.toml +++ b/.minecraft/pack.toml @@ -6,7 +6,7 @@ pack-format = "packwiz:1.1.0" [index] file = "index.toml" hash-format = "sha256" -hash = "06ce6218751ea1eb517ab73c57b4df2e1c25558d3ef03648b91937e2d72d2eae" +hash = "5ba9a633f408de517c47b61d17072b4ef0057e5eac13b6e80419965e294a4774" [versions] fabric = "0.16.10" diff --git a/modlist.md b/modlist.md index 5333903..cc42740 100644 --- a/modlist.md +++ b/modlist.md @@ -41,11 +41,12 @@ - [Inline](https://modrinth.com/mod/fin1PX4m) - [Jade 🔍](https://modrinth.com/mod/nvQzSEkH) - [Just Enough Items](https://modrinth.com/mod/u6dRKJwZ) +- [Kit's Paxels](https://modrinth.com/mod/LDOVpB7g) - [Krypton](https://modrinth.com/mod/fQEb0iXm) - [KubeJS](https://modrinth.com/mod/umyGl7zF) +- [Lavender](https://modrinth.com/mod/D5h9NKNI) - [MC VR API](https://modrinth.com/mod/B3INNxum) - [No Chat Reports](https://modrinth.com/mod/qQyHxfxd) -- [One Slot](https://modrinth.com/mod/M10XRh3H) - [oωo (owo-lib)](https://modrinth.com/mod/ccKDOlHs) - [Paradise Lost](https://modrinth.com/mod/IKpsG0nF) - [Patchouli](https://modrinth.com/mod/nU0bVIaL) @@ -58,6 +59,7 @@ - [Starter Kit](https://modrinth.com/mod/6L3ydNi8) - [Traveler's Backpack](https://modrinth.com/mod/rlloIFEV) - [Trinkets](https://modrinth.com/mod/5aaWibi9) +- [Victus - Custom Hearts](https://modrinth.com/mod/Sy5mAKPK) - [Vivecraft](https://modrinth.com/mod/wGoQDPN5) - [YetAnotherConfigLib (YACL)](https://modrinth.com/mod/1eAoo2KR) - [Your Options Shall Be Respected (YOSBR)](https://modrinth.com/mod/WwbubTsV)