本文整理汇总了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;
}
示例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;
}
示例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);
}
示例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;
}