#Help figuring out how to loop through a mods blocks, searching for key words and add a tag to it

24 messages · Page 1 of 1 (latest)

lethal portal
#

Per title, I am trying to loop through a mod that adds a bunch of blocks most of which the mod author didn't add tags for their required tools so I was curious if I could loop through the mod & look for a specific part of the name, for example "facade", and add the for it too require a pick axe to break.

devout quartzBOT
#

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

twin dove
#

what is the mod and what blocks from the mod?

dense wolf
#

change plank/log out for the item you want to regex, in this case if left alone itll make all blocks with the words "plank" and "log" in them require their respective tools to break

lethal portal
#

I apologize I forgot to mention not only do the not require the tools, but it isn't set at all

#

Out right, they can be mined with your fist, but using a pickaxe on a stone like block won't break it faster

lethal portal
dense wolf
#

you would probably add the block tag minecraft:mineable/pickaxe for example then

#
.tagBlock('minecraft:mineable/pickaxe')```
#

which if you put it in there you could utilize the same regex

#

er actually wait this is for block creation

#

youll have to use the server script tag event then like so

ServerEvents.tags('block', event => {
    event.add('minecraft:mineable/axe', [
        'minecraft:stone',
        'minecraft:glowstone'
    ])
})```
#

you could try regex here though i cant remember if it works in tag events

lethal portal
#

Yea, I'm trying to figure out how to loop over the blocks in the mod, though I can't seem to figure it out

lone helm
#

you dont need to if you use regex

#

it should work in tag events

#

event.add('minecraft:mineable/axe', /somedungeonmod:/) will add all blocks from the mod to the axe mineable tag

lethal portal
#

Would I use /.facade/ if the id of the is blockdungeonblocks:stone_facade_block

#

To clarify more, all the "facade" blocks follow this nomenclature, "material"_facade_block

lone helm
#

/blockdungeonblocks:[a-z]*_facade_block/

#

that will match anything like blockdungeonblocks:fibblyfoobarabr_facade_block where fibblyfoobarabr is any string of lowercase letters

#

you can replace [a-z]* with [a-z_]* to allow _ as well

lethal portal
#

Awesome that works! Thank you!