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


Java RayTracer.retraceBlock方法代码示例

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


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

示例1: onBlockActivated

import codechicken.lib.raytracer.RayTracer; //导入方法依赖的package包/类
@Override
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing side, float hitX, float hitY, float hitZ) {
    if (world.isRemote) {
        return true;
    }

    RayTraceResult hit = RayTracer.retraceBlock(world, player, pos);
    TileCraftingGrid tcraft = (TileCraftingGrid) world.getTileEntity(pos);

    if (hit != null) {
        if (hit.subHit > 0) {
            tcraft.activate(hit.subHit - 1, player);
        }
        return true;
    }
    return false;
}
 
开发者ID:TheCBProject,项目名称:Translocators,代码行数:18,代码来源:BlockCraftingGrid.java

示例2: onBlockActivated

import codechicken.lib.raytracer.RayTracer; //导入方法依赖的package包/类
@Override
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing side, float hitX, float hitY, float hitZ) {

    if (world.isRemote) {
        return true;
    }

    RayTraceResult hit = RayTracer.retraceBlock(world, player, pos);
    TileTranslocator ttrans = (TileTranslocator) world.getTileEntity(pos);

    if (hit != null && ttrans != null) {
        if (hit.subHit < 6) {
            Vector3 vhit = new Vector3(hit.hitVec);
            vhit.add(-pos.getX() - 0.5, -pos.getY() - 0.5, -pos.getZ() - 0.5);
            vhit.apply(Rotation.sideRotations[hit.subHit % 6].inverse());
            if (MathHelper.between(-2 / 16D, vhit.x, 2 / 16D) && MathHelper.between(-2 / 16D, vhit.z, 2 / 16D)) {
                hit.subHit += 6;
            }
        }

        return ttrans.attachments[hit.subHit % 6].activate(player, hit.subHit / 6);
    }

    return false;
}
 
开发者ID:TheCBProject,项目名称:Translocators,代码行数:26,代码来源:BlockTranslocator.java

示例3: removedByPlayer

import codechicken.lib.raytracer.RayTracer; //导入方法依赖的package包/类
@Override
public boolean removedByPlayer(IBlockState state, World world, BlockPos pos, EntityPlayer player, boolean willHarvest) {

    RayTraceResult hit = RayTracer.retraceBlock(world, player, pos);
    if (hit == null) {
        return false;
    }

    TileTranslocator ttrans = (TileTranslocator) world.getTileEntity(pos);
    return ttrans.harvestPart(hit.subHit % 6, !player.capabilities.isCreativeMode);
}
 
开发者ID:TheCBProject,项目名称:Translocators,代码行数:12,代码来源:BlockTranslocator.java

示例4: onSneakRightClick

import codechicken.lib.raytracer.RayTracer; //导入方法依赖的package包/类
@Override
public boolean onSneakRightClick(EntityPlayer player, int side)
{
	if(!world().isRemote)
	{
		ExtendedMOP hit = (ExtendedMOP)RayTracer.retraceBlock(world(), player, x(), y(), z());

		if(hit == null)
		{
			return false;
		}
		else if(hit.subHit < 6)
		{
			connectionTypes[hit.subHit] = connectionTypes[hit.subHit].next();
			sendDesc = true;

			onModeChange(ForgeDirection.getOrientation(hit.subHit));
			player.addChatMessage(new ChatComponentText("Connection type changed to " + connectionTypes[hit.subHit].toString()));

			return true;
		}
		else {
			return onConfigure(player, hit.subHit, side);
		}
	}
	
	return true;
}
 
开发者ID:Microsoft,项目名称:vsminecraft,代码行数:29,代码来源:PartSidedPipe.java


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