本文整理了Java中org.bukkit.entity.Entity.teleport()
方法的一些代码示例,展示了Entity.teleport()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Entity.teleport()
方法的具体详情如下:
包路径:org.bukkit.entity.Entity
类名称:Entity
方法名:teleport
[英]Teleports this entity to the given location. If this entity is riding a vehicle, it will be dismounted prior to teleportation.
[中]将此实体传送到给定位置。如果该实体正在驾驶车辆,它将在远程传送之前被卸载。
代码示例来源:origin: EngineHub/WorldEdit
@Override
public boolean setLocation(Location location) {
org.bukkit.entity.Entity entity = entityRef.get();
if (entity != null) {
return entity.teleport(BukkitAdapter.adapt(location));
} else {
return false;
}
}
代码示例来源:origin: GlowstoneMC/Glowstone
from.teleport(entity);
sender.sendMessage(
"Teleported " + CommandUtils.getName(from) + " to " + CommandUtils
return false;
} else {
from.teleport(player);
sender.sendMessage("Teleported " + CommandUtils.getName(from) + " to "
+ player.getName());
entity.teleport(destination);
sender.sendMessage(
"Teleported " + CommandUtils.getName(entity) + " to " + CommandUtils
代码示例来源:origin: GlowstoneMC/Glowstone
destination.setYaw(entityLocation.getYaw());
entity.teleport(destination, PlayerTeleportEvent.TeleportCause.ENDER_PEARL);
代码示例来源:origin: GlowstoneMC/Glowstone
targetLocation.setPitch(target.getLocation().getPitch());
target.teleport(targetLocation);
sender.sendMessage(
"Teleported " + target.getName() + " to " + targetLocation.getX() + " "
代码示例来源:origin: bergerkiller/BKCommonLib
@Override
public boolean teleport(Entity arg0) {
return base.teleport(arg0);
}
代码示例来源:origin: bergerkiller/BKCommonLib
@Override
public boolean teleport(Location arg0) {
return base.teleport(arg0);
}
代码示例来源:origin: bergerkiller/BKCommonLib
public boolean teleport(Location location, TeleportCause cause) {
return entity.teleport(location, cause);
}
代码示例来源:origin: bergerkiller/BKCommonLib
@Override
public boolean teleport(Location arg0, TeleportCause arg1) {
return base.teleport(arg0, arg1);
}
代码示例来源:origin: bergerkiller/BKCommonLib
@Override
public boolean teleport(Entity arg0, TeleportCause arg1) {
return base.teleport(arg0, arg1);
}
代码示例来源:origin: EngineHub/CommandHelper
@Override
public boolean teleport(MCLocation location) {
return e.teleport(((BukkitMCLocation) location).asLocation());
}
代码示例来源:origin: Multiverse/Multiverse-Core
/**
* {@inheritDoc}
*/
@Override
public TeleportResult safelyTeleport(CommandSender teleporter, Entity teleportee, Location location, boolean safely) {
if (safely) {
location = this.getSafeLocation(location);
}
if (location != null) {
if (teleportee.teleport(location)) {
return TeleportResult.SUCCESS;
}
return TeleportResult.FAIL_OTHER;
}
return TeleportResult.FAIL_UNSAFE;
}
代码示例来源:origin: EngineHub/CommandHelper
@Override
public boolean teleport(MCEntity destination) {
Entity ent = ((BukkitMCEntity) destination).getHandle();
return e.teleport(ent.getLocation());
}
代码示例来源:origin: elBukkit/MagicPlugin
@Override
public void run() {
entity.teleport(location);
registerForUndo();
playEffects("teleport");
}
}, 1);
代码示例来源:origin: EngineHub/CommandHelper
@Override
public boolean teleport(MCLocation location, MCTeleportCause cause) {
return e.teleport(((BukkitMCLocation) location).asLocation(), TeleportCause.valueOf(cause.name()));
}
代码示例来源:origin: EngineHub/CommandHelper
@Override
public boolean teleport(MCEntity destination, MCTeleportCause cause) {
return e.teleport(((BukkitMCEntity) destination).getHandle(), TeleportCause.valueOf(cause.name()));
}
代码示例来源:origin: elBukkit/MagicPlugin
private boolean modifyPostSpawn(MageController controller, Entity entity) {
if (entity == null || entity.getType() != type) return false;
if (hasMoved && location != null && !location.equals(entity.getLocation())) {
entity.teleport(location);
}
if (hasVelocity && velocity != null) {
SafetyUtils.setVelocity(entity, velocity);
}
return true;
}
代码示例来源:origin: Slikey/EffectLib
@Override
public void onRun() {
Entity entity = getEntity();
if (entity == null) {
cancel();
return;
}
Location loc = entity.getLocation();
loc.setYaw(loc.getYaw() + step);
entity.teleport(loc);
}
代码示例来源:origin: elBukkit/MagicPlugin
protected void teleportTo(Entity sourceEntity, Entity targetEntity) {
Location targetLocation = targetEntity.getLocation();
// Try to place you in front of the other player, and facing them
BlockFace targetFacing = getFacing(targetEntity.getLocation());
Location candidate = findPlaceToStand(targetLocation.getBlock().getRelative(targetFacing).getRelative(targetFacing).getLocation(), 4, 4);
if (candidate != null) {
candidate.setPitch(0);
candidate.setYaw(360 - targetLocation.getYaw());
targetLocation = candidate;
}
sourceEntity.teleport(targetLocation);
}
代码示例来源:origin: TheBusyBiscuit/Slimefun4
@Override
public boolean onRightClick(ItemUseEvent e, Player p, ItemStack item) {
if (SlimefunManager.isItemSimiliar(item, SlimefunItems.SCROLL_OF_DIMENSIONAL_TELEPOSITION, true)) {
for (Entity n: p.getNearbyEntities(10.0, 10.0, 10.0)) {
if (n instanceof LivingEntity && !(n instanceof ArmorStand) &&n.getUniqueId() != p.getUniqueId()) {
float yaw = n.getLocation().getYaw() + 180.0F;
if (yaw > 360.0F) yaw = yaw - 360.0F;
n.teleport(new Location(n.getWorld(), n.getLocation().getX(), n.getLocation().getY(), n.getLocation().getZ(), yaw, n.getLocation().getPitch()));
}
}
return true;
}
else return false;
}
});
代码示例来源:origin: TheBusyBiscuit/Slimefun4
@Override
public void run() {
if (Bukkit.getPlayer(uuid) == null) Bukkit.getScheduler().cancelTask(id);
else if (Bukkit.getPlayer(uuid).isDead()) Bukkit.getScheduler().cancelTask(id);
else if (!Bukkit.getPlayer(uuid).isSneaking()) Bukkit.getScheduler().cancelTask(id);
else {
for (Entity item: Bukkit.getPlayer(uuid).getNearbyEntities(6D, 6D, 6D)) {
if (item instanceof Item) {
if (!item.hasMetadata("no_pickup") && ((Item) item).getPickupDelay() <= 0) {
item.teleport(Bukkit.getPlayer(uuid).getEyeLocation());
Bukkit.getPlayer(uuid).getWorld().playSound(Bukkit.getPlayer(uuid).getEyeLocation(), Sound.ENTITY_ENDERMAN_TELEPORT, 5L, 2L);
}
}
}
}
}
内容来源于网络,如有侵权,请联系作者删除!