#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)
Once your ticket has been resolved, please close it with </ticket close:1054771505520717835> command!
what is the mod and what blocks from the mod?
something like this should do it, this is a startup script js BlockEvents.modification(e => { e.modify('/.plank/', block => { block.requiresTool = true }) e.modify('/.log/', block => { block.requiresTool = true }) })
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
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
Almost all the blocks from Dungeon Blocks
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
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
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
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
/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
Awesome that works! Thank you!