Jump to content

Event Handler for specific, newly spawned Entity


Merphin

Recommended Posts

Hello Guys! :)

 

I'm quiet new in modding, but I do know how to work in java.

 

So, my problem: I'm summoning and launching a Pig with a custom Item, it's working, so far so good.

Now, I want the Pig to explode as soon as it touches the ground. The thing is, I don't know which Event Handler to use and I don't know how to blow up just the SPECIFIC newly summoned Pig, because Handlers are working for all kinds of entities which are touching the ground.

 

Or maybe it's a dumb idea to use Handlers for executing stuff when a specific pig lands on the ground?

I hope you can tell me some ideas or show me some real code.

 

With regards.

Merphin

Link to comment
Share on other sites

To keep track of a specific entity attach an IExtendedEntityProperties to it. Then you can use LivingFallEvent to do stuff while that specific pig falls.

 

should I implement this interface you named in the class of the item which launches the pigs (summons them in the players facing direction)? or should i create a sub-class of EntityPig and implement this interface?

 

Thank you for your quick answer! :)

Link to comment
Share on other sites

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.



×
×
  • Create New...

Important Information

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