Jump to content

RenderBlockEvent?


Kavatch

Recommended Posts

Hey,
I am currently looking for a way to see blocks through other blocks, because I want to make a mod which should allow the player to craft an item (e.g. with diamonds) to find blocks of the same kind (in this example diamonds ore).
The problem is that I don't know how to render the blocks at the moment, so far I'm so that crafting the items etc works, but I'm just hanging on rendering the blocks. I know that there is an event called RenderWorldLastEvent but I don't know how to find a block there (in this case a diamond ore) and make a box around it.

Link to comment
Share on other sites

The closest I've ever come to doing something like this, I used particle effects.

https://github.com/Draco18s/ReasonableRealism/blob/1.12.1/src/main/java/com/draco18s/ores/client/ProspectorParticle.java

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Link to comment
Share on other sites

Thanks, but I think your code is just to display the particles around the block. My main problem is to first find the corresponding blocks around the player and after this to display the particles / other effects around the block. Now that I know how the particles would work, I would need some way to find the block at all. 

Link to comment
Share on other sites

There is no auto-magical way of getting a specific block in the world.
Use BlockPos.getAllInBox using two opposite corners to get an Iterable<BlockPos> containing all BlockPos within that area.

You then need to iterate through each element, and check if the block at that position is the block you want.
Do keep in mind to limit the area you want to check, as scanning in 3-dimensional space gets exponentially larger the further out you scan.

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

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.