add default scripts

This commit is contained in:
Merith-TK 2022-08-20 08:53:11 -07:00
parent 640ac5161f
commit 15a01b4ddc
5 changed files with 131 additions and 1 deletions

View file

@ -0,0 +1,43 @@
const itemBlacklist = [
"allium_peripherals:chat_modem_creative"
]
// 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();
};
});

View file

@ -0,0 +1,60 @@
// 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
// default, 0.02, 2%
const stoneLootChance = 0.02
const stoneLootTable = [
"minecraft:redstone",
"minecraft:raw_iron",
"minecraft:raw_gold",
"minecraft:lapis_lazuli",
]
event.addBlock('minecraft:stone', table => {
table.addPool(pool => {
pool.addItem('minecraft:cobblestone', 1)
for (i = 0; i < stoneLootTable.length; i++) {
pool.addItem(stoneLootTable[i],1).randomChance(stoneLootChance)
}
})
})
const deepSlateLootChance = 0.02
const deepSlateLootTable = [
"minecraft:tuff",
]
event.addBlock('minecraft:deepslate', table => {
table.addPool(pool => {
pool.addItem('minecraft:cobbled_deepslate', 1)
for (i = 0; i < deepSlateLootTable.length; i++) {
pool.addItem(deepSlateLootTable[i],1).randomChance(deepSlateLootChance)
}
})
})
})
onEvent('recipes', event => {
// Allium Entangled Modem
event.shaped('1x allium_peripherals:entangled_modem', [
'O O',
'ECE',
'MPM'
], {
O: 'minecraft:obsidian',
E: 'computercraft:wireless_modem_advanced',
C: 'minecraft:ender_chest',
M: 'computercraft:wired_modem',
P: 'minecraft:ender_eye'
})
})

View file

@ -0,0 +1,15 @@
onEvent('recipes', event => {
// Allium Entangled Modem
event.shaped('1x allium_peripherals:entangled_modem', [
'O O',
'ECE',
'MPM'
], {
O: 'minecraft:obsidian',
E: 'computercraft:wireless_modem_advanced',
C: 'minecraft:ender_chest',
M: 'computercraft:wired_modem',
P: 'minecraft:ender_eye'
})
})