Jump to content

IWorldEventListener & World variable [1.10]


Matryoshika

Recommended Posts

So, I had an idea that I wanted to try out.

I want one of my blocks, to "crack" when an anvil lands on it.
When an anvil lands, (onEndFalling) it calls world#playEvent with a null EntityPlayer, event-type 1031 & the blockPos.

As such, I made an IWorldEventListener, but here comes the issue.
I know that the event is only fired for that world, but without a World variable to use, I cannot see a way to actually use this data to affect the world around it.

How would I go about this?

Is there a better way around this?

Edited by Matryoshika

Also previously known as eAndPi.

"Pi, is there a station coming up where we can board your train of thought?" -Kronnn

Published Mods: Underworld

Handy links: Vic_'s Forge events Own WIP Tutorials.

Link to comment
Share on other sites

Create a new instance of your IWorldEventListener for each World and store the World in a field.

 

ServerWorldEventHandler and RenderGlobal both do this.

Edited by Choonster
  • Like 1

Please don't PM me to ask for help. Asking your question in a public thread preserves it for people who are having the same problem in the future.

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.

Announcements



×
×
  • Create New...

Important Information

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