#Removing Item from Loot tables

12 messages · Page 1 of 1 (latest)

mellow lintel
#

I removed the clubs from "Basic Weapons" from the loot tables via this script, supposedly, but in game ive encountered vanilla and modded structures still having the item. ```LootJS.lootTables(event => {
const itemsToRemove = [
"basicweapons:wooden_club",
"basicweapons:stone_club",
"basicweapons:iron_club",
"basicweapons:golden_club",
"basicweapons:diamond_club",
"basicweapons:netherite_club",
"endrem:nether_eye",
"endrem:undead_eye",
"endrem:witch_eye",
"endrem:wither_eye",
"endrem:undead_soul",
"endrem:witch_pupil",
];

event.modifyLootTables("chest").forEach(table => {
    itemsToRemove.forEach(item => {
        table.removeItem(item);
    });
});

});``` this is my script im using so far to remove the items from the loot tables, i have not tested the end remastered eyes if they are found in chests but if the clubs aren't working, im assuming those wont as well.
Please ping me in any response via @mellow lintel or just ping in the reply

junior roseBOT
#

Once your ticket has been resolved, please close it with </ticket close:1054771505520717835> command!

west apex
#

@mellow lintel

LootJS.modifiers(event => {
event.addTableModifier(/.*/).removeLoot(itemsToRemove)
})

try this

mellow lintel
#

would the /.*/ be there i put the item ids? and would i replace all of that with this?

#

-# im newer to kubejs

west apex
#

you replace all loot tables with it

mellow lintel
#

where would i insert the item id's though? like where would i put the "minecraft:dirt" to know which items to remove from the loot tables? or would i add this at the end of my current script

west apex
#
LootJS.modifiers(event => {
event.addTableModifier(/.*/).removeLoot("minecraft:dirt")
})
hollow rover
# mellow lintel where would i insert the item id's though? like where would i put the "minecraft...

addTableModifier just specifies what loot tables to modify, and /.*/ is the following:
The two / specify this is a Regex
. is a "wildcard" character, it matches any single character.
* means, to put it simply, "any amount of times".

So .* matches any character any amount of times, which means it matches any string you put in.

.addTableModifier(/.*/) means to edit all loot tables.

removeLoot() removes items. so doing removeLoot("minecraft:dirt") on the table modifier will remove dirt from every loot table.

#

^ are the docs for the removeLoot() function

#

though personally I would do:
addTableModifier(/.*chests?\/.*/) to only modify loot tables that contain chest/ or chests/ (I forgot which one is correct so it just does both lol)