net.minecraft.block.Block.canCollideCheck()方法的使用及代码示例

x33g5p2x  于2022-01-16 转载在 其他  
字(2.7k)|赞(0)|评价(0)|浏览(96)

本文整理了Java中net.minecraft.block.Block.canCollideCheck()方法的一些代码示例,展示了Block.canCollideCheck()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Block.canCollideCheck()方法的具体详情如下:
包路径:net.minecraft.block.Block
类名称:Block
方法名:canCollideCheck

Block.canCollideCheck介绍

暂无

代码示例

代码示例来源:origin: MightyPirates/TIS-3D

/**
 * Standard callback for {@link #raytrace(World, Vec3d, Vec3d, CollisionDetector)},
 * only checks blocks that have a bounding box and are not liquids.
 *
 * @param world    the world to perform the intersection check in.
 * @param position the position of the block to perform the intersection check with.
 * @param start    the start of the line to intersect the block with.
 * @param end      the end of the line to intersect the block with.
 * @return hit information on the intersect, or <tt>null</tt> if there was none.
 */
@Nullable
public static RayTraceResult intersectIgnoringLiquids(final World world, final BlockPos position, final Vec3d start, final Vec3d end) {
  final IBlockState state = world.getBlockState(position);
  final Block block = state.getBlock();
  if (state.getCollisionBoundingBox(world, position) != null && block.canCollideCheck(state, false)) {
    return state.collisionRayTrace(world, position, start, end);
  }
  return null;
}

代码示例来源:origin: SleepyTrousers/EnderCore

&& block.canCollideCheck(iblockstate, includeLiquids)) {
@Nonnull
RayTraceResult raytraceresult = iblockstate.collisionRayTrace(world, blockpos, startVec, endVec);
 if (block1.canCollideCheck(iblockstate1, includeLiquids)) {
  @Nonnull
  RayTraceResult raytraceresult1 = iblockstate1.collisionRayTrace(world, blockpos, startVec, endVec);

代码示例来源:origin: MightyPirates/TIS-3D

/**
 * Checks only blocks that have a bounding box and are not see-through.
 *
 * @param world    the world to perform the intersection check in.
 * @param position the position of the block to perform the intersection check with.
 * @param start    the start of the line to intersect the block with.
 * @param end      the end of the line to intersect the block with.
 * @return hit information on the intersect, or <tt>null</tt> if there was none.
 */
@Nullable
public static RayTraceResult intersectIgnoringTransparent(final World world, final BlockPos position, final Vec3d start, final Vec3d end) {
  final IBlockState state = world.getBlockState(position);
  final Block block = state.getBlock();
  if (!state.getMaterial().blocksMovement() || !state.getMaterial().isOpaque() || !state.getMaterial().blocksLight()) {
    return null;
  }
  if (state.getCollisionBoundingBox(world, position) != null && block.canCollideCheck(state, false)) {
    return state.collisionRayTrace(world, position, start, end);
  }
  return null;
}

代码示例来源:origin: TeamWizardry/Wizardry

if (targetBlock.canCollideCheck(targetState, false) && (predicateBlock == null || predicateBlock.test(targetBlock))) {
  RayTraceResult raytraceresult1 = targetState.collisionRayTrace(world, targetPos, start, end);

相关文章

Block类方法