Posted November 17, 20196 yr I am creating a door that is placed not on the edge of a block (like in vanilla) but rather through the center of the block. This is causing me a couple problems: I need to make a collision system that can detect when the player right clicks on either the lower or upper half of the door (The door is just one block with its collision set to be higher that a normal block) And at the same time allows the player to pass through its collider when the door is in an open state. Here is what I coded so far: package com.kenneths_mod.objects.blocks.doors; import net.minecraft.block.Block; import net.minecraft.block.BlockState; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.shapes.ISelectionContext; import net.minecraft.util.math.shapes.VoxelShape; import net.minecraft.world.IBlockReader; public class KenmodDoor extends Block { protected static final VoxelShape shape = Block.makeCuboidShape(1, 0, 7, 15, 31, 9); public KenmodDoor(Properties properties) { super(properties); } @Override public VoxelShape getShape(BlockState state, IBlockReader worldIn, BlockPos pos, ISelectionContext context) { return shape; } @Override public VoxelShape getCollisionShape(BlockState state, IBlockReader worldIn, BlockPos pos, ISelectionContext context) { return shape; } } I can't use regular vanilla code because of the way the door is designed so if anyone can help me please do. Thanks. Edited November 17, 20196 yr by Kenneth201998
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.