Posted May 11, 20187 yr Hi all, I am adding custom beds to my mod, that unlike the regular ones will display as low-lying blocks, think half-slab or a little smaller (this is intended to represent beds like Japanese futons or simple hay beds etc). I could try and copy vanilla and have beds using tile entity rendering, but that seems unnecessarily complex and CPU-intensive for my purpose when block-based rendering is more than fine. I tried extending BlockBed, extending TileEntityBed, and declaring an empty TileEntitySpecialRenderer for my custom TileEntity, but it stills overrides the block-based rendering - my bed is not displayed at all. Any way around that? I know some blocks with tile entities still use normal rendering (like furnaces). My bed block: public class BlockMillBed extends BlockBed { public BlockMillBed(final String blockName) { super(); setCreativeTab(MillBlocks.tabMillenaire); setUnlocalizedName(Mill.MODID + "." + blockName); setRegistryName(blockName); } @Override public TileEntity createNewTileEntity(final World worldIn, final int meta) { return new TileEntityMillBed(); } @Override public boolean isBed(final IBlockState state, final IBlockAccess world, final BlockPos pos, @Nullable final Entity player) { return true; } } My empty tile entity: public class TileEntityMillBed extends TileEntityBed { } Empty renderer: public class TileEntityMillBedRenderer extends TileEntitySpecialRenderer<TileEntityMillBed> { } Block and TE registration: event.getRegistry().register(new BlockMillBed(MillBlockNames.BED_THATCH)); GameRegistry.registerTileEntity(TileEntityMillBed.class, Mill.MODID + ":" + MillBlockNames.BED_THATCH); And renderer registration: ClientRegistry.bindTileEntitySpecialRenderer(TileEntityMillBed.class, new TileEntityMillBedRenderer()); Oh and I've of course added a block state, bed_thatch.json: { "multipart": [ { "apply": { "model": "millenaire:bed_thatch" }} ] } And a block model: { "parent": "block/half_slab", "textures": { "bottom": "millenaire:blocks/thatch", "top": "millenaire:blocks/thatch", "side": "millenaire:blocks/thatch", "particle" : "millenaire:blocks/thatch" } } Any ideas? Thanks! http://www.millenaire.org/img/dynamicsig.png[/img]
May 11, 20187 yr If you do not want a TESR then don't register it. An empty TESR still has it's render method called even if it doesn't do anything. You can have a TE without a TESR. As for your issue - override Block#getRenderType and make it return EnumBlockRenderType.MODEL. BlockBed overrides that to return something else.
May 11, 20187 yr Author Thanks! That last part was indeed exactly what I was missing. http://www.millenaire.org/img/dynamicsig.png[/img]
May 11, 20187 yr Author Actually, I needed both to override getRenderType and to have that empty TESR, otherwise the TESR of the vanilla bed gets used on top of my block's rendering. But of course that's only because I'l extending a vanilla block with a TESR. http://www.millenaire.org/img/dynamicsig.png[/img]
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.