本文整理汇总了Java中codechicken.lib.raytracer.RayTracer.retrace方法的典型用法代码示例。如果您正苦于以下问题:Java RayTracer.retrace方法的具体用法?Java RayTracer.retrace怎么用?Java RayTracer.retrace使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类codechicken.lib.raytracer.RayTracer
的用法示例。
在下文中一共展示了RayTracer.retrace方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: traceEntity
import codechicken.lib.raytracer.RayTracer; //导入方法依赖的package包/类
public static Entity traceEntity(EntityPlayerMP player, float reach) {
return RayTracer.retrace(player, reach).entityHit;
}
示例2: handleCommand
import codechicken.lib.raytracer.RayTracer; //导入方法依赖的package包/类
@Override
public void handleCommand(EntityPlayer player, String[] args)
{
if (args.length < 2 || args.length > 4)
{
player.addChatMessage(new TextComponentString("/tt-schematic block <function> [Used to interact with the structure builder block you are looking at]"));
return;
}else
{
RayTraceResult mop = RayTracer.retrace(player, 50);
if (mop == null || mop.typeOfHit != RayTraceResult.Type.BLOCK || player.worldObj.getBlockState(mop.getBlockPos()).getBlock() != TBFeatures.structureBuilder)
{
player.addChatMessage(new TextComponentString("Did not find Structure Builder! [you must be looking at a structure builder block to use this command]"));
return;
}
TileStructureBuilder tile = player.worldObj.getTileEntity(mop.getBlockPos()) instanceof TileStructureBuilder ? (TileStructureBuilder) player.worldObj.getTileEntity(mop.getBlockPos()) : null;
if (tile == null)
{
player.addChatMessage(new TextComponentString("[ERROR 404] Block tile entity not found"));
return;
}
if (args[1].equals("set"))
{
if (args.length != 3)
{
player.addChatMessage(new TextComponentString("/tt-schematic block set <schematic name>"));
return;
}
if ( SchematicHandler.getFile(args[2]) == null)
{
player.addChatMessage(new TextComponentString(args[2] + " Dose not exist"));
return;
}
NBTTagCompound compound = null;
try
{
compound = SchematicHandler.loadCompoundFromFile(args[2]);
}
catch (SchematicHandler.SchematicException e)
{
e.printStackTrace();
}
tile.schematic.value = args[2];
tile.xSize.value = compound.getShort("Width");
tile.ySize.value = compound.getShort("Height");
tile.zSize.value = compound.getShort("Length");
player.addChatMessage(new TextComponentString(args[2] + " Bound to block"));
// player.worldObj.markBlockForUpdate(mop.blockX, mop.blockY, mop.blockZ);
}
else if (args[1].equals("toggleview"))
{
tile.showPosition.value = !tile.showPosition.value;
// player.worldObj.markBlockForUpdate(mop.blockX, mop.blockY, mop.blockZ);
}
tile.updateBlock();
}
}