Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

Posted

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!

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.

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...

Important Information

By using this site, you agree to our Terms of Use.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.