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