Posted August 29, 20169 yr I've been able to update my mod from 1.7.10 to 1.10.2 with rendering for non-TileEntity blocks, but for some reason all TileEntity blocks are fully transparent, even through they render fine in inventory. Is there some additional code needed when using BlockContainers? Here's my block reduce to it's simplest form reproducing the issue: 1- blockstates/air_generator.json { "variants": { "normal" : { "model": "warpdrive:air_generator" } } } 2- models/block/air_generator.json { "parent": "block/cube_all", "textures": { "all" : "minecraft:blocks/log_birch_top" } } 3- models/item/air_generator.json { "parent": "warpdrive:block/air_generator", "display": { "thirdperson": { "rotation": [ 10, -45, 170 ], "translation": [ 0, 1.5, -2.75 ], "scale": [ 0.375, 0.375, 0.375 ] } } } 4- Block code without tile entity public class BlockAirGenerator extends Block { public BlockAirGenerator(final String dummy) { super(Material.IRON); String registryName = "air_generator"; setUnlocalizedName("xxx"); // setCreativeTab(xxx); setRegistryName(registryName); GameRegistry.register(this); ItemBlock itemBlock = new ItemBlock(this); itemBlock.setRegistryName(registryName); GameRegistry.register(itemBlock); } } => in this case, the block renders properly in the world, on my player and in my inventory 5- Block with a tile entity public class BlockAirGenerator extends BlockContainer { public BlockAirGenerator(final String dummy) { super(Material.IRON); String registryName = "air_generator"; setUnlocalizedName("xxx"); // setCreativeTab(xxx); setRegistryName(registryName); GameRegistry.register(this); ItemBlock itemBlock = new ItemBlock(this); itemBlock.setRegistryName(registryName); GameRegistry.register(itemBlock); GameRegistry.registerTileEntity(TileEntityAirGenerator.class, "xxx"); } @Nonnull public TileEntity createNewTileEntity(@Nonnull World world, int metadata) { return new TileEntityAirGenerator(); } } public class TileEntityAirGenerator extends TileEntity { public TileEntityAirGenerator() { super(); } } => in this case, the block is fully transparent in the world (I can even see through it) but it renders fine on my player and in my inventory
August 29, 20169 yr BlockContainer overrides Block#getRenderType to return EnumBlockRenderType.INVISIBLE , which prevents the block from being rendered via the model system. This is because vanilla renders a lot of its TileEntity blocks with a TileEntitySpecialRenderer . You could override this to return EnumBlockRenderType.MODEL , but there's no reason to extend BlockContainer at all. Instead, override Block#hasTileEntity(IBlockState) to return true and override Block#createTileEntity to create and return an instance of your TileEntity . Please don't PM me to ask for help. Asking your question in a public thread preserves it for people who are having the same problem in the future.
August 30, 20169 yr Author Indeed, I had completely missed the getRenderType() override in BlockContainer, thanks! For the record, if we use Block instead of BlockContainer as a parent class, there's also breakBlock() to override as it removes the TileEntity.
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.