Jump to content

Electricity/Item transfer system


Animeniac

Recommended Posts

I've been working on coming up with a solution for making a transfer system for Items, Liquids, Electricity and Redstone Power, in an instant fashion similar to that of AE opposed to BC pipes or Pneumatic tubes which take time to transfer items around.

 

Thus far I have it so that when a "network block" updates and is not attached to a "network" it will: create a new "network" and  attach it self to the new "network", attach itself to an adjacent "network", or merge adjacent "networks" and adding itself to the new "network".

 

The issue I'm having is how I should go about detecting when to split the "network" when the last block connecting 2 parts of the "network" is removed. The solution I have so far is to reset the "network" when ever a block is removed, which seems unnecessary is there a better way to handle this?

Link to comment
Share on other sites

I am not sure how good of an idea this is... But here it is anyway xD

 

( NOTE I am not thinking 100% atm, so this will probably be pretty patchy :/ )

 

You could create a list/hashmap that contains the block, and its location in the world. Then, when the block is removed

 

Actually, you could just make a TileEntity for the block (if you haven't already) that contains information about the network that the block is connected to, what blocks are in that network, the range of the network etc.

 

Then when the Block is destroyed, cycle through the locations of the blocks in the network the original is in, and if the are outside the range of the network, split the network into two networks. The hardest part would be checking what blocks are within range of each other so you know how many networks to split into... call a method that would check block locations to range and such so as to decide how many new ''networks" to create.

 

(NOTE2 : I am finishing here for now, I will be posting with a better idea later... This is still part of it though xD Sorry mate :/ )

I am Mew. The Legendary Psychic. I behave oddly and am always playing practical jokes.

 

I have also found that I really love making extremely long and extremely but sometimes not so descriptive variables. Sort of like what I just did there xD

Link to comment
Share on other sites

No, that is a very good worry. I just realized that now any way. So basically, when the block is created, you would go through all the blocks within range to see if there is more network blocks and add them to that list. Then, using some sort of update event, I can't think of what it would be at the moment, you would check that range again and replace the list with the new blocks etc. (that includes removing the blocks that have been removed.)

 

Then when the block is destroyed you could call a universal method on all the blocks in the network making them do a forced check of their ranges and create the new networks from there.

 

It is not very detailed, but it should do if you know what you are doing!

 

(More coming later)

I am Mew. The Legendary Psychic. I behave oddly and am always playing practical jokes.

 

I have also found that I really love making extremely long and extremely but sometimes not so descriptive variables. Sort of like what I just did there xD

Link to comment
Share on other sites

I'm not sure i understand, but couldn't you just make a tileentity for every block in your network and eachtime a object wants to travel in the network, each TE would receive the information from where it comes from and from there pick a destination. Then pass the information to the next TE ?

 

how to debug 101:http://www.minecraftforge.net/wiki/Debug_101

-hydroflame, author of the forge revolution-

Link to comment
Share on other sites

Thanks hydroflame, unfortunately i don't think I can do that with this system though i would certaintly be doing so for a pipe like system. The issues I think i'd have with it would first of all the delay caused by needing to transfer the data between tile entities, which I might be over estimating, as I want the transfer to be near instant, and second though I hadn't posted this in the OP I am making the main connection block an aesthetic block as well as a network connection which would make the transfer logic difficult if someone had a base made of them as I am hoping to be more then possible.

 

Once again I may just be over thinking something, and in fact suspect I am.

Link to comment
Share on other sites

which I might be over estimating

i think you are, unless you are expecting people to make network over hundreds and hundreds of block away it should be instant (at least to you)

 

also, if the other block is literally hundreds of block away, you still need to get there and minecraft doesn't have a lot of fast travel methods so you probably wouldn't even see the difference.

 

 

how to debug 101:http://www.minecraftforge.net/wiki/Debug_101

-hydroflame, author of the forge revolution-

Link to comment
Share on other sites

While they may not be 100s of blocks away I expect network itself may be a few hundred-few thousand blocks. As I said I plan on making the main network block an asthetic block so if someone made a 9x9x6 room of them (from direwolf20) it would be 290+ block connections per room which I want to at least anticipate.

 

After a moment of throught I might be able to make it work with a kind of controller type block.

Link to comment
Share on other sites

if its suppose to be "tunnels" connecting the end togheter, why would you make a cube out of it ?

 

like i dont get the advantage of having a 9x9x6 versus just a 9x1x1 you want to get to point A to B, so take the smallest road possible ?

how to debug 101:http://www.minecraftforge.net/wiki/Debug_101

-hydroflame, author of the forge revolution-

Link to comment
Share on other sites

Getting into the lore of my mod a bit the network is supposed to be a bunch of Nanites, which would not be tubes one of the main features of the Nanites was the ability to connect electronics without the hassle of wires/pies in exchange for other to be added problems as such it is conceivable that someone might want to take up a good amount of space with them which in turn gave me the idea of making them so they were aesthetically pleasing the idea being the the Nanites colors could be reprogrammed an as such there would be multiple reasons to have a room made out of them.

 

 

On another note I think I have solved the network splitting issue by having the surrounding blocks make a special call to the network, and then making each adjacent network block do the same and splitting the network based on the results if necessary.

Link to comment
Share on other sites

Sounds like I didn't help much then xD

 

That is the problem with my code, I try to do things in weird and wonderful ways. It mostly doesn't work though... Or I just make things harder than they should be...

I am Mew. The Legendary Psychic. I behave oddly and am always playing practical jokes.

 

I have also found that I really love making extremely long and extremely but sometimes not so descriptive variables. Sort of like what I just did there xD

Link to comment
Share on other sites

Thanks to both Mew and hydroflame for the help with this you both helped me a lot in figuring out how I should do this.

 

@Mew I know the feeling of using different methods, but its experimenting that will find the new best way lol. In the end I ended up using a combination of both your method and hydroflame's, at least for now.

Link to comment
Share on other sites

Cool :D

 

Glad to know I am still slightly useful xD

 

Hope it works well for ya

I am Mew. The Legendary Psychic. I behave oddly and am always playing practical jokes.

 

I have also found that I really love making extremely long and extremely but sometimes not so descriptive variables. Sort of like what I just did there xD

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.