Jump to content

Multiblock TileEntity structures


Sync Views

Recommended Posts

I am looking into making some large multiblock machines and storage, like say many of the machines and the iron tank from Railcraft.

 

My idea is to have one main TileEntity that deals with all the logic, and I can make code when a block is placed or destroyed to see if the structure is complete. For smaller structures I could also encode the blocks relative position in the meta data (so can get the centre block / main TileEntity quickly without having to do a search). For larger structures I am not entirely sure.

 

The problem though is in order for things like hoppers, Buildcraft pipes, etc. to work, I need a fully functional IInventory etc. TileEntity for each of the blocks that these things need to interact with. I can make the "proxy" TileEntity reference the main one, but what do I do if it is a chunk border and the main entity isn't loaded?

 

I looked at TileEntityChest, but from what I can tell it relies on other entities like the hopper giving it special treatment.

 

Also while the examples I can think of are from closed source mods, is there a standard way to do this? Perhaps an open source example?

Link to comment
Share on other sites

Hi

 

An idea - you could perhaps store the information in custom objects that your code maintains separate from the vanilla.  Your TileEntities would be used like references to the object, so that your code loads the object whenever one of the TileEntities needs it, and when the player has moved away and there are no more of those TileEntities loaded, you unload the Object.

 

There are a couple of places you can store your own objects to make them persistent - world.perWorldStorage in particular, used by vanilla for villages, but can be hijacked for your own purposes relatively easily.

 

-TGG

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.



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.