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


Java Location.getPitch方法代码示例

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


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

示例1: 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

示例2: set

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

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

		instance.set("locations." + s + ".x", x);
		instance.set("locations." + s + ".y", y);
		instance.set("locations." + s + ".z", z);
		instance.set("locations." + s + ".yaw", yaw);
		instance.set("locations." + s + ".pitch", pitch);
	}
	else {
		setting.put(s, o);
	}

	Walls.instance.saveConfig();
}
 
开发者ID:thekeenant,项目名称:mczone,代码行数:24,代码来源:Config.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: encodeLocation

import org.bukkit.Location; //导入方法依赖的package包/类
public String encodeLocation(Location location) {
    double x = webSocketServerThread.blockBridge.toWebLocationEntityX(location);
    double y = webSocketServerThread.blockBridge.toWebLocationEntityY(location);
    double z = webSocketServerThread.blockBridge.toWebLocationEntityZ(location);

    // yaw is degrees, 0(360)=+z, 180=-z, 90=-x, 270=+x
    float yaw = location.getYaw();

    // pitch is degrees, -90 (upward-facing, +y), or 0 (level), to 90 (downward facing, -y)
    float pitch = location.getPitch();

    // Craft uses radians, and flips it
    double rx = -yaw * Math.PI / 180;
    double ry = -pitch * Math.PI / 180;

    return x + "," + y + "," + z + "," + rx + "," + ry;
}
 
开发者ID:satoshinm,项目名称:WebSandboxMC,代码行数:18,代码来源:PlayersBridge.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: 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

示例7: approximateHitBoxLocation

import org.bukkit.Location; //导入方法依赖的package包/类
/**
 * Using a Minecraft core utility, this determines where against a hitbox impact occurred, if at all.
 * 
 * See hitInformation() for more details.
 * 
 * @param origin The starting point of travel
 * @param velocity The travel velocity
 * @param entity The entity to test hit box against
 * @return Location of impact, or the _origin_ if no hit detected.
 */
public static Location approximateHitBoxLocation(Location origin, Vector velocity, Entity entity) {
	
	MovingObjectPosition hit = hitInformation(origin, velocity, entity);

	if (hit == null) {
		return origin;
	} else {
		return new Location(origin.getWorld(), hit.pos.x, hit.pos.y, hit.pos.z, origin.getYaw(), origin.getPitch());
	}
}
 
开发者ID:ProgrammerDan,项目名称:AddGun,代码行数:21,代码来源:Utilities.java

示例8: detailedHitBoxLocation

import org.bukkit.Location; //导入方法依赖的package包/类
public static HitDigest detailedHitBoxLocation(Location origin, Vector velocity, Entity entity) {
	MovingObjectPosition hit = hitInformation(origin, velocity, entity);
	
	if (hit == null) {
		return new HitDigest(HitPart.MISS, origin);
	} else {
		HitPart part = HitPart.MISS;
		net.minecraft.server.v1_12_R1.Entity hitentity = ((CraftEntity) entity).getHandle();
		//double locX = hitentity.locX;
		double locY = hitentity.locY;
		//double locZ = hitentity.locZ;
		//double hitX = hit.pos.x;
		double hitY = hit.pos.y;
		//double hitZ = hit.pos.z;
		double height = entity.getHeight();
		double head = hitentity.getHeadHeight();
		double midsection = (height - head > 0) ? (height - head) / 2 : height / 2;
		double legs = (height - head > 0) ? (height - head) / 5 : height / 5;

		if (hitY < locY + height && hitY >= locY + head) {
			part = HitPart.HEAD;
		} else if (hitY < locY + head && hitY >= locY + midsection) {
			part = HitPart.BODY;
		} else if (hitY < locY + midsection && hitY >= locY + legs) {
			part = HitPart.LEGS;
		} else if (hitY < locY + legs && hitY >= locY) {
			part = HitPart.FEET;
		}
		
		return new HitDigest(part, new Location(origin.getWorld(), hit.pos.x, hit.pos.y, hit.pos.z, origin.getYaw(), origin.getPitch()));
	}
}
 
开发者ID:ProgrammerDan,项目名称:AddGun,代码行数:33,代码来源:Utilities.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: cloneWith

import org.bukkit.Location; //导入方法依赖的package包/类
public static Location cloneWith(Location original, Vector position) {
    return new Location(original.getWorld(),
                        position.getX(),
                        position.getY(),
                        position.getZ(),
                        original.getYaw(),
                        original.getPitch());
}
 
开发者ID:OvercastNetwork,项目名称:ProjectAres,代码行数:9,代码来源:Locations.java

示例11: 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:HuliPvP,项目名称:Chambers,代码行数:11,代码来源:LocationUtil.java

示例12: 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

示例13: 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

示例14: locationToString

import org.bukkit.Location; //导入方法依赖的package包/类
/**
 * Util method to convert a Location to a String. This method can be useful
 * when working with config files.
 * 
 * @param location
 *            The location to convert into string. It can either contain yaw
 *            and pitch or not.
 *            <p>
 * @return The input Location in string format.
 */
public static String locationToString(Location location) {
	String w = location.getWorld().getName();
	double x = location.getBlockX();
	double y = location.getBlockY();
	double z = location.getBlockZ();

	if ((location.getYaw() == 0.0F) && (location.getPitch() == 0.0F))
		return w + "," + x + "," + y + "," + z;

	float yaw = location.getYaw();
	float pitch = location.getPitch();
	return w + "," + x + "," + y + "," + z + "," + yaw + "," + pitch;
}
 
开发者ID:kadeska,项目名称:MT_Core,代码行数:24,代码来源:StringUtilities.java

示例15: 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


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