Jump to content

Block PlaceEvent


tolomea

Recommended Posts

I need to monitor all of the instances of some of the less common vanilla blocks, beds, doors furnaces and the like.

Repeatedly scanning for them is not lag friendly, so I was looking for place / remove hooks.

I found BlockEvent.BreakEvent but I can't find the matching PlaceEvent.

I tried using PlayerInteractEvent's but since these fire before the actual placement figuring out what was placed is awkward, I guess I could stash the coordinates and look them up on the next tick but that seems cumbersome.

I looked into replacing the vanilla blocks with ones wrapped with monitoring stuff, but trying to replace vanilla blocks looks like a bad idea.

Soooo, what's the correct way of doing this?

Link to comment
Share on other sites

I wasn't aware that you could make mods like that through the reflection system and I'm not sure what to Google for, what am I looking for?

I did find redefineClasses is that the path you are suggesting?

 

And I presume since we're talking about reflection you know no native Forge way of doing this?

Link to comment
Share on other sites

I found BlockEvent.BreakEvent but I can't find the matching PlaceEvent.

I tried using PlayerInteractEvent's but since these fire before the actual placement figuring out what was placed is awkward, I guess I could stash the coordinates and look them up on the next tick but that seems cumbersome.

There is no PlaceEvent probably because block placing occurs from a lot of places. Player, enderman, piston, falling sand/gravel, dispenser...

If you only care about player placed blocks, stashing the coordinates and checking later on is a perfectly valid solution.

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.