Jump to content

Recommended Posts

Posted (edited)

I'm trying to make a block (with TileEntity) that uses a different model depending on its NBT.

Can anyone point me in a direction, I'm not sure where to start. I've done the same for items, but never for blocks.

Edited by Tschipp
Posted
1 minute ago, Tschipp said:

a block that uses a different model depending on its NBT.

Blocks do not have any NBT data associated with them. Do you mean ItemBlocks or TileEntities?

ItemBlocks are not different from regular items in this regard.

You can use Block::getActualState to return an IBlockState that relies on something like a TileEntity to define values for some of it's properties. See BlockFlowerPot for more details and an example.

Posted
1 minute ago, V0idWa1k3r said:

Blocks do not have any NBT data associated with them. Do you mean ItemBlocks or TileEntities?

ItemBlocks are not different from regular items in this regard.

You can use Block::getActualState to return an IBlockState that relies on something like a TileEntity to define values for some of it's properties. See BlockFlowerPot for more details and an example.

Yeah sorry I meant TileEntities... long day

Posted (edited)
3 minutes ago, diesieben07 said:

You can put whatever data you need from the TileEntity into the block state either using getActualState (if the amount of states is enumerable) or getExtendedState (for this you will need a custom runtime model).

I don't think I can use states, I'm making a block that can look like any other block. The tile entity stores a Blockstate value and the block is supposed to look like that blockstate

Edited by Tschipp
Posted
2 minutes ago, diesieben07 said:

Then you need getExtendedState with unlisted properties and a custom runtime model.

Ok, how do I make a runtime model?

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.