Search code examples
javaminecraftminecraft-fabric

getOutlineShape is deprecated, is there another method to change the hitbox?


I'm making a block that does not occupy a full block in Fabric 1.18.

I've tried the following code as suggested on the Fabric wiki.

protected static final VoxelShape SHAPE = Block.createCuboidShape(2.d, .0d, 2.d, 14.d, 4.d, 14.d);

@Override
public VoxelShape getOutlineShape(BlockState state, BlockView view, BlockPos pos, ShapeContext context) {
    return SHAPE;
}

It does work, just that a deprecated warning shows in the IDE and the console.

Is there something else I should use for this?


Solution

  • Vanilla deprecated the methods in Block that should be called with BlockState. It's ok to override them.