类的使用
org.bukkit.Location
程序包
说明
Bukkit的常用类.
用于操作在
世界
内的三位像素(方块),包括一些特定的状态.与处理玩家输入的非聊天消息(即命令)相关的类.
为在
世界
内存在的非三维像素单位(实体)提供的接口,包含玩家、怪物、抛射物等.简化
世界
生成实现的类.参与操作玩家物品栏和物品交互的类.
提供多种目的和单一目的的类以简化各种编程概念.
-
org.bukkit中Location的使用
修饰符和类型方法说明Location.add
(double x, double y, double z) 将本位置的坐标加上另一个位置的坐标.将本位置的坐标加上另一个位置的坐标.将本位置的坐标加上一个向量的坐标.Location.clone()
static Location
Location.deserialize
(Map<String, Object> args) 实现配置序列化与反序列化所需方法.TravelAgent.findOrCreate
(Location location) 尝试寻找指定方位附近的传送门,如果找不到则会尝试生成一个。TravelAgent.findPortal
(Location location) 尝试寻找指定方位附近的传送门。OfflinePlayer.getBedSpawnLocation()
获取该玩家在床的重生点的Location对象,但如果该玩家从未使用过床或该重生点无效,则会返回nullWorldBorder.getCenter()
得到当前边界的中心.World.getSpawnLocation()
获取这个世界的默认出生点位置
.Location.multiply
(double m) 坐标数乘, 将所有坐标轴上扩展某个倍数.Location.setDirection
(Vector vector) Location.subtract
(double x, double y, double z) 从本位置的坐标中减去另一个位置的坐标.将本位置的坐标减去另一个位置的坐标.从本位置的坐标中减去向量的坐标.Location.zero()
清零此位置的xyz坐标数值.修饰符和类型方法说明将本位置的坐标加上另一个位置的坐标.boolean
World.createExplosion
(Location loc, float power) 在指定坐标生成指定威力的爆炸.boolean
World.createExplosion
(Location loc, float power, boolean setFire) 在指定的坐标生成指定威力的爆炸并设置方块是否会着火.boolean
TravelAgent.createPortal
(Location location) 尝试在指定方位附近生成一个传送门。double
获取本位置与与另一个位置之间的距离.double
Location.distanceSquared
(Location o) 获取本位置与与另一个位置之间的距离的平方.在指定的位置
丢出一个物品.World.dropItemNaturally
(Location location, ItemStack item) 在指定的位置
丢出一个随机偏移的物品.TravelAgent.findOrCreate
(Location location) 尝试寻找指定方位附近的传送门,如果找不到则会尝试生成一个。TravelAgent.findPortal
(Location location) 尝试寻找指定方位附近的传送门。boolean
World.generateTree
(Location location, TreeType type) 在指定的位置
创建一颗树.boolean
World.generateTree
(Location loc, TreeType type, BlockChangeDelegate delegate) 已过时。该API很少使用,基本上是出于实现自身功能的目的而创造的World.getBlockAt
(Location location) int
World.getBlockTypeIdAt
(Location location) 已过时。不安全的参数World.getChunkAt
(Location location) World.getHighestBlockAt
(Location location) 获取指定位置
的最顶上的方块(不是空气).int
World.getHighestBlockYAt
(Location location) Gets the y coordinate of the lowest block at the givenLocation
such that the block and all blocks above it are transparent for lighting purposes.World.getNearbyEntities
(Location location, double x, double y, double z) 返回一个以这个位置为中心的包围着的所有实体的列表(译注:这个可能不太好理解,就是在这个位置,按指定的搜索范围,搜索这个范围里的所有实体).boolean
检查指定的位置是否在这个边界里面.void
World.playEffect
(Location location, Effect effect, int data) 向以指定位置为圆心的默认半径内的所有玩家施加(给予)一个效果.void
World.playEffect
(Location location, Effect effect, int data, int radius) 向在以指定位置为圆心的指定半径内的所有玩家施加(给予)一个效果。<T> void
World.playEffect
(Location location, Effect effect, T data) 向在以指定位置为圆心的默认半径内的所有玩家施加(给予)一个效果。<T> void
World.playEffect
(Location location, Effect effect, T data, int radius) 向在以指定位置为圆心的指定半径内的所有玩家施加(给予)一个效果。void
Play a Sound at the provided Location in the World.void
World.playSound
(Location location, String sound, SoundCategory category, float volume, float pitch) Play a Sound at the provided Location in the World.void
在世界中指定的位置播放一个声音。void
World.playSound
(Location location, Sound sound, SoundCategory category, float volume, float pitch) Play a Sound at the provided Location in the World.void
设置新的边界中心boolean
World.setSpawnLocation
(Location location) 设置这个世界的出生点位置.<T extends Entity>
T在指定的位置
根据给定的类生成一个实体.<T extends Entity>
TSpawn an entity of a specific class at the givenLocation
, with the supplied function run before the entity is added to the world.World.spawnArrow
(Location location, Vector direction, float speed, float spread) <T extends Arrow>
TWorld.spawnArrow
(Location location, Vector direction, float speed, float spread, Class<T> clazz) Creates an arrow entity of the given class at the givenLocation
World.spawnEntity
(Location loc, EntityType type) 在指定的位置
创建一个实体.World.spawnFallingBlock
(Location location, int blockId, byte blockData) 已过时。不安全的参数World.spawnFallingBlock
(Location location, MaterialData data) World.spawnFallingBlock
(Location location, Material material, byte data) 已过时。不安全的参数void
World.spawnParticle
(Particle particle, Location location, int count) Spawns the particle (the number of times specified by count) at the target location.void
World.spawnParticle
(Particle particle, Location location, int count, double offsetX, double offsetY, double offsetZ) Spawns the particle (the number of times specified by count) at the target location.void
World.spawnParticle
(Particle particle, Location location, int count, double offsetX, double offsetY, double offsetZ, double extra) Spawns the particle (the number of times specified by count) at the target location.<T> void
World.spawnParticle
(Particle particle, Location location, int count, double offsetX, double offsetY, double offsetZ, double extra, T data) Spawns the particle (the number of times specified by count) at the target location.<T> void
World.spawnParticle
(Particle particle, Location location, int count, double offsetX, double offsetY, double offsetZ, T data) Spawns the particle (the number of times specified by count) at the target location.<T> void
World.spawnParticle
(Particle particle, Location location, int count, T data) Spawns the particle (the number of times specified by count) at the target location.World.strikeLightning
(Location loc) 在指定的位置
劈下闪电.World.strikeLightningEffect
(Location loc) 在指定的位置
劈下不会造成伤害的闪电.将本位置的坐标减去另一个位置的坐标. -
org.bukkit.block中Location的使用
修饰符和类型方法说明EndGateway.getExitLocation()
Gets the location that entities are teleported to when entering the gateway portal.Block.getLocation()
获取方块的位置信息.Block.getLocation
(Location loc) Stores the location of the block in the provided Location object.BlockState.getLocation()
Gets the location of this block state.BlockState.getLocation
(Location loc) Stores the location of this block state in the provided Location object.DoubleChest.getLocation()
修饰符和类型方法说明Block.getLocation
(Location loc) Stores the location of the block in the provided Location object.BlockState.getLocation
(Location loc) Stores the location of this block state in the provided Location object.void
EndGateway.setExitLocation
(Location location) Sets the exit location that entities are teleported to when they enter the gateway portal. -
org.bukkit.command中Location的使用
修饰符和类型方法说明Command.tabComplete
(CommandSender sender, String alias, String[] args, Location location) 执行此命令的tab补全时返回选项列表.CommandMap.tabComplete
(CommandSender sender, String cmdLine, Location location) Looks for the requested command and executes an appropriate tab-completer if found.SimpleCommandMap.tabComplete
(CommandSender sender, String cmdLine, Location location) -
org.bukkit.entity中Location的使用
修饰符和类型方法说明EnderCrystal.getBeamTarget()
Gets the location that this end crystal is pointing its beam to.Player.getBedSpawnLocation()
得到玩家上一次睡觉的床的位置(Location
).Player.getCompassTarget()
得到玩家指南针的指向的位置(Location
).LivingEntity.getEyeLocation()
获取生物实体眼睛的详细方位的Location对象。Entity.getLocation()
Gets the entity's current positionEntity.getLocation
(Location loc) Stores the entity's current position in the provided Location object.EnderSignal.getTargetLocation()
Get the location this EnderSignal is moving towards.修饰符和类型方法说明Entity.getLocation
(Location loc) Stores the entity's current position in the provided Location object.HumanEntity.openEnchanting
(Location location, boolean force) 打开一个空白附魔台物品栏界面, 玩家物品栏(背包)在底部.HumanEntity.openWorkbench
(Location location, boolean force) 打开一个空白工作台物品栏界面, 玩家物品栏(背包)在底部.void
Player.playEffect
(Location loc, Effect effect, int data) 已过时。不安全的参数<T> void
Player.playEffect
(Location loc, Effect effect, T data) void
已过时。不安全的参数void
Player.playNote
(Location loc, Instrument instrument, Note note) Play a note for a player at a location.void
向玩家在某个位置播放一个声音.void
Player.playSound
(Location location, String sound, SoundCategory category, float volume, float pitch) Play a sound for a player at the location.void
向玩家在某个位置播放一个声音.void
Player.playSound
(Location location, Sound sound, SoundCategory category, float volume, float pitch) Play a sound for a player at the location.void
Player.sendBlockChange
(Location loc, int material, byte data) 已过时。不安全的参数void
Player.sendBlockChange
(Location loc, Material material, byte data) 已过时。不安全的参数boolean
Player.sendChunkChange
(Location loc, int sx, int sy, int sz, byte[] data) 已过时。不安全的参数void
Player.sendSignChange
(Location loc, String[] lines) 向该玩家发送一个伪造的牌子(Sign
)上的字的更改数据包.这不会改变世界中的任何方块.void
EnderCrystal.setBeamTarget
(Location location) Sets the location that this end crystal is pointing to.void
Player.setBedSpawnLocation
(Location location) 设置玩家上一次睡觉的床的位置(Location
).void
Player.setBedSpawnLocation
(Location location, boolean force) 设置玩家上一次睡觉的床的位置.void
Player.setCompassTarget
(Location loc) 设置玩家指南针的指向的位置(Location
).void
EnderSignal.setTargetLocation
(Location location) Set theLocation
this EnderSignal is moving towards.void
Player.spawnParticle
(Particle particle, Location location, int count) Spawns the particle (the number of times specified by count) at the target location.void
Player.spawnParticle
(Particle particle, Location location, int count, double offsetX, double offsetY, double offsetZ) Spawns the particle (the number of times specified by count) at the target location.void
Player.spawnParticle
(Particle particle, Location location, int count, double offsetX, double offsetY, double offsetZ, double extra) Spawns the particle (the number of times specified by count) at the target location.<T> void
Player.spawnParticle
(Particle particle, Location location, int count, double offsetX, double offsetY, double offsetZ, double extra, T data) Spawns the particle (the number of times specified by count) at the target location.<T> void
Player.spawnParticle
(Particle particle, Location location, int count, double offsetX, double offsetY, double offsetZ, T data) Spawns the particle (the number of times specified by count) at the target location.<T> void
Player.spawnParticle
(Particle particle, Location location, int count, T data) Spawns the particle (the number of times specified by count) at the target location.boolean
Teleports this entity to the given location.boolean
Entity.teleport
(Location location, PlayerTeleportEvent.TeleportCause cause) Teleports this entity to the given location. -
org.bukkit.event.block中Location的使用
-
org.bukkit.event.entity中Location的使用
修饰符和类型方法说明EntityTeleportEvent.getFrom()
Gets the location that this entity moved fromCreatureSpawnEvent.getLocation()
返回生物出生的位置EntityExplodeEvent.getLocation()
返回爆炸发生的位置.EntityPortalEnterEvent.getLocation()
获取实体接触的传送门方块.ItemDespawnEvent.getLocation()
Gets the location at which the item is despawning.ItemSpawnEvent.getLocation()
Gets the location at which the item is spawning.EntityTeleportEvent.getTo()
Gets the location that this entity moved to修饰符和类型方法说明void
Sets the location that this entity moved fromvoid
Sets the location that this entity moved to限定符构造器说明EntityExplodeEvent
(Entity what, Location location, List<Block> blocks, float yield) EntityPortalEnterEvent
(Entity entity, Location location) EntityPortalEvent
(Entity entity, Location from, Location to, TravelAgent pta) EntityTeleportEvent
(Entity what, Location from, Location to) ItemDespawnEvent
(Item despawnee, Location loc) ItemSpawnEvent
(Item spawnee, Location loc) -
org.bukkit.event.player中Location的使用
修饰符和类型方法说明PlayerMoveEvent.getFrom()
得到玩家移动到此位置之前的位置.PlayerRespawnEvent.getRespawnLocation()
获取当前重生的位置.PlayerMoveEvent.getTo()
得到玩家移动到的位置.修饰符和类型方法说明void
设置玩家将要移动到此位置之前的位置.void
PlayerRespawnEvent.setRespawnLocation
(Location respawnLocation) 设置一个新的重生位置.void
设置玩家将要移动的位置.限定符构造器说明PlayerMoveEvent
(Player player, Location from, Location to) PlayerPortalEvent
(Player player, Location from, Location to, TravelAgent pta) PlayerPortalEvent
(Player player, Location from, Location to, TravelAgent pta, PlayerTeleportEvent.TeleportCause cause) PlayerRespawnEvent
(Player respawnPlayer, Location respawnLocation, boolean isBedSpawn) PlayerTeleportEvent
(Player player, Location from, Location to) PlayerTeleportEvent
(Player player, Location from, Location to, PlayerTeleportEvent.TeleportCause cause) -
org.bukkit.event.vehicle中Location的使用
-
org.bukkit.event.world中Location的使用
修饰符和类型方法说明StructureGrowEvent.getLocation()
获取这个结构的位置.SpawnChangeEvent.getPreviousLocation()
获取之前的出生点位置.限定符构造器说明SpawnChangeEvent
(World world, Location previousLocation) StructureGrowEvent
(Location location, TreeType species, boolean bonemeal, Player player, List<BlockState> blocks) -
org.bukkit.generator中Location的使用
-
org.bukkit.inventory中Location的使用
-
org.bukkit.util中Location的使用
修饰符和类型方法说明Vector.toLocation
(World world) 将向量转换为 Location, 其自转角(也叫偏航角,Yaw)、旋进角(也叫进动角、俯仰角,Pitch)为0.Vector.toLocation
(World world, float yaw, float pitch) 将向量转换为 Location.限定符构造器说明BlockIterator
(Location loc) BlockIterator的构造函数.BlockIterator
(Location loc, double yOffset) BlockIterator的构造函数.BlockIterator
(Location loc, double yOffset, int maxDistance) BlockIterator的构造函数.