Jump to content

Replacing a tile entity


tommyte

Recommended Posts

Hello everyone,

 

I'm trying to create a block that is able to switch between several tile entities, each time it's activated. However, world.removeTileEntity(blockpos) and world.setTileEntity(blockpos, tileentity) don't seem to work. Is that because my block only returns one tile entity in the createNewTileEntity(world, meta) method? What should I use to do what I want to do? 

Thanks in advance (:

Link to comment
Share on other sites

I'm trying to make a block that has multiple functionalities. Like a furnace and a chest and a battery or something. I'd like to be able to dynamically add more tile entities to this list, so, the block should be able to iterate through this list. I got it to the point where setTileEntity seems to set the new tile entity, but when I try to access it later, it changed back to the original tile entity.

Link to comment
Share on other sites

There is nothing stopping you from implementing all functionalities you want your block to have and have a field that controls them if you want your block to 'switch'. If you simply want it to have all the functionalities you can and should simply use capabilities. If you want to have a 'dynamic list' you can implement your functionalities in some kind of wrappers and have that list of wrappers in your tile entity. Or something different, depending on the way you want everything to be handled. It is really more of a design choice ;)

 

 

Link to comment
Share on other sites

4 minutes ago, V0idWa1k3r said:

There is nothing stopping you from implementing all functionalities you want your block to have and have a field that controls them if you want your block to 'switch'. If you simply want it to have all the functionalities you can and should simply use capabilities. If you want to have a 'dynamic list' you can implement your functionalities in some kind of wrappers and have that list of wrappers in your tile entity. Or something different, depending on the way you want everything to be handled. It is really more of a design choice ;)

 

 

So, I guess you could do that... I'll give it a try, thx!

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.