Compare commits
1 commit
Author | SHA1 | Date | |
---|---|---|---|
62c9d245bd |
6 changed files with 64 additions and 20 deletions
|
@ -64,6 +64,14 @@ hash = "20a4331ae3175651ff24265d8851f45e4e8b3cc580bafc175e12a6c141c6cd2b"
|
||||||
file = "icon.png"
|
file = "icon.png"
|
||||||
hash = "50f74a7debb4a852e1384434500515f2478b8dcf0d71b75eba148ca34d89715c"
|
hash = "50f74a7debb4a852e1384434500515f2478b8dcf0d71b75eba148ca34d89715c"
|
||||||
|
|
||||||
|
[[files]]
|
||||||
|
file = "kubejs/server_scripts/onebar.js"
|
||||||
|
hash = "0c6354ac8b6f7dcd7e9fc6e8fc450823c9121fe6c1760c2a9cd8ba14244da649"
|
||||||
|
|
||||||
|
[[files]]
|
||||||
|
file = "kubejs/startup_scripts/onebar.js"
|
||||||
|
hash = "638c7f0b15e8772020fa5e3130acd7a10bb3757150f9b61f3d0d4b64b8e86fb5"
|
||||||
|
|
||||||
[[files]]
|
[[files]]
|
||||||
file = "mods/architectury-api.pw.toml"
|
file = "mods/architectury-api.pw.toml"
|
||||||
hash = "e12dce3e543168379a2856c66064ee2001e6420a9dfc6163f37b78e518947456"
|
hash = "e12dce3e543168379a2856c66064ee2001e6420a9dfc6163f37b78e518947456"
|
||||||
|
@ -254,11 +262,6 @@ file = "mods/no-kebab.pw.toml"
|
||||||
hash = "38862cdc5bed116ab7faf8e26bfabf3e098f4578374d91de0a710635ad795107"
|
hash = "38862cdc5bed116ab7faf8e26bfabf3e098f4578374d91de0a710635ad795107"
|
||||||
metafile = true
|
metafile = true
|
||||||
|
|
||||||
[[files]]
|
|
||||||
file = "mods/one-slot.pw.toml"
|
|
||||||
hash = "b2a33b058f1a21b0ed07f2ff76c52d2ea8ed1d8be3cd059d5f6c0931a0bf3516"
|
|
||||||
metafile = true
|
|
||||||
|
|
||||||
[[files]]
|
[[files]]
|
||||||
file = "mods/one-world-folder.pw.toml"
|
file = "mods/one-world-folder.pw.toml"
|
||||||
hash = "5364e86ec495b0aaeb918c1681e43c756569b6402dde602e3d670cd9b56bab46"
|
hash = "5364e86ec495b0aaeb918c1681e43c756569b6402dde602e3d670cd9b56bab46"
|
||||||
|
|
49
.minecraft/kubejs/server_scripts/onebar.js
Normal file
49
.minecraft/kubejs/server_scripts/onebar.js
Normal file
|
@ -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
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
3
.minecraft/kubejs/startup_scripts/onebar.js
Normal file
3
.minecraft/kubejs/startup_scripts/onebar.js
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
StartupEvents.registry("item", (event) => {
|
||||||
|
event.create("slotlock") // Create a new block with ID "kubejs:example_block"
|
||||||
|
})
|
|
@ -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"
|
|
|
@ -6,7 +6,7 @@ pack-format = "packwiz:1.1.0"
|
||||||
[index]
|
[index]
|
||||||
file = "index.toml"
|
file = "index.toml"
|
||||||
hash-format = "sha256"
|
hash-format = "sha256"
|
||||||
hash = "06ce6218751ea1eb517ab73c57b4df2e1c25558d3ef03648b91937e2d72d2eae"
|
hash = "5ba9a633f408de517c47b61d17072b4ef0057e5eac13b6e80419965e294a4774"
|
||||||
|
|
||||||
[versions]
|
[versions]
|
||||||
fabric = "0.16.10"
|
fabric = "0.16.10"
|
||||||
|
|
|
@ -41,11 +41,12 @@
|
||||||
- [Inline](https://modrinth.com/mod/fin1PX4m)
|
- [Inline](https://modrinth.com/mod/fin1PX4m)
|
||||||
- [Jade 🔍](https://modrinth.com/mod/nvQzSEkH)
|
- [Jade 🔍](https://modrinth.com/mod/nvQzSEkH)
|
||||||
- [Just Enough Items](https://modrinth.com/mod/u6dRKJwZ)
|
- [Just Enough Items](https://modrinth.com/mod/u6dRKJwZ)
|
||||||
|
- [Kit's Paxels](https://modrinth.com/mod/LDOVpB7g)
|
||||||
- [Krypton](https://modrinth.com/mod/fQEb0iXm)
|
- [Krypton](https://modrinth.com/mod/fQEb0iXm)
|
||||||
- [KubeJS](https://modrinth.com/mod/umyGl7zF)
|
- [KubeJS](https://modrinth.com/mod/umyGl7zF)
|
||||||
|
- [Lavender](https://modrinth.com/mod/D5h9NKNI)
|
||||||
- [MC VR API](https://modrinth.com/mod/B3INNxum)
|
- [MC VR API](https://modrinth.com/mod/B3INNxum)
|
||||||
- [No Chat Reports](https://modrinth.com/mod/qQyHxfxd)
|
- [No Chat Reports](https://modrinth.com/mod/qQyHxfxd)
|
||||||
- [One Slot](https://modrinth.com/mod/M10XRh3H)
|
|
||||||
- [oωo (owo-lib)](https://modrinth.com/mod/ccKDOlHs)
|
- [oωo (owo-lib)](https://modrinth.com/mod/ccKDOlHs)
|
||||||
- [Paradise Lost](https://modrinth.com/mod/IKpsG0nF)
|
- [Paradise Lost](https://modrinth.com/mod/IKpsG0nF)
|
||||||
- [Patchouli](https://modrinth.com/mod/nU0bVIaL)
|
- [Patchouli](https://modrinth.com/mod/nU0bVIaL)
|
||||||
|
@ -58,6 +59,7 @@
|
||||||
- [Starter Kit](https://modrinth.com/mod/6L3ydNi8)
|
- [Starter Kit](https://modrinth.com/mod/6L3ydNi8)
|
||||||
- [Traveler's Backpack](https://modrinth.com/mod/rlloIFEV)
|
- [Traveler's Backpack](https://modrinth.com/mod/rlloIFEV)
|
||||||
- [Trinkets](https://modrinth.com/mod/5aaWibi9)
|
- [Trinkets](https://modrinth.com/mod/5aaWibi9)
|
||||||
|
- [Victus - Custom Hearts](https://modrinth.com/mod/Sy5mAKPK)
|
||||||
- [Vivecraft](https://modrinth.com/mod/wGoQDPN5)
|
- [Vivecraft](https://modrinth.com/mod/wGoQDPN5)
|
||||||
- [YetAnotherConfigLib (YACL)](https://modrinth.com/mod/1eAoo2KR)
|
- [YetAnotherConfigLib (YACL)](https://modrinth.com/mod/1eAoo2KR)
|
||||||
- [Your Options Shall Be Respected (YOSBR)](https://modrinth.com/mod/WwbubTsV)
|
- [Your Options Shall Be Respected (YOSBR)](https://modrinth.com/mod/WwbubTsV)
|
||||||
|
|
Loading…
Reference in a new issue