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


Java Location.getYaw方法代码示例

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


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

示例1: getLocationBehondPlayer

import org.bukkit.Location; //导入方法依赖的package包/类
/***
 * Locations side
 ***/

public Location getLocationBehondPlayer(Location referential, double radius)
{
    float yaw = referential.getYaw();
    float finalYaw = yaw - 90;

    double relativeX = Math.cos(Math.toRadians(finalYaw)) * radius;
    double relativeZ = Math.sin(Math.toRadians(finalYaw)) * radius;
    double relativeY = -0.90;

    return new Location(referential.getWorld(),
            referential.getX() + relativeX,
            referential.getY() + relativeY,
            referential.getZ() + relativeZ
    );
}
 
开发者ID:SamaGames,项目名称:AntiCheat,代码行数:20,代码来源:KillAuraTask.java

示例2: Uncarried

import org.bukkit.Location; //导入方法依赖的package包/类
public Uncarried(Flag flag, Post post, @Nullable Location location) {
    super(flag, post);
    if(location == null) location = flag.getReturnPoint(post);
    this.location = new Location(location.getWorld(),
                                 location.getBlockX() + 0.5,
                                 location.getBlockY(),
                                 location.getBlockZ() + 0.5,
                                 location.getYaw(),
                                 location.getPitch());

    if(!flag.getMatch().getWorld().equals(this.location.getWorld())) {
        throw new IllegalStateException("Tried to place flag in the wrong world");
    }

    Block block = this.location.getBlock();
    if(block.getType() == Material.STANDING_BANNER) {
        // Banner may already be here at match start
        this.oldBlock = BlockStateUtils.cloneWithMaterial(block, Material.AIR);
    } else {
        this.oldBlock = block.getState();
    }
    this.oldBase = block.getRelative(BlockFace.DOWN).getState();
}
 
开发者ID:OvercastNetwork,项目名称:ProjectAres,代码行数:24,代码来源:Uncarried.java

示例3: set

import org.bukkit.Location; //导入方法依赖的package包/类
public void set(String s, Object o) {
	if (o instanceof Location) {
		Location l = (Location) o;

        String world = l.getWorld().getName();
		double x = l.getX();
		double y = l.getY();
		double z = l.getZ();
		double yaw = l.getYaw();
		double pitch = l.getPitch();

           config.set(s + ".world", world);
           config.set(s + ".x", x);
		config.set(s + ".y", y);
		config.set(s + ".z", z);
		config.set(s + ".yaw", yaw);
		config.set(s + ".pitch", pitch);
	}
	else {
		config.set(s, o);
	}
}
 
开发者ID:thekeenant,项目名称:mczone,代码行数:23,代码来源:ConfigAPI.java

示例4: getYawBetween

import org.bukkit.Location; //导入方法依赖的package包/类
public static double getYawBetween(Location from, Location to) {
	final Location change = from.clone();

	final Vector start = change.toVector();
	final Vector target = to.toVector();

	// Get the difference between the two locations and set this as the
	// direction (the direct line from location to location).
	change.setDirection(target.subtract(start));

	return change.getYaw();
}
 
开发者ID:davidm98,项目名称:Crescent,代码行数:13,代码来源:Helper.java

示例5: Position

import org.bukkit.Location; //导入方法依赖的package包/类
public Position(Location location) {
    x = location.getX();
    y = location.getY();
    z = location.getZ();
    yaw = location.getYaw();
    pitch = location.getPitch();
}
 
开发者ID:upperlevel,项目名称:uppercore,代码行数:8,代码来源:Position.java

示例6: onRun

import org.bukkit.Location; //导入方法依赖的package包/类
@Override
public void onRun() {
    if (font == null) {
        cancel();
        return;
    }
    Location location = getLocation();
    location.add(0, 1.2, 0);
    if(!lockedYaw) {
        yaw = -location.getYaw();
        dir = location.getDirection();
        dir = dir.normalize().setY(0);
        lockedYaw = true;
    }
    location.add(dir);
    try {
        if (image == null) {
            image = StringParser.stringToBufferedImage(font, text);
        }
        for (int y = 0; y < image.getHeight(); y += stepY) {
            for (int x = 0; x < image.getWidth(); x += stepX) {
                int clr = image.getRGB(image.getWidth() - 1 - x, y);
                if (clr != Color.black.getRGB())
                    continue;
                Vector v = new Vector((float) image.getWidth() / 2 - x, (float) image.getHeight() / 2 - y, 0).multiply(size);
                VectorUtils.rotateAroundAxisY(v, yaw * MathUtils.degreesToRadians);
                display(particle, location.add(v));
                location.subtract(v);
            }
        }
    } catch (Exception ex) {
        cancel(true);
    }
}
 
开发者ID:edasaki,项目名称:ZentrelaRPG,代码行数:35,代码来源:InfernoTagEffect.java

示例7: getLoc

import org.bukkit.Location; //导入方法依赖的package包/类
@Override
public Loc getLoc() {
	Location location = this.player.getLocation();
	
	return new Loc(
		location.getWorld().getUID(), 
		location.getX(), 
		location.getY(), 
		location.getZ(), 
		location.getYaw(),
		location.getPitch()
	);
}
 
开发者ID:redstone,项目名称:RCameraStudio,代码行数:14,代码来源:BukkitTraveller.java

示例8: locationToString

import org.bukkit.Location; //导入方法依赖的package包/类
public static String locationToString(Location loc, boolean yawAndPitch){
	String str = loc.getWorld().getName() + ", " + loc.getX() + ", " + loc.getY() + ", " + loc.getZ();
	if(yawAndPitch){
		str += ", " + loc.getYaw() + ", " + loc.getPitch();
	}
	return str;
}
 
开发者ID:benNek,项目名称:AsgardAscension,代码行数:8,代码来源:Convert.java

示例9: toTag

import org.bukkit.Location; //导入方法依赖的package包/类
public static Tag toTag(Location location)
{
	if(location == null)
		throw new IllegalArgumentException("Cannot convert null location to tag");
	
	return new Tag(
			"world", location.getWorld().getName(),
			"x", location.getX(),
			"y", location.getY(),
			"z", location.getZ(),
			"yaw", location.getYaw(),
			"pitch", location.getPitch()
	);
}
 
开发者ID:timtomtim7,项目名称:SparseBukkitAPI,代码行数:15,代码来源:TagUtils.java

示例10: LocationBuilder

import org.bukkit.Location; //导入方法依赖的package包/类
/**
 * Initializes a new LocationBuilder from the given BukkitLocation
 *
 * @param location location
 */
public LocationBuilder(Location location) {
    super();
    if (location == null)
        throw new IllegalArgumentException("Location cannot be null!");
    this.world = location.getWorld().getName();
    this.x = location.getX();
    this.y = location.getY();
    this.z = location.getZ();
    this.yaw = location.getYaw();
    this.pitch = location.getPitch();
}
 
开发者ID:Shynixn,项目名称:AstralEdit,代码行数:17,代码来源:LocationBuilder.java

示例11: LoggerEntityHuman

import org.bukkit.Location; //导入方法依赖的package包/类
private LoggerEntityHuman(Player player, WorldServer world) {
    super(MinecraftServer.getServer(), world, new GameProfile(player.getUniqueId(), player.getName()), new PlayerInteractManager((World)world));
    Location location = player.getLocation();
    double x = location.getX();
    double y = location.getY();
    double z = location.getZ();
    float yaw = location.getYaw();
    float pitch = location.getPitch();
    new FakePlayerConnection(this);
    this.playerConnection.a(x, y, z, yaw, pitch);
    EntityPlayer originPlayer = ((CraftPlayer)player).getHandle();
    this.lastDamager = originPlayer.lastDamager;
    this.invulnerableTicks = originPlayer.invulnerableTicks;
    this.combatTracker = originPlayer.combatTracker;
}
 
开发者ID:funkemunky,项目名称:HCFCore,代码行数:16,代码来源:LoggerEntityHuman.java

示例12: serializeLocation

import org.bukkit.Location; //导入方法依赖的package包/类
public static String serializeLocation(Location l) {
    String s = "";
    s = s + "@w;" + l.getWorld().getName();
    s = s + ":@x;" + l.getX();
    s = s + ":@y;" + l.getY();
    s = s + ":@z;" + l.getZ();
    s = s + ":@p;" + l.getPitch();
    s = s + ":@ya;" + l.getYaw();
    return s;
}
 
开发者ID:ijoeleoli,项目名称:ServerCommons,代码行数:11,代码来源:LocationSerialization.java

示例13: submitReport

import org.bukkit.Location; //导入方法依赖的package包/类
private static void submitReport(Player reporter, String type, String subject, String description) {
    Location loc = reporter.getLocation();
    String message = "" +
            "New **" + type + "** report from `" + reporter.getName() + "`\n" +
            "Time: `" + new Date().toString() + "`\n" +
            (subject != null ? "Subject: `" + subject + "`\n" : "") +
            "Teleport: `/tl " + loc.getBlockX() + " " + loc.getBlockY() + " " + loc.getBlockZ() + " " + (int) loc.getYaw() + " " + (int) loc.getPitch() + " " + loc.getWorld().getName() + "`\n" +
            "Description:\n" +
            "```\n" +
            description + "\n" +
            "```";
    DiscordAPI.sendMessage(DiscordChannel.REPORTS, message);
    reporter.sendMessage(prefix + Utils.randElement(exitMessages));
}
 
开发者ID:Kneesnap,项目名称:Kineticraft,代码行数:15,代码来源:CommandReport.java

示例14: toPosition

import org.bukkit.Location; //导入方法依赖的package包/类
public MobPosition toPosition(String group, Location location)
{
    return new MobPosition(group, location.getWorld().getName(), location.getX(), location.getY(), location.getZ(), location.getYaw(), location.getPitch());
}
 
开发者ID:Dytanic,项目名称:CloudNet,代码行数:5,代码来源:MobSelector.java

示例15: encodeLocation

import org.bukkit.Location; //导入方法依赖的package包/类
public static String encodeLocation(Location object) {
    return object.getWorld().getName() + "@" + object.getX() + "@" + object.getY() + "@" + object.getZ()
            + "@" + object.getYaw() + "@" + object.getPitch();
}
 
开发者ID:redraskal,项目名称:GhostScavengerHunt,代码行数:5,代码来源:ConfigUtils.java


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