#Get all tags of Block

19 messages · Page 1 of 1 (latest)

astral cipher
#

Trying to get all the tags from a block in order to add them to another block, but I'm struggling to get it to work. This is my current code (which is kind of jank) along with the errpr it gives me

const $Registry = Java.loadClass("net.minecraft.core.Registry")

ServerEvents.tags('block', event => {
    
    $Registry.BLOCK.getTagNames().map(key => key.location()).forEach(rLoc => {
        
        console.log(rLoc)
        
        if(event.get(rLoc).getObjectIds().contains('minecraft:ice')) {
            console.log('tag contains ice')
            event.add(rLoc, 'ecologics:thin_ice')
            event.add(rLoc, 'immersiveweathering:thin_ice')

        }
    })
})
atomic waspBOT
#

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

robust lakeBOT
#

Paste version of message.txt from @astral cipher

unique vessel
#

iirc that's something related to rhino

astral cipher
#

im aware, it's just the error is very unspecific so I'm confused as to what is causing it

mortal totem
#

what the hell

#

=.=

unique vessel
astral cipher
#

so um, any ideas on what to do?

mortal totem
#

i would do some debugging to see where it fails, to start with. its way too vague as it is

#

its the equivalent of "its not working"
which says nothing

unique vessel
#

the stacktrace shows the class of console.log, so it might be one of the two

mortal totem
#

still too vague for my liking

#

way too vague

astral cipher
#

"not working" in the sense that it throws an error at runtime

#

ill do a bit more debugging see if i can figure it out

#
[15:00:39] [ERROR] ! server_scripts:tags.js:5: Error occurred while handling event 'ServerEvents.tags': java.lang.NullPointerException
[15:00:39] [ERROR] ! server_scripts:tags.js:5: java.lang.NullPointerException

this is the least helpful error message ive ever seen

#

okay something new

const $Registry = Java.loadClass("net.minecraft.core.Registry")

ServerEvents.tags('block', event => {
    
    $Registry.BLOCK.getTagNames().forEach(tag => {
        
        console.log(tag.location())
        
        // if(event.get(rLoc).getObjectIds().contains('minecraft:ice')) {
        //     console.log('tag contains ice')
        //     event.add(rLoc, 'ecologics:thin_ice')
        //     event.add(rLoc, 'immersiveweathering:thin_ice')

        // }
    })
})
robust lakeBOT
#

Paste version of message.txt from @astral cipher