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);
}
})
