#trying to add to a tag using regex, but I cant seem to get it to work

20 messages · Page 1 of 1 (latest)

violet lintel
#

I've been trying to follow the steps on the wiki, but the game just doesnt like it for whatever reason-
here is the scrip for tag handling:

    pe.forEach(pe_item => {
        event.add('randomium:blacklist', pe_item)
    })
    ec.forEach(ec_item => {
        event.add('randomium:blacklist', ec_item)
    })
    macaws.forEach(mcw_item => {
        event.add('randomium:blacklist', mcw_item)
    })

and here's the script for the regex handling:

const pe = Ingredient.of(/projecte.*/)
const ec = Ingredient.of(/everycomp.*/)
const macaws = Ingredient.of(/mcw.*/)
long hollowBOT
#

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

edgy glade
#

wut

#

i wrote that wiki page, and thats not how it says to do it

naive wingBOT
#

You can modify tags with KubeJS, and the wiki has a page on that!

edgy glade
#

oh the blacklist stuff

#

oh yeah

#

the reason it isnt working is because ingredients dont just have a forEach mehod

#

you first need to transform it into a list of item ids or a list of item stacks

#

Ingredient.of(/_log/).itemIds.forEach(i => event.add('minecraft:non_flammable_logs', i))

#

but you can also just pass the regex to the add

#

event.add('minecraft:non_flammable_logs', /_log/)

#

kubejs also counts a regex as matching if it matches any part of the item id, which is essentially like putting .* on either end, so you dont neeed to put those tehere

violet lintel
#

that did the trick! would i also b able to put this regex in the middle of a search?

edgy glade
#

wdym the middle of a search?

violet lintel
#

like, say i wanted to regex "infinity", but i only wanted to be from "mekanism:" for example

#

but there's text between "mekanism:" and "infinity"

edgy glade
#

/mekanism:.*_infinity/

violet lintel
#

ah!

#

thanks, u've helped a ton!