当前位置: 首页>>代码示例>>Java>>正文


Java IBlockState.collisionRayTrace方法代码示例

本文整理汇总了Java中net.minecraft.block.state.IBlockState.collisionRayTrace方法的典型用法代码示例。如果您正苦于以下问题:Java IBlockState.collisionRayTrace方法的具体用法?Java IBlockState.collisionRayTrace怎么用?Java IBlockState.collisionRayTrace使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在net.minecraft.block.state.IBlockState的用法示例。


在下文中一共展示了IBlockState.collisionRayTrace方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getLookedModule

import net.minecraft.block.state.IBlockState; //导入方法依赖的package包/类
public static TubeModule getLookedModule(World world, BlockPos pos, EntityPlayer player) {
    Pair<Vec3d, Vec3d> vecs = PneumaticCraftUtils.getStartAndEndLookVec(player);
    IBlockState state = world.getBlockState(pos);
    RayTraceResult rayTraceResult = state.collisionRayTrace(world, pos, vecs.getLeft(), vecs.getRight());
    TubeHitInfo tubeHitInfo = getHitInfo(rayTraceResult);
    if (tubeHitInfo.type == TubeHitInfo.PartType.MODULE) {
        TileEntityPressureTube tube = ModInteractionUtils.getInstance().getTube(getTE(world, pos));
        return tube.modules[tubeHitInfo.dir.ordinal()];
    }
    return null;
}
 
开发者ID:TeamPneumatic,项目名称:pnc-repressurized,代码行数:12,代码来源:BlockPressureTube.java

示例2: getLookedTube

import net.minecraft.block.state.IBlockState; //导入方法依赖的package包/类
/**
 * Get the part of the tube being looked at.
 *
 * @param world the world
 * @param pos the blockpos
 * @param player the player
 * @return (true, side) if it's the side of the tube core, or (false, side) if it's a tube arm
 */
private static Pair<Boolean,EnumFacing> getLookedTube(World world, BlockPos pos, EntityPlayer player) {
    Pair<Vec3d, Vec3d> vecs = PneumaticCraftUtils.getStartAndEndLookVec(player);
    IBlockState state = world.getBlockState(pos);
    RayTraceResult rayTraceResult = state.collisionRayTrace(world, pos, vecs.getLeft(), vecs.getRight());
    TubeHitInfo tubeHitInfo = getHitInfo(rayTraceResult);
    if (tubeHitInfo.type == TubeHitInfo.PartType.TUBE) {
        // return either the tube arm (if connected), or the side of the centre face (if not)
        return tubeHitInfo.dir == null ? Pair.of(true, rayTraceResult.sideHit) : Pair.of(false, tubeHitInfo.dir);
    }
    return null;
}
 
开发者ID:TeamPneumatic,项目名称:pnc-repressurized,代码行数:20,代码来源:BlockPressureTube.java


注:本文中的net.minecraft.block.state.IBlockState.collisionRayTrace方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。