Jump to content

Recommended Posts

Posted (edited)

i just creat a block which works like the minecraft lightning rod.

i use to detcet if a lightning is strik the entity join world event but i got an error (null but i dont know where and why null):

code:

https://github.com/Luis-st/Forge-1.16.5-36.0.1-mdk/blob/main/forge-1.16.5-36.0.1-mdk/src/main/java/net/luis/cave/events/entity/OnEntityJoinWorldEvent.java

log:

https://github.com/Luis-st/Forge-1.16.5-36.0.1-mdk/blob/main/forge-1.16.5-36.0.1-mdk/src/main/java/net/luis/cave/events/entity/player/Error Log

Edited by Luis_ST
Posted

it's not a Null Pointer Exception (no clue where you got the idea that it was...) it's an Stack Overflow Error. that usually means that you have a funcion that is forever calling itself, in an endless recursive loop. if you look at the log it tells you exactly what function is being called: OnEntityJoinWorldEvent#EntityJoinWorld()

that event handler calls World#addEntity, but whenever an entity is added to the world, it fires the EntityJoinWorldEvent (an you're listening to that event and calling World#addEntity... see the loop?)

Posted
1 minute ago, kiou.23 said:

funcion that is forever calling itself

 

2 minutes ago, diesieben07 said:

you that you are being an idiot.

i understand when i check if the lightning is add i canceled the event and add a new lightning

question: when i change the pos of the lightning the event will not called again?

Posted
1 minute ago, diesieben07 said:

EntityJoinWorldEvent is fired for any entity joining the world, regardless of position.

i just test it with setPositionAndUpdate and it works

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.