From 74d4b0dccdb14f7a9865a9634f5747046e8bbcb8 Mon Sep 17 00:00:00 2001 From: Merith-TK Date: Sat, 15 Apr 2023 00:54:31 -0700 Subject: [PATCH] add kubejs scripts --- .minecraft/index.toml | 8 +++ .minecraft/kubejs/server_scripts/blacklist.js | 50 +++++++++++++++++++ .../kubejs/server_scripts/loot-table.js | 45 +++++++++++++++++ .minecraft/pack.toml | 2 +- 4 files changed, 104 insertions(+), 1 deletion(-) create mode 100644 .minecraft/kubejs/server_scripts/blacklist.js create mode 100644 .minecraft/kubejs/server_scripts/loot-table.js diff --git a/.minecraft/index.toml b/.minecraft/index.toml index 24bb3d2..4c0b305 100644 --- a/.minecraft/index.toml +++ b/.minecraft/index.toml @@ -40,6 +40,14 @@ hash = "b3972803ddb0a76e13d5bd03c7468237dbf2928949a1fb2923a0c20f77a18b7a" file = "config/yosbr/options.txt" hash = "35437b4437d2a9292a0f05a7567a4c74da8b414a28cb7e53bdcae7f71d34f3b9" +[[files]] +file = "kubejs/server_scripts/blacklist.js" +hash = "19d0d5abc449c46aa42f10682eccaaf20df7444b29d14b6ee3675313df98c603" + +[[files]] +file = "kubejs/server_scripts/loot-table.js" +hash = "552e7612afeab1ec64668559982ca7d35ef917e38915b4849d8e5b24fb333546" + [[files]] file = "mods/adorn.pw.toml" hash = "0904d6eaf57c3a13708c22af5eccaac980cbaa38097d1ebfff6429be207b367a" diff --git a/.minecraft/kubejs/server_scripts/blacklist.js b/.minecraft/kubejs/server_scripts/blacklist.js new file mode 100644 index 0000000..3dc66f2 --- /dev/null +++ b/.minecraft/kubejs/server_scripts/blacklist.js @@ -0,0 +1,50 @@ +const itemBlacklist = [ + "allium_peripherals:chat_modem_creative" +] + +// remove recipes +onEvent('recipes', event => { + itemBlacklist.forEach(item => { + event.remove({output: item}) + }) +}); + +// handle items +onEvent('item.pickup', event => { + if (itemBlacklist.includes(event.item.id)) { + event.cancel(); + }; + +}); +onEvent('item.toss', event => { + if (itemBlacklist.includes(event.item.id)) { + event.cancel(); + }; +}); +onEvent('item.right_click', event => { + if (itemBlacklist.includes(event.item.id)) { + event.cancel(); + }; +}); + +// handle blocks +onEvent('block.place', event => { + if (itemBlacklist.includes(event.block.id)) { + event.cancel(); + }; +}); +onEvent('block.break', event => { + if (itemBlacklist.includes(event.block.id)) { + event.cancel(); + }; +}); +onEvent('block.right_click', event => { + if (itemBlacklist.includes(event.block.id)) { + event.cancel(); + }; +}); +onEvent('block.left_click', event => { + if (itemBlacklist.includes(event.block.id)) { + event.cancel(); + }; +}); \ No newline at end of file diff --git a/.minecraft/kubejs/server_scripts/loot-table.js b/.minecraft/kubejs/server_scripts/loot-table.js new file mode 100644 index 0000000..e54f841 --- /dev/null +++ b/.minecraft/kubejs/server_scripts/loot-table.js @@ -0,0 +1,45 @@ + +// Custom Loot Tables +onEvent('block.loot_tables', event => { + event.addBlock('minecraft:cobblestone', table => { + table.addPool(pool => { + pool.addItem('minecraft:coal', 1).randomChance(0.3) + pool.addItem('minecraft:cobblestone', 1) + }) + }) + + // stone loot table + event.addBlock('minecraft:stone', table => { + table.addPool(pool => { + pool.addItem('minecraft:cobblestone', 1) + // add stone ores to loot table with a 0.005 chance + pool.addItem('minecraft:iron_ore', 1).randomChance(0.005) + pool.addItem('minecraft:gold_ore', 1).randomChance(0.005) + pool.addItem('minecraft:copper_ore', 1).randomChance(0.005) + pool.addItem('minecraft:diamond_ore', 1).randomChance(0.005) + pool.addItem('minecraft:emerald_ore', 1).randomChance(0.005) + pool.addItem('minecraft:lapis_ore', 1).randomChance(0.005) + pool.addItem('minecraft:redstone_ore', 1).randomChance(0.005) + pool.addItem('minecraft:coal_ore', 1).randomChance(0.005) + }) + }) + + event.addBlock('minecraft:deepslate', table => { + table.addPool(pool => { + pool.addItem('minecraft:cobbled_deepslate', 1) + + // add tuff to loot table + pool.addItem('minecraft:tuff', 1).randomChance(0.02) + + // add deepslate ores to loot table with a 0.005 chance + pool.addItem('minecraft:deepslate_iron_ore', 1).randomChance(0.005) + pool.addItem('minecraft:deepslate_gold_ore', 1).randomChance(0.005) + pool.addItem('minecraft:deepslate_copper_ore', 1).randomChance(0.005) + pool.addItem('minecraft:deepslate_diamond_ore', 1).randomChance(0.005) + pool.addItem('minecraft:deepslate_emerald_ore', 1).randomChance(0.005) + pool.addItem('minecraft:deepslate_lapis_ore', 1).randomChance(0.005) + pool.addItem('minecraft:deepslate_redstone_ore', 1).randomChance(0.005) + pool.addItem('minecraft:deepslate_coal_ore', 1).randomChance(0.005) + }) + }) +}) \ No newline at end of file diff --git a/.minecraft/pack.toml b/.minecraft/pack.toml index 6cfabea..3983b24 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 = "f0fd74432519c07d2c5c6d3fe1dc3f210bdb1d4150f175324eb78b4e9138c4eb" +hash = "878c8a6d9edd4862637af5e2e1e1ebaa7fab125dd34750a81021b8efa71d892c" [versions] fabric = "0.14.19"