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


Java ItemBoat类代码示例

本文整理汇总了Java中cn.nukkit.item.ItemBoat的典型用法代码示例。如果您正苦于以下问题:Java ItemBoat类的具体用法?Java ItemBoat怎么用?Java ItemBoat使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: attack

import cn.nukkit.item.ItemBoat; //导入依赖的package包/类
@Override
public void attack(EntityDamageEvent source) {
    super.attack(source);
    if (source.isCancelled()) return;
    if (source instanceof EntityDamageByEntityEvent) {
        Entity damager = ((EntityDamageByEntityEvent) source).getDamager();
        if (damager instanceof Player) {
            if (((Player) damager).isCreative()) {
                this.kill();
            }
            if (this.getHealth() <= 0) {
                if (((Player) damager).isSurvival()) {
                    this.level.dropItem(this, new ItemBoat());
                }
                this.close();
            }
        }
    }

    EntityEventPacket pk = new EntityEventPacket();
    pk.eid = this.getId();
    pk.event = this.getHealth() <= 0 ? EntityEventPacket.DEATH_ANIMATION : EntityEventPacket.HURT_ANIMATION;
    Server.broadcastPacket(this.hasSpawned.values(), pk);
}
 
开发者ID:Creeperface01,项目名称:NukkitGT,代码行数:25,代码来源:EntityBoat.java

示例2: attack

import cn.nukkit.item.ItemBoat; //导入依赖的package包/类
@Override
public boolean attack(EntityDamageEvent source) {
    if (invulnerable) {
        return false;
    } else {
        performHurtAnimation((int) source.getFinalDamage());

        Entity damager = ((EntityDamageByEntityEvent) source).getDamager();
        boolean instantKill = damager instanceof Player && ((Player) damager).isCreative();
        if (instantKill || getDamage() > 40) {
            if (linkedEntity != null) {
                mountEntity(linkedEntity);
            }

            if (instantKill && (!hasCustomName())) {
                kill();
            } else {
                if (level.getGameRules().getBoolean("doentitydrops")) {
                    this.level.dropItem(this, new ItemBoat());
                }
                close();
            }
        }
    }
    
    return true;
}
 
开发者ID:JupiterDevelopmentTeam,项目名称:Jupiter,代码行数:28,代码来源:EntityBoat.java

示例3: attack

import cn.nukkit.item.ItemBoat; //导入依赖的package包/类
@Override
public boolean attack(EntityDamageEvent source) {
    if (super.attack(source)) {
        if (source instanceof EntityDamageByEntityEvent) {
            Entity damager = ((EntityDamageByEntityEvent) source).getDamager();
            if (damager instanceof Player) {
                if (((Player) damager).isCreative()) {
                    this.kill();
                }
                if (this.getHealth() <= 0) {
                    if (((Player) damager).isSurvival()) {
                        this.level.dropItem(this, new ItemBoat());
                    }
                    this.close();
                }
            }
        }

        EntityEventPacket pk = new EntityEventPacket();
        pk.eid = this.getId();
        pk.event = this.getHealth() <= 0 ? EntityEventPacket.DEATH_ANIMATION : EntityEventPacket.HURT_ANIMATION;
        Server.broadcastPacket(this.hasSpawned.values(), pk);

        return true;
    } else {
        return false;
    }
}
 
开发者ID:FrontierDevs,项目名称:Jenisys3,代码行数:29,代码来源:EntityBoat.java

示例4: attack

import cn.nukkit.item.ItemBoat; //导入依赖的package包/类
@Override
public boolean attack(EntityDamageEvent source) {
    if (invulnerable) {
        return false;
    } else {
        performHurtAnimation((int) source.getFinalDamage());

        Entity damager = ((EntityDamageByEntityEvent) source).getDamager();
        boolean instantKill = damager instanceof Player && ((Player) damager).isCreative();
        if (instantKill || getDamage() > 40) {
            if (linkedEntity != null) {
                mountEntity(linkedEntity);
            }

            if (instantKill && (!hasCustomName())) {
                kill();
            } else {
                if (level.getGameRules().getBoolean("doEntityDrops")) {
                    this.level.dropItem(this, new ItemBoat());
                }
                close();
            }
        }
    }

    return true;
}
 
开发者ID:CoreXDevelopment,项目名称:CoreX,代码行数:28,代码来源:EntityBoat.java

示例5: attack

import cn.nukkit.item.ItemBoat; //导入依赖的package包/类
@Override
public boolean attack(EntityDamageEvent source) {
    if (invulnerable) {
        return false;
    } else {
        // Event start
        VehicleDamageEvent event = new VehicleDamageEvent(this, source.getEntity(), source.getFinalDamage());
        getServer().getPluginManager().callEvent(event);
        if (event.isCancelled()) {
            return false;
        }
        // Event stop
        performHurtAnimation((int) event.getDamage());

        boolean instantKill = false;

        if (source instanceof EntityDamageByEntityEvent) {
            Entity damager = ((EntityDamageByEntityEvent) source).getDamager();
            instantKill = damager instanceof Player && ((Player) damager).isCreative();
        }

        if (instantKill || getDamage() > 40) {
            // Event start
            VehicleDestroyEvent event2 = new VehicleDestroyEvent(this, source.getEntity());
            getServer().getPluginManager().callEvent(event2);
            if (event2.isCancelled()) {
                return false;
            }
            // Event stop
            if (linkedEntity != null) {
                mountEntity(linkedEntity);
            }

            if (instantKill && (!hasCustomName())) {
                kill();
            } else {
                if (level.getGameRules().getBoolean("doEntityDrops")) {
                    this.level.dropItem(this, new ItemBoat());
                }
                close();
            }
        }
    }

    return true;
}
 
开发者ID:Rsplwe,项目名称:Nukkit-Java9,代码行数:47,代码来源:EntityBoat.java


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