#neoforge event usage in kubejs

28 messages · Page 1 of 1 (latest)

cyan rivet
worthy micaBOT
#

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

simple mountain
#

youre looking at 1.20

cyan rivet
#

it’s the same implementation

cyan rivet
#

yes, thank you

cyan rivet
simple mountain
#

hm cant find it hmmm

#

not sure what the syntax is on 1.21

#

i think its

NativeEvents.onEvent('net.neoforged.neoforge.client.event.CustomizeGuiOverlayEvent', event => {
    // ...
})

in startup

cyan rivet
#

using the example above gives
Cannot register listeners for abstract class net.neoforged.neoforge.client.event.CustomizeGuiOverlayEvent. Register a listener to one of its subclasses instead!

#

and when using net.neoforged.neoforge.client.event.CustomizeGuiOverlayEvent.BossEventProgress
Failed to load Java class 'net.neoforged.neoforge.client.event.CustomizeGuiOverlayEvent.BossEventProgress': Class could not be found!

simple mountain
#

oh its abstract?

cyan rivet
#

got it

simple mountain
#

wait what its not abstract

public static class CustomizeGuiOverlayEvent.BossEventProgress
extends CustomizeGuiOverlayEvent
implements net.neoforged.bus.api.ICancellableEvent
cyan rivet
#

doing search on the server I found what was missing

simple mountain
#

ah

cyan rivet
#

fixed code:

NativeEvents.onEvent("net.neoforged.neoforge.client.event.CustomizeGuiOverlayEvent$BossEventProgress", event => {
    if (event.getBossEvent().getName().getString().contains("Wither")) {
        event.setCanceled(true);
    }
})
#

I didn't knew I needed to use $

#

this blocks wither bar if someone needs it

simple mountain
cyan rivet
#

thanks for the help

#

and as far I looked there is nothing related to NativeEvents, both wikis

simple mountain
#

old wiki wont have it, its 1.21+

#

old wiki has ForgeEvents

cyan rivet
#

alright, good to know, closing thread