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