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


Java ICommandSender.getPositionVector方法代码示例

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


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

示例1: cacheKey

import net.minecraft.command.ICommandSender; //导入方法依赖的package包/类
private static String cacheKey(ICommandSender sender) {
    if (sender.getCommandSenderEntity() != null) {
        // ez pz, use the UUID
        return sender.getCommandSenderEntity().getCachedUniqueIdString();
    }
    // panic! use the position like it's a block or something!
    // also prepend the simple class name so that we can still kinda cache
    // the server, rcon, etc.
    Vec3d vec = sender.getPositionVector();
    return sender.getClass().getSimpleName() + "[" + vec.x + "," + vec.y + "," + vec.z + "]";
}
 
开发者ID:kenzierocks,项目名称:HardVox,代码行数:12,代码来源:SessionManager.java

示例2: execute

import net.minecraft.command.ICommandSender; //导入方法依赖的package包/类
/**
 * Callback for when the command is executed
 */
public void execute(MinecraftServer server, ICommandSender sender, String[] args) throws CommandException
{
    if (args.length < 4)
    {
        throw new WrongUsageException("commands.teleport.usage", new Object[0]);
    }
    else
    {
        Entity entity = getEntity(server, sender, args[0]);

        if (entity.world != null)
        {
            int i = 4096;
            Vec3d vec3d = sender.getPositionVector();
            int j = 1;
            CommandBase.CoordinateArg commandbase$coordinatearg = parseCoordinate(vec3d.xCoord, args[j++], true);
            CommandBase.CoordinateArg commandbase$coordinatearg1 = parseCoordinate(vec3d.yCoord, args[j++], -4096, 4096, false);
            CommandBase.CoordinateArg commandbase$coordinatearg2 = parseCoordinate(vec3d.zCoord, args[j++], true);
            Entity entity1 = sender.getCommandSenderEntity() == null ? entity : sender.getCommandSenderEntity();
            CommandBase.CoordinateArg commandbase$coordinatearg3 = parseCoordinate(args.length > j ? (double)entity1.rotationYaw : (double)entity.rotationYaw, args.length > j ? args[j] : "~", false);
            ++j;
            CommandBase.CoordinateArg commandbase$coordinatearg4 = parseCoordinate(args.length > j ? (double)entity1.rotationPitch : (double)entity.rotationPitch, args.length > j ? args[j] : "~", false);
            doTeleport(entity, commandbase$coordinatearg, commandbase$coordinatearg1, commandbase$coordinatearg2, commandbase$coordinatearg3, commandbase$coordinatearg4);
            notifyCommandListener(sender, this, "commands.teleport.success.coordinates", new Object[] {entity.getName(), Double.valueOf(commandbase$coordinatearg.getResult()), Double.valueOf(commandbase$coordinatearg1.getResult()), Double.valueOf(commandbase$coordinatearg2.getResult())});
        }
    }
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:31,代码来源:CommandTeleport.java

示例3: execute

import net.minecraft.command.ICommandSender; //导入方法依赖的package包/类
/**
 * Callback for when the command is executed
 */
public void execute(MinecraftServer server, ICommandSender sender, String[] args) throws CommandException
{
    if (args.length < 4)
    {
        throw new WrongUsageException("commands.teleport.usage", new Object[0]);
    }
    else
    {
        Entity entity = getEntity(server, sender, args[0]);

        if (entity.worldObj != null)
        {
            int i = 4096;
            Vec3d vec3d = sender.getPositionVector();
            int j = 1;
            CommandBase.CoordinateArg commandbase$coordinatearg = parseCoordinate(vec3d.xCoord, args[j++], true);
            CommandBase.CoordinateArg commandbase$coordinatearg1 = parseCoordinate(vec3d.yCoord, args[j++], -4096, 4096, false);
            CommandBase.CoordinateArg commandbase$coordinatearg2 = parseCoordinate(vec3d.zCoord, args[j++], true);
            Entity entity1 = sender.getCommandSenderEntity() == null ? entity : sender.getCommandSenderEntity();
            CommandBase.CoordinateArg commandbase$coordinatearg3 = parseCoordinate(args.length > j ? (double)entity1.rotationYaw : (double)entity.rotationYaw, args.length > j ? args[j] : "~", false);
            ++j;
            CommandBase.CoordinateArg commandbase$coordinatearg4 = parseCoordinate(args.length > j ? (double)entity1.rotationPitch : (double)entity.rotationPitch, args.length > j ? args[j] : "~", false);
            doTeleport(entity, commandbase$coordinatearg, commandbase$coordinatearg1, commandbase$coordinatearg2, commandbase$coordinatearg3, commandbase$coordinatearg4);
            notifyCommandListener(sender, this, "commands.teleport.success.coordinates", new Object[] {entity.getName(), Double.valueOf(commandbase$coordinatearg.getResult()), Double.valueOf(commandbase$coordinatearg1.getResult()), Double.valueOf(commandbase$coordinatearg2.getResult())});
        }
    }
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:31,代码来源:CommandTeleport.java


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