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

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

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

Block.collisionRayTrace介绍

暂无

代码示例

代码示例来源:origin: AppliedEnergistics/Applied-Energistics-2

final RayTraceResult r = super.collisionRayTrace( state, w, pos, a, b );
return super.collisionRayTrace( state, w, pos, a, b );

代码示例来源:origin: DimensionalDevelopment/VanillaFix

@Override
public RayTraceResult collisionRayTrace(World world, BlockPos pos, Vec3d start, Vec3d end) {
  return block.collisionRayTrace(this, world, pos, start, end);
}

代码示例来源:origin: McJtyMods/XNet

protected RayTraceResult originalCollisionRayTrace(IBlockState blockState, World world, BlockPos pos, Vec3d start, Vec3d end) {
  return super.collisionRayTrace(blockState, world, pos, start, end);
}

代码示例来源:origin: AppliedEnergistics/Applied-Energistics-2

final RayTraceResult r = super.collisionRayTrace( state, w, pos, ld.getA(), ld.getB() );

代码示例来源:origin: DimensionalDevelopment/VanillaFix

@Override
public RayTraceResult collisionRayTrace(World worldIn, BlockPos pos, Vec3d start, Vec3d end) {
  return normalState.getBlock().collisionRayTrace(this, worldIn, pos, start, end);
}

代码示例来源:origin: Electrical-Age/ElectricalAge

@Override
public MovingObjectPosition collisionRayTrace(World world, int x, int y, int z, Vec3 startVec, Vec3 endVec) {
  int meta = world.getBlockMetadata(x, y, z);
  switch (meta) {
    case tFloor:
      this.maxY = 0.0625;
      break;
    case tLadder:
      this.maxX = 0.01;
      this.maxY = 0.01;
      this.maxZ = 0.01;
      break;
    default:
      break;
  }
  MovingObjectPosition m = super.collisionRayTrace(world, x, y, z, startVec, endVec);
  switch (meta) {
    case tFloor:
      this.maxY = 1;
      break;
    case tLadder:
      this.maxX = 1;
      this.maxY = 1;
      this.maxZ = 1;
      break;
    default:
      break;
  }
  return m;
}

代码示例来源:origin: TheCBProject/EnderStorage

@Override
public RayTraceResult collisionRayTrace(IBlockState state, World world, BlockPos pos, Vec3d start, Vec3d end) {
  TileEntity tile = world.getTileEntity(pos);
  if (tile != null && tile instanceof TileFrequencyOwner) {
    return RayTracer.rayTraceCuboidsClosest(start, end, pos, ((TileFrequencyOwner) tile).getIndexedCuboids());
  }
  return super.collisionRayTrace(state, world, pos, start, end);
}

代码示例来源:origin: AppliedEnergistics/Applied-Energistics-2

final RayTraceResult mop = block.collisionRayTrace( world.getBlockState( pos ), world, pos, dir.getA(), dir.getB() );
  final RayTraceResult mop = block.collisionRayTrace( world.getBlockState( pos ), world, pos, dir.getA(), dir.getB() );
final RayTraceResult mop = state.getBlock().collisionRayTrace( state, world, pos, dir.getA(), dir.getB() );

代码示例来源:origin: AlgorithmX2/Chisels-and-Bits

@Override
public boolean rotate(
    final World world,
    final BlockPos pos,
    final EntityPlayer player )
{
  final IMultipartContainer container = MultipartHelper.getContainer( world, pos ).orElse( null );
  if ( container != null )
  {
    final IBlockState state = world.getBlockState( pos );
    final Block blk = state.getBlock();
    if ( blk != null )
    {
      final Pair<Vec3d, Vec3d> atob = RayTraceHelper.getRayTraceVectors( player );
      final RayTraceResult crt = blk.collisionRayTrace( state, world, pos, atob.getKey(), atob.getValue() );
      if ( crt.hitInfo instanceof PartInfo )
      {
        // TODO : rotate the parts.
      }
    }
  }
  return false;
}

代码示例来源:origin: AlgorithmX2/Chisels-and-Bits

@Override
public EnumActionResult onItemUse(
    final EntityPlayer playerIn,
    final World worldIn,
    final BlockPos pos,
    final EnumHand hand,
    final EnumFacing facing,
    final float hitX,
    final float hitY,
    final float hitZ )
{
  if ( worldIn.isRemote )
  {
    if ( playerIn.isSneaking() )
    {
      ClientSide.instance.tapeMeasures.clear();
      return EnumActionResult.SUCCESS;
    }
    final Pair<Vec3d, Vec3d> PlayerRay = ModUtil.getPlayerRay( playerIn );
    final Vec3d ray_from = PlayerRay.getLeft();
    final Vec3d ray_to = PlayerRay.getRight();
    final RayTraceResult mop = playerIn.worldObj.getBlockState( pos ).getBlock().collisionRayTrace( playerIn.getEntityWorld().getBlockState( pos ), playerIn.worldObj, pos, ray_from, ray_to );
    if ( mop != null && mop.typeOfHit == RayTraceResult.Type.BLOCK )
    {
      final BitLocation loc = new BitLocation( mop, true, BitOperation.CHISEL );
      ClientSide.instance.pointAt( ChiselToolType.TAPEMEASURE, loc, hand );
    }
  }
  return EnumActionResult.SUCCESS;
}

代码示例来源:origin: AlgorithmX2/Chisels-and-Bits

final Vec3d ray_to = PlayerRay.getRight();
  final RayTraceResult mop = player.worldObj.getBlockState( pos ).getBlock().collisionRayTrace( player.getEntityWorld().getBlockState( pos ), player.worldObj, pos, ray_from, ray_to );
  if ( mop != null && mop.typeOfHit == RayTraceResult.Type.BLOCK )
final Vec3d ray_to = PlayerRay.getRight();
final RayTraceResult mop = player.worldObj.getBlockState( pos ).getBlock().collisionRayTrace( player.worldObj.getBlockState( pos ), player.worldObj, pos, ray_from, ray_to );
if ( mop != null && mop.typeOfHit == RayTraceResult.Type.BLOCK )

代码示例来源:origin: RS485/LogisticsPipes

private void updateSelection(Vector3d start, Vector3d end) {
  start.add(origin);
  end.add(origin);
  List<RayTraceResult> hits = new ArrayList<>();
  LogisticsBlockGenericPipe.ignoreSideRayTrace = true;
  for (DoubleCoordinates bc : configurables) {
    IBlockState bs = bc.getBlockState(world);
    Block block = bs.getBlock();
    if (block != null) {
      if(block instanceof LogisticsBlockGenericPipe) {
        cachedLPBlockTrace = LPBlocks.pipe.doRayTrace(world, bc.getBlockPos(), start.toVec3d(), end.toVec3d());
      } else {
        cachedLPBlockTrace = null;
      }
      RayTraceResult hit = block.collisionRayTrace(bc.getBlockState(world), world, bc.getBlockPos(), start.toVec3d(), end.toVec3d());
      if (hit != null) {
        hits.add(hit);
      }
    }
  }
  LogisticsBlockGenericPipe.ignoreSideRayTrace = false;
  selection = null;
  RayTraceResult hit = getClosestHit(start.toVec3d(), hits);
  if (hit != null) {
    TileEntity te = world.getTileEntity(hit.getBlockPos());
    if(te != null) {
      selection = new SelectedFace(te, hit.sideHit, hit);
    }
  }
}

代码示例来源:origin: AlgorithmX2/Chisels-and-Bits

return super.collisionRayTrace( blockState, worldIn, pos, a, b );

相关文章

Block类方法