#Minor Query: Solved It Otherwise, But Interested if there was another way.

6 messages · Page 1 of 1 (latest)

drowsy flame
#

Hiya!

I was trying to see if I could use AttackEntity (an event that exists in Forge) with KubeJS for Minecraft 1.19. When I tried to import it and use onEvent, KubeJS informed me that onEvent was deprecated. I experimented with many different approaches to detect that Forge event but eventually decided it was impossible. Instead, I used the EntityEvents.hurt event and checked if it was the player. And that works perfectly fine. But I was cuirous if it was even possible.
I wanted to use

net.minecraftforge.event.entity.player.AttackEntityEvent
Is there a way to do that in this version of KubeJs?

My working solution that doesn't use AttackEntityEvent:

//No attackentity event to use
EntityEvents.hurt(event => {
if (event.source.player){
event.source.player.addExhaustion(1);
}
})

mortal mauveBOT
#

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

pulsar rover
#

heres an example i gave of how to use forge events
keep in mind, these must be in the startup folder (the ForgeEvents line)
#1255642214466453634 message

gloomy pawnBOT
#

[➤](#1255642214466453634 message)

ForgeEvents.onEvent("net.minecraftforge.event.entity.living.LivingEvent.LivingTickEvent", e => {
  global.livingTickEvent(e)
})

global.livingTickEvent(e => {
  // add stuff here so you can reload easily without restarting
})
drowsy flame
#

AHA thank you!

pulsar rover