Posted April 10, 201510 yr Hello, Is it possible to get an instance of my TileEntity from the IBlockState , which is passed to the handleBlockState function of ISmartBlockModel ? Basically, I need to render a block based on the data from my TileEntity . My first idea was to use a TileEntitySpecialRenderer , 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 IBakedModel in 1.8. Unfortunately, it seems that you can only use the block state from a block in the handleBlockState method. But I need to store more than 4 bits in my block. I hope you can help me ss7 You sir are a god damn hero.
April 10, 201510 yr You could store ANYTHING in IExtendedBlockState, in case the property is unlisted. For example: public static final IUnlistedProperty<TileEntity> TILE_ENTITY = new IUnlistedProperty<TileEntity>() { @Override public String getName() { return "tileEntity"; } @Override public boolean isValid(TileEntity value) { return true; } @Override public Class<TileEntity> getType() { return TileEntity.class; } @Override public String valueToString(TileEntity value) { return value.toString(); } }; ... @Override 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. http://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.
April 10, 201510 yr Author Thank you very much guys! At first, I tried overriding the getActualState method, but for some reason my BakedModel 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 SOLVED You sir are a god damn hero.
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.