Jump to content

[1.7.10]Specific block discovery


Bregor

Recommended Posts

Hi,

 

I am looking for best practices for discovery of specific blocks in the neighborhood of another specific block.

 

To be more specific the scenario I have in mind is a kind of wireless master-slave block relationship. For example if the master block is placed it searches for all slave blocks in a given radius (e.g. 32 blocks radius).

 

 

Scanning the blocks in range seems to be a bad idea performance wise, as 32 blocks radius would require scanning 262k blocks in worst case.

 

Is it a good idea to keep a global storage of all master blocks and slave blocks without a master block? Or is there a better way to achieve such a thing?

 

 

Neither the master nor the slave blocks will be generated naturally, but there may be a lot of slave blocks.

 

Thanks

 

Link to comment
Share on other sites

You could try making an item that, when rightclicked on the master, binds to it (stores it's location or something)

 

When you then click on a slave block, it links the 2 together.

 

It's manual work, but I'm pretty sure that should work. Oh wait. I made it. Ofcourse it works. :P

 

It also solves some problems that could arise by your method. What if a slaveblock is surrounded by 10 masters? pick a random one? :D

 

Good luck!

Link to comment
Share on other sites

I was going to ask you the same question as pancake about how to pick which master.

 

One other way to do it is to create a GUI on the slave where you have to pick the master that was found.

 

 

Another way to do this is to create a tick item for each block.  Assuming you will have Tile Entities based upon what you have said.  Could on each tick update a master list that they exist.  Purge from list if not receiving a tick so often.  Your slaves could look at that list and calculate the master block that is closest and use it.  That would save you from random searches.  Could speed that up as well as to say if the master is still in the list, don't bother to iterate for closest again.

 

Just some options to think about.

Long time Bukkit & Forge Programmer

Happy to try and help

Link to comment
Share on other sites

Well I thought about something like the attuning to the master block too, but as there will be many slave nodes for each master I didn't want to force the user to update all nodes after the master node is placed somewhere else or is destroyed by something.

 

And about the tile entity idea, may be worth investigating. Non ticking tile entities are not available before 1.8?

 

 

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.