#Randomize Items
1 messages · Page 1 of 1 (latest)
Once your ticket has been resolved, please close it with </ticket close:1054771505520717835> command!
i wanted to do it myself so that modded items will function with it
i forgot to tag this with addon related
ServerEvents.loaded(event => {
let pData = event.server.persistentData
if(!pData.blockDrops){
pData.blockDrops = {}
let itemBlacklist = ["minecraft:bedrock", ...]
let items = Ingredient.all.itemIds.filter(el => !itemBlacklist.includes(el))
Ingredient.all.stacks.forEach(item => {
if(!item.isBlock()) continue
let randomIndex = Math.floor(Math.random() * items.length)
pData.blockDrops[item.id] = items[randomIndex]
items.splice(randomIndex, 1)
})
}
})
LootJS.modifiers((event) => {
let pData = event.server.persistentData
for(let [block, drop] of Object.entries(pData.blockDrops)){
event
.addBlockLootModifier(block)
.removeLoot(Ingredient.all)
.addLoot(drop)
}
});
This won't work for Fortune and silktouch, but it should randomize the drops
Make Sure to extend the list of black listed items
okay thanks ill that
i didnt work and i have tried to get it to but i cant get it to work