本文整理汇总了Java中cn.nukkit.level.Position.getFloorY方法的典型用法代码示例。如果您正苦于以下问题:Java Position.getFloorY方法的具体用法?Java Position.getFloorY怎么用?Java Position.getFloorY使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类cn.nukkit.level.Position
的用法示例。
在下文中一共展示了Position.getFloorY方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: teleportImmediate
import cn.nukkit.level.Position; //导入方法依赖的package包/类
public void teleportImmediate(Location location, TeleportCause cause) {
Location from = this.getLocation();
if (super.teleport(location, cause)) {
for (Inventory window : new ArrayList<>(this.windowIndex.values())) {
if (window == this.inventory) {
continue;
}
this.removeWindow(window);
}
if (from.getLevel().getId() != location.getLevel().getId()) { //Different level, update compass position
SetSpawnPositionPacket pk = new SetSpawnPositionPacket();
pk.spawnType = SetSpawnPositionPacket.TYPE_WORLD_SPAWN;
Position spawn = location.getLevel().getSpawnLocation();
pk.x = spawn.getFloorX();
pk.y = spawn.getFloorY();
pk.z = spawn.getFloorZ();
dataPacket(pk);
}
this.forceMovement = new Vector3(this.x, this.y, this.z);
this.sendPosition(this, this.yaw, this.pitch, MovePlayerPacket.MODE_RESET);
this.resetFallDistance();
this.orderChunks();
this.nextChunkOrderRun = 0;
this.newPosition = null;
//Weather
this.getLevel().sendWeather(this);
//Update time
this.getLevel().sendTime(this);
}
}
示例2: teleportImmediate
import cn.nukkit.level.Position; //导入方法依赖的package包/类
public void teleportImmediate(Location location, TeleportCause cause) {
Location from = this.getLocation();
if (super.teleport(location, cause)) {
for (Inventory window : new ArrayList<>(this.windowIndex.values())) {
if (window == this.inventory) {
continue;
}
this.removeWindow(window);
}
if (from.getLevel().getId() != location.getLevel().getId()) {
SetSpawnPositionPacket pk = new SetSpawnPositionPacket();
pk.spawnType = SetSpawnPositionPacket.TYPE_WORLD_SPAWN;
Position spawn = location.getLevel().getSpawnLocation();
pk.x = spawn.getFloorX();
pk.y = spawn.getFloorY();
pk.z = spawn.getFloorZ();
dataPacket(pk);
}
this.forceMovement = new Vector3(this.x, this.y, this.z);
this.sendPosition(this, this.yaw, this.pitch, MovePlayerPacket.MODE_RESET);
this.resetFallDistance();
this.orderChunks();
this.nextChunkOrderRun = 0;
this.newPosition = null;
//Weather
this.getLevel().sendWeather(this);
//Update time
this.getLevel().sendTime(this);
}
}
示例3: teleport
import cn.nukkit.level.Position; //导入方法依赖的package包/类
@Override
public boolean teleport(Location location, TeleportCause cause) {
if (!this.isOnline()) {
return false;
}
Location from = this.getLocation();
Location to = location;
if (cause != null) {
PlayerTeleportEvent event = new PlayerTeleportEvent(this, from, to, cause);
this.server.getPluginManager().callEvent(event);
if (event.isCancelled()) return false;
to = event.getTo();
if (from.getLevel().getId() != to.getLevel().getId()) { //Different level, update compass position
SetSpawnPositionPacket pk = new SetSpawnPositionPacket();
pk.spawnType = SetSpawnPositionPacket.TYPE_WORLD_SPAWN;
Position spawn = to.getLevel().getSpawnLocation();
pk.x = spawn.getFloorX();
pk.y = spawn.getFloorY();
pk.z = spawn.getFloorZ();
dataPacket(pk);
}
}
//TODO Remove it! A hack to solve the client-side teleporting bug! (inside into the block)
if (super.teleport(to.getY() == to.getFloorY() ? to.add(0, 0.00001, 0) : to, null)) { // null to prevent fire of duplicate EntityTeleportEvent
this.removeAllWindows();
this.teleportPosition = new Vector3(this.x, this.y, this.z);
this.forceMovement = this.teleportPosition;
this.sendPosition(this, this.yaw, this.pitch, MovePlayerPacket.MODE_TELEPORT);
this.checkTeleportPosition();
this.resetFallDistance();
this.nextChunkOrderRun = 0;
this.newPosition = null;
//DummyBossBar
this.getDummyBossBars().values().forEach(DummyBossBar::reshow);
//Weather
this.getLevel().sendWeather(this);
//Update time
this.getLevel().sendTime(this);
return true;
}
return false;
}
示例4: teleport
import cn.nukkit.level.Position; //导入方法依赖的package包/类
@Override
public boolean teleport(Location location, TeleportCause cause) {
if (!this.isOnline()) {
return false;
}
Location from = this.getLocation();
Location to = location;
if (cause != null) {
PlayerTeleportEvent event = new PlayerTeleportEvent(this, from, to, cause);
this.server.getPluginManager().callEvent(event);
if (event.isCancelled()) return false;
to = event.getTo();
if (from.getLevel().getId() != to.getLevel().getId()) {
SetSpawnPositionPacket pk = new SetSpawnPositionPacket();
pk.spawnType = SetSpawnPositionPacket.TYPE_WORLD_SPAWN;
Position spawn = to.getLevel().getSpawnLocation();
pk.x = spawn.getFloorX();
pk.y = spawn.getFloorY();
pk.z = spawn.getFloorZ();
dataPacket(pk);
}
}
this.getPosition();
if (super.teleport(to, null)) { // null to prevent fire of duplicate EntityTeleportEvent
this.removeAllWindows();
this.teleportPosition = new Vector3(this.x, this.y, this.z);
this.forceMovement = this.teleportPosition;
this.sendPosition(this, this.yaw, this.pitch, MovePlayerPacket.MODE_TELEPORT);
this.checkTeleportPosition();
this.resetFallDistance();
this.nextChunkOrderRun = 0;
this.newPosition = null;
//Weather
this.getLevel().sendWeather(this);
//Update time
this.getLevel().sendTime(this);
return true;
}
return false;
}
示例5: onProjectileHit
import cn.nukkit.level.Position; //导入方法依赖的package包/类
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = false) //DON'T FORGET THE ANNOTATION @EventHandler
public void onProjectileHit(ProjectileHitEvent event) throws Exception
{
Entity snowball = event.getEntity();
Position loc = snowball.getLocation();
Integer kind = null;
String who = null;
snowball.getLevel().removeEntity(snowball);
if(whodi.containsKey((int)snowball.getId())){
for (Map.Entry<Integer, String> e : whodi.get((int)snowball.getId()).entrySet()) {
kind = e.getKey();
who = e.getValue();
}
}
if(who !=null){
Player wdi =Server.getInstance().getPlayer(who);
if(kind == 1 || kind == 4 || kind == 8){
int ds = 3;
if(kind == 8){
ds = 2;
}
if(kind == 4){
ds = 5;
}
int x=loc.getFloorX();
int y=loc.getFloorY();
int z=loc.getFloorZ();
ExplodeSound sound = new ExplodeSound(new Vector3(x,y,z));//サウンドオブジェクトの生成
loc.getLevel().addSound(sound);//サウンドを再生
ExplodeParticle particle = new ExplodeParticle(new Vector3(x,y,z));
int count = 20;
for(int i = 0;i < count; ++i){
loc.getLevel().addParticle(particle);
}
for(Player playera : Server.getInstance().getOnlinePlayers().values()){
if(Math.abs(playera.getX()-x)<=ds & Math.abs(playera.getY()-y)<=ds & Math.abs(playera.getZ()-z)<=ds & wdi != playera){
EntityDamageByEntityEvent ev = new EntityDamageByEntityEvent(wdi,playera, EntityDamageEvent.CAUSE_ENTITY_EXPLOSION, 8);//EntityDamageEvent::CAUSE_MAGICを変えることでダメージの種類を、1を変えることでダメージの強さが変更できます
playera.attack(ev);
}
}
}}
}