Jump to content

[1.8] [SOLVED] Get TileEntity from IBlockState in ISmartBlockModel


Recommended Posts



Is it possible to get an instance of my


from the


, which is passed to the


function of




Basically, I need to render a block based on the data from my




My first idea was to use a


, but that was too inefficient for my case of rendering.


Then I found the excellent tutorial from @herbix, that explained the use of the new


in 1.8.


Unfortunately, it seems that you can only use the block state from a block in the




But I need to store more than 4 bits in my block.


I hope you can help me :)



You sir are a god damn hero.

Link to comment
Share on other sites

You could store ANYTHING in IExtendedBlockState, in case the property is unlisted.

For example:

    public static final IUnlistedProperty<TileEntity> TILE_ENTITY = new IUnlistedProperty<TileEntity>() {
        public String getName() {
            return "tileEntity";
        public boolean isValid(TileEntity value) {
            return true;
        public Class<TileEntity> getType() {
            return TileEntity.class;
        public String valueToString(TileEntity value) {
            return value.toString();
    public IBlockState getExtendedState(IBlockState state, IBlockAccess world, BlockPos pos) {
        if(state instanceof IExtendedBlockState) {
            TileEntity te = ... // Get your tile entity here
            return ((IExtendedBlockState)state).withProperty(TILE_ENTITY, te);
        return state;

Author of Tao Land Mod.

width=200 height=69http://taoland.herbix.me/images/1/14/TaoLandLogo.png[/img]

Also, author of RenderTo


I'm not an English native speaker. I just try my best.

Link to comment
Share on other sites

Thank you very much guys!


At first, I tried overriding the


method, but for some reason my


wasn't rendering anymore.


So I tried herbix' solution, and it worked like a charm!


Thank you very much again and this thread is now



You sir are a god damn hero.

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.

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.