Java源码示例:net.minecraft.util.math.shapes.ISelectionContext
示例1
@Override
public VoxelShape getShape(BlockState state, IBlockReader worldIn, BlockPos pos, ISelectionContext context) {
VoxelShape shape = TANK_SHAPE;
TileEntity t = worldIn.getTileEntity(pos);
if (t instanceof TileEnderTank) {
TileEnderTank tile = (TileEnderTank) t;
shape = SHAPES[tile.rotation];
}
return shape;
}
示例2
@Override
public VoxelShape getShape(BlockState state, IBlockReader worldIn, BlockPos pos, ISelectionContext context) {
VoxelShape shape = CHEST_SHAPE;
TileEntity t = worldIn.getTileEntity(pos);
if (t instanceof TileEnderChest) {
TileEnderChest tile = (TileEnderChest) t;
shape = SHAPES[tile.rotation][tile.getRadianLidAngle(0) >= 0 ? 0 : 1];
}
return shape;
}
示例3
@Override
public VoxelShape getCollisionShape(BlockState state, IBlockReader worldIn, BlockPos pos, ISelectionContext context) {
return VoxelShapes.empty();
}
示例4
/**
* @deprecated call via {@link BlockState#getPushReaction()} whenever possible. Implementing/overriding is fine.
*/
@Override
public VoxelShape getShape(BlockState state, IBlockReader worldIn, BlockPos pos, ISelectionContext selectionContext) {
return SHAPE;
}
示例5
@Override
public VoxelShape getShape(BlockState state, IBlockReader worldIn, BlockPos pos, ISelectionContext context)
{
return SHAPE;
}
示例6
@Override
public VoxelShape getShape(BlockState state, IBlockReader worldIn, BlockPos pos, ISelectionContext context)
{
return (state.get(FACING).getHorizontalIndex() % 2) == 0 ? shape1 : shape2;
}