Posted August 14, 20205 yr I want to make the bed has no collision when player wears a set of armor, so I extended `BedBlock` in my new `Block` class and overrided the method `Block#getCollisionShape` as below: public class VanishingBedBlock extends BedBlock { public VanishingBedBlock(BedBlock block) { super(block.getColor(), Properties.from(block)); } @Override public VoxelShape getCollisionShape(BlockState state, IBlockReader worldIn, BlockPos pos, ISelectionContext context) { Entity entity = context.getEntity(); if(entity instanceof LivingEntity) { if(/*check item somehow*/) { return VoxelShapes.empty(); } } return super.getCollisionShape(state, worldIn, pos, context); } } However, when I place the bed in Minecraft, there is only the outline of the bed when I'm not wearing the armor. The bed just goes invisible. I'm quite sure it is the problem of this class since cancelling the overriding doesn't give any problem at all. What should I do?
August 14, 20205 yr 5 minutes ago, NorthWestWind said: The bed just goes invisible. That's because beds are usually renderered through a TER. You need to create a TER by default for it tor render, or just change the render type to block to support it. Nothing to do with what you said. Edited August 14, 20205 yr by ChampionAsh5357
August 14, 20205 yr Author Ok so I have no idea about what a TER is and does "change the render type" means overriding Block#getRenderType or something? Edit: I just figured out what is TER. Sorry for that. So what do I do to create a TER? Edited August 14, 20205 yr by NorthWestWind
August 14, 20205 yr Are you trying to make this work for vanilla bed or just for your custom bed? If you are trying to cancel the collision with vanilla bed thats not what Override is for. Look here for TER reference: https://mcforge.readthedocs.io/en/latest/tileentities/tesr/ Or just look at the vanilla bed block and BedTileEntityRenderer class to get and idea Check out the port of the BetterEnd fabric mod (WIP): https://www.curseforge.com/minecraft/mc-mods/betterend-forge-port
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.