Java Code Examples for org.bukkit.Location#getPitch()
The following examples show how to use
org.bukkit.Location#getPitch() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: LocationListFlag.java From HeavySpleef with GNU General Public License v3.0 | 6 votes |
@Override public void marshalListItem(Element element, Location item) { Element worldElement = element.addElement("world"); Element xElement = element.addElement("x"); Element yElement = element.addElement("y"); Element zElement = element.addElement("z"); worldElement.addText(item.getWorld().getName()); xElement.addText(String.valueOf(item.getX())); yElement.addText(String.valueOf(item.getY())); zElement.addText(String.valueOf(item.getZ())); if (item.getYaw() != 0f) { element.addElement("yaw").addText(String.valueOf(item.getYaw())); } if (item.getPitch() != 0f) { element.addElement("pitch").addText(String.valueOf(item.getPitch())); } }
Example 2
Source File: Loc.java From AnnihilationPro with MIT License | 6 votes |
public Loc(Location loc, boolean precise) { this.world = loc.getWorld().getName(); if(precise) { x = loc.getX(); y = loc.getY(); z = loc.getZ(); pitch = loc.getPitch(); yaw = loc.getYaw(); } else { x = loc.getBlockX(); y = loc.getBlockY(); z = loc.getBlockZ(); pitch = 0; yaw = 0; } }
Example 3
Source File: MethodAPI_v1_11_R1.java From TAB with Apache License 2.0 | 5 votes |
public Object newPacketPlayOutEntityTeleport(Object entityliving, Location loc) { EntityLiving entity = (EntityLiving) entityliving; entity.locX = loc.getX(); entity.locY = loc.getY(); entity.locZ = loc.getZ(); entity.yaw = loc.getYaw(); entity.pitch = loc.getPitch(); return new PacketPlayOutEntityTeleport(entity); }
Example 4
Source File: MethodAPI_v1_10_R1.java From TAB with Apache License 2.0 | 5 votes |
public Object newPacketPlayOutEntityTeleport(Object entityliving, Location loc) { EntityLiving entity = (EntityLiving) entityliving; entity.locX = loc.getX(); entity.locY = loc.getY(); entity.locZ = loc.getZ(); entity.yaw = loc.getYaw(); entity.pitch = loc.getPitch(); return new PacketPlayOutEntityTeleport(entity); }
Example 5
Source File: MethodAPI_v1_12_R1.java From TAB with Apache License 2.0 | 5 votes |
public Object newPacketPlayOutEntityTeleport(Object entityliving, Location loc) { EntityLiving entity = (EntityLiving) entityliving; entity.locX = loc.getX(); entity.locY = loc.getY(); entity.locZ = loc.getZ(); entity.yaw = loc.getYaw(); entity.pitch = loc.getPitch(); return new PacketPlayOutEntityTeleport(entity); }
Example 6
Source File: MethodAPI_v1_7_R3.java From TAB with Apache License 2.0 | 5 votes |
public Object newPacketPlayOutEntityTeleport(Object entityliving, Location loc) { EntityLiving entity = (EntityLiving) entityliving; entity.locX = loc.getX(); entity.locY = loc.getY(); entity.locZ = loc.getZ(); entity.yaw = loc.getYaw(); entity.pitch = loc.getPitch(); return new PacketPlayOutEntityTeleport(entity); }
Example 7
Source File: MiddleSetPosition.java From ProtocolSupport with GNU Affero General Public License v3.0 | 5 votes |
@Override protected void readServerData(ByteBuf serverdata) { xOrig = x = serverdata.readDouble(); yOrig = y = serverdata.readDouble(); zOrig = z = serverdata.readDouble(); yawOrig = yaw = serverdata.readFloat(); pitchOrig = pitch = serverdata.readFloat(); flags = serverdata.readByte(); if (flags != 0) { Location location = connection.getPlayer().getLocation(); if ((flags & 0x01) != 0) { x += location.getX(); } if ((flags & 0x02) != 0) { y += location.getY(); } if ((flags & 0x04) != 0) { z += location.getX(); } if ((flags & 0x08) != 0) { pitch += location.getPitch(); } if ((flags & 0x10) != 0) { yaw += location.getYaw(); } } teleportConfirmId = VarNumberSerializer.readVarInt(serverdata); }
Example 8
Source File: MethodAPI_v1_5_R2.java From TAB with Apache License 2.0 | 5 votes |
public Object newPacketPlayOutEntityTeleport(Object entityliving, Location loc) { EntityLiving entity = (EntityLiving) entityliving; entity.locX = loc.getX(); entity.locY = loc.getY(); entity.locZ = loc.getZ(); entity.yaw = loc.getYaw(); entity.pitch = loc.getPitch(); return new Packet34EntityTeleport(entity); }
Example 9
Source File: MethodAPI_v1_6_R3.java From TAB with Apache License 2.0 | 5 votes |
public Object newPacketPlayOutEntityTeleport(Object entityliving, Location loc) { EntityLiving entity = (EntityLiving) entityliving; entity.locX = loc.getX(); entity.locY = loc.getY(); entity.locZ = loc.getZ(); entity.yaw = loc.getYaw(); entity.pitch = loc.getPitch(); return new Packet34EntityTeleport(entity); }
Example 10
Source File: MethodAPI_v1_13_R1.java From TAB with Apache License 2.0 | 5 votes |
public Object newPacketPlayOutEntityTeleport(Object entityliving, Location loc) { EntityLiving entity = (EntityLiving) entityliving; entity.locX = loc.getX(); entity.locY = loc.getY(); entity.locZ = loc.getZ(); entity.yaw = loc.getYaw(); entity.pitch = loc.getPitch(); return new PacketPlayOutEntityTeleport(entity); }
Example 11
Source File: MethodAPI_v1_14_R1.java From TAB with Apache License 2.0 | 5 votes |
public Object newPacketPlayOutEntityTeleport(Object entityliving, Location loc) { EntityLiving entity = (EntityLiving) entityliving; entity.locX = loc.getX(); entity.locY = loc.getY(); entity.locZ = loc.getZ(); entity.yaw = loc.getYaw(); entity.pitch = loc.getPitch(); return new PacketPlayOutEntityTeleport(entity); }
Example 12
Source File: MethodAPI_v1_5_R3.java From TAB with Apache License 2.0 | 5 votes |
public Object newPacketPlayOutEntityTeleport(Object entityliving, Location loc) { EntityLiving entity = (EntityLiving) entityliving; entity.locX = loc.getX(); entity.locY = loc.getY(); entity.locZ = loc.getZ(); entity.yaw = loc.getYaw(); entity.pitch = loc.getPitch(); return new Packet34EntityTeleport(entity); }
Example 13
Source File: MobSelector.java From CloudNet with Apache License 2.0 | 5 votes |
public MobPosition toPosition(String group, Location location) { return new MobPosition(group, location.getWorld().getName(), location.getX(), location.getY(), location.getZ(), location.getYaw(), location.getPitch()); }
Example 14
Source File: PacketPlayOutSpawnEntityLiving.java From TAB with Apache License 2.0 | 5 votes |
public PacketPlayOutSpawnEntityLiving(int entityId, UUID uuid, int entityType, Location loc) { if (loc == null) throw new IllegalArgumentException("Location cannot be null"); this.entityId = entityId; this.uuid = uuid; this.entityType = entityType; this.x = loc.getX(); this.y = loc.getY(); this.z = loc.getZ(); this.yaw = loc.getYaw(); this.pitch = loc.getPitch(); }
Example 15
Source File: RotationUtil.java From AACAdditionPro with GNU General Public License v3.0 | 4 votes |
/** * Determines if two {@link Location}s are facing in the same direction, i.e. the yaw and pitch are the same. */ public static boolean sameDirection(final Location one, final Location two) { return one.getYaw() == two.getYaw() && one.getPitch() == two.getPitch(); }
Example 16
Source File: GameFile.java From ZombieEscape with GNU General Public License v2.0 | 4 votes |
public String serializeLocation(Location location) { return location.getX() + " " + location.getY() + " " + location.getZ() + " " + location.getYaw() + " " + location.getPitch(); }
Example 17
Source File: OrphanLogic.java From uSkyBlock with GNU General Public License v3.0 | 4 votes |
public boolean wasOrphan(Location loc) { return loc != null && loc.getYaw() == ORPHAN_YAW && loc.getPitch() == ORPHAN_PITCH; }
Example 18
Source File: MiscUtils.java From BedWars with GNU Lesser General Public License v3.0 | 4 votes |
public static String setLocationToString(Location location) { return location.getX() + ";" + location.getY() + ";" + location.getZ() + ";" + location.getYaw() + ";" + location.getPitch(); }
Example 19
Source File: Buildable.java From civcraft with GNU General Public License v2.0 | 4 votes |
protected Location repositionCenter(Location center, String dir, double x_size, double z_size) throws CivException { Location loc = new Location(center.getWorld(), center.getX(), center.getY(), center.getZ(), center.getYaw(), center.getPitch()); // Reposition tile improvements if (this.isTileImprovement()) { // just put the center at 0,0 of this chunk? loc = center.getChunk().getBlock(0, center.getBlockY(), 0).getLocation(); } else { if (dir.equalsIgnoreCase("east")) { loc.setZ(loc.getZ() - (z_size / 2)); loc = center.getChunk().getBlock(0, center.getBlockY(), 0).getLocation(); loc.setX(loc.getX() + SHIFT_OUT); } else if (dir.equalsIgnoreCase("west")) { loc.setZ(loc.getZ() - (z_size / 2)); loc = center.getChunk().getBlock(0, center.getBlockY(), 0).getLocation(); loc.setX(loc.getX() - (SHIFT_OUT+x_size)); } else if (dir.equalsIgnoreCase("north")) { loc.setX(loc.getX() - (x_size / 2)); loc = center.getChunk().getBlock(0, center.getBlockY(), 0).getLocation(); loc.setZ(loc.getZ() - (SHIFT_OUT+z_size)); } else if (dir.equalsIgnoreCase("south")) { loc.setX(loc.getX() - (x_size / 2)); loc = center.getChunk().getBlock(0, center.getBlockY(), 0).getLocation(); loc.setZ(loc.getZ() + SHIFT_OUT); } } if (this.getTemplateYShift() != 0) { // Y-Shift based on the config, this allows templates to be built underground. loc.setY(loc.getY() + this.getTemplateYShift()); if (loc.getY() < 1) { throw new CivException("Cannot build here, too close to bedrock."); } } return loc; }
Example 20
Source File: LocationUtil.java From Holograms with MIT License | 2 votes |
/** * Converts a Location into a String * * @param location A location to be converted * @return A string representation of the Location */ public static String locationAsString(Location location) { return location.getWorld().getName() + ";" + location.getX() + ";" + location.getY() + ";" + location.getZ() + ";" + location.getPitch() + ";" + location.getYaw(); }