Jump to content

[1.14.4] Checking for specific blocks in loaded chunks


Recommended Posts

Posted

Hey! I'm new to forge modding and was wondering if it were possible to check for a specified block type, and return the coordinates of the block. Checked documentation for forge and did a bunch of googling but just can't find much on how to do something like this.

Posted (edited)
8 minutes ago, diesieben07 said:

Does the block have a tile entity? Is it a block of your mod?

I'm just trying to grab the coords of normal vanilla block, for example iron ore or stone blocks. It's not for modded blocks.

 

I'm guessing I'd have to iterate through a chunk for that specific block, but I just don't know if that's possible / how I'd begin something like that.

Edited by Doodle173
Posted
37 minutes ago, diesieben07 said:

You will have to search through the entirety of the chunk, which is slow.

About 600,000 nanos (provided you do literally nothing else but look, doing more can use up as much as another 600,000 nanos) and you only need to do it once per chunk after its generated. Player placed blocks you can acquired at the time it happens.

 

I would recommend using the Custom Ore Gen CogOreGenEvent (which is called after COG does its stuff, which is pretty much guaranteed to run Actually Last, though there are a handful of mods that go later) to do it, but that hasn't updated past 1.12 yet.

 

Or if you're thinking of doing it as a map, you pretty much scan the chunk when the map already does its thing to find out what color to draw. I've done that before too.

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.

Posted
1 hour ago, diesieben07 said:

That's going to be hard. You will have to search through the entirety of the chunk, which is slow.

 

What are you trying to achieve?

My plan was to make a VERY simplistic X-RAY mod. I do not intend to use it outside of this project or publish it at all, I just wanted to see how they worked programatically. 

Posted
8 minutes ago, Doodle173 said:

I just wanted to see how they worked programatically.

Most X-Ray mods work like the resource packs do. They just don't render the blocks that are not whitelisted. Do what you will with that information. They don't scan each chunk.

VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING

I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect.

Forge and vanilla BlockState generator.

Posted
5 minutes ago, Animefan8888 said:

Most X-Ray mods work like the resource packs do. They just don't render the blocks that are not whitelisted. Do what you will with that information. They don't scan each chunk.

Ah alright, thanks. I'll keep that in mind then! 

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.