當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。