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


Java CraftEventFactory.handleNonLivingEntityDamageEvent方法代码示例

本文整理汇总了Java中org.bukkit.craftbukkit.event.CraftEventFactory.handleNonLivingEntityDamageEvent方法的典型用法代码示例。如果您正苦于以下问题:Java CraftEventFactory.handleNonLivingEntityDamageEvent方法的具体用法?Java CraftEventFactory.handleNonLivingEntityDamageEvent怎么用?Java CraftEventFactory.handleNonLivingEntityDamageEvent使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.bukkit.craftbukkit.event.CraftEventFactory的用法示例。


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

示例1: damageEntity

import org.bukkit.craftbukkit.event.CraftEventFactory; //导入方法依赖的package包/类
public boolean damageEntity(DamageSource damagesource, float f) {
    if (this.isInvulnerable()) {
        return false;
    } else {
        if (!this.dead && !this.world.isStatic) {
            // CraftBukkit start - All non-living entities need this
            if (CraftEventFactory.handleNonLivingEntityDamageEvent(this, damagesource, f)) {
                return false;
            }
            // CraftBukkit end

            this.b = 0;
            if (this.b <= 0) {
                this.die();
                if (!this.world.isStatic) {
                    this.world.explode(this, this.locX, this.locY, this.locZ, 6.0F, true); // CraftBukkit - (Entity) null -> this
                }
            }
        }

        return true;
    }
}
 
开发者ID:AlmuraDev,项目名称:Almura-Server,代码行数:24,代码来源:EntityEnderCrystal.java

示例2: damageEntity

import org.bukkit.craftbukkit.event.CraftEventFactory; //导入方法依赖的package包/类
public boolean damageEntity(DamageSource damagesource, float f) {
    if (this.isInvulnerable()) {
        return false;
    } else {
        this.Q();
        if (damagesource.getEntity() != null) {
            // CraftBukkit start
            if (CraftEventFactory.handleNonLivingEntityDamageEvent(this, damagesource, f)) {
                return false;
            }
            // CraftBukkit end

            Vec3D vec3d = damagesource.getEntity().ag();

            if (vec3d != null) {
                this.motX = vec3d.a;
                this.motY = vec3d.b;
                this.motZ = vec3d.c;
                this.dirX = this.motX * 0.1D;
                this.dirY = this.motY * 0.1D;
                this.dirZ = this.motZ * 0.1D;
            }

            if (damagesource.getEntity() instanceof EntityLiving) {
                this.shooter = (EntityLiving) damagesource.getEntity();
                this.projectileSource = (org.bukkit.projectiles.ProjectileSource) this.shooter.getBukkitEntity();
            }

            return true;
        } else {
            return false;
        }
    }
}
 
开发者ID:OvercastNetwork,项目名称:CraftBukkit,代码行数:35,代码来源:EntityFireball.java

示例3: damageEntity

import org.bukkit.craftbukkit.event.CraftEventFactory; //导入方法依赖的package包/类
public boolean damageEntity(DamageSource damagesource, float f) {
    if (this.isInvulnerable()) {
        return false;
    } else {
        if (!this.dead && !this.world.isStatic) {
            // CraftBukkit start - All non-living entities need this
            if (CraftEventFactory.handleNonLivingEntityDamageEvent(this, damagesource, f)) {
                return false;
            }
            // CraftBukkit end

            this.b = 0;
            if (this.b <= 0) {
                this.die();
                if (!this.world.isStatic) {
                    // CraftBukkit start
                    ExplosionPrimeEvent event = new ExplosionPrimeEvent(this.getBukkitEntity(), 6.0F, false);
                    this.world.getServer().getPluginManager().callEvent(event);
                    if (event.isCancelled()) {
                        this.dead = false;
                        return false;
                    }
                    this.world.createExplosion(this, this.locX, this.locY, this.locZ, event.getRadius(), event.getFire(), true);
                    // CraftBukkit end
                }
            }
        }

        return true;
    }
}
 
开发者ID:OvercastNetwork,项目名称:CraftBukkit,代码行数:32,代码来源:EntityEnderCrystal.java

示例4: attackEntityFrom

import org.bukkit.craftbukkit.event.CraftEventFactory; //导入方法依赖的package包/类
public boolean attackEntityFrom(DamageSource p_70097_1_, float p_70097_2_)
{
    if (this.isEntityInvulnerable())
    {
        return false;
    }
    else
    {
        if (!this.isDead && !this.worldObj.isRemote)
        {
            // CraftBukkit start - All non-living entities need this
            if (CraftEventFactory.handleNonLivingEntityDamageEvent(this, p_70097_1_, p_70097_2_))
            {
                return false;
            }

            // CraftBukkit end
            this.health = 0;

            if (this.health <= 0)
            {
                this.setDead();

                if (!this.worldObj.isRemote)
                {
                    this.worldObj.createExplosion(this, this.posX, this.posY, this.posZ, 6.0F, true); // CraftBukkit - (Entity) null -> this
                }
            }
        }

        return true;
    }
}
 
开发者ID:xtrafrancyz,项目名称:Cauldron,代码行数:34,代码来源:EntityEnderCrystal.java

示例5: attackEntityFrom

import org.bukkit.craftbukkit.event.CraftEventFactory; //导入方法依赖的package包/类
public boolean attackEntityFrom(DamageSource p_70097_1_, float p_70097_2_)
{
    if (this.isEntityInvulnerable())
    {
        return false;
    }
    else
    {
        this.setBeenAttacked();

        if (p_70097_1_.getEntity() != null)
        {
            // CraftBukkit start
            if (CraftEventFactory.handleNonLivingEntityDamageEvent(this, p_70097_1_, p_70097_2_))
            {
                return false;
            }

            // CraftBukkit end
            Vec3 vec3 = p_70097_1_.getEntity().getLookVec();

            if (vec3 != null)
            {
                this.motionX = vec3.xCoord;
                this.motionY = vec3.yCoord;
                this.motionZ = vec3.zCoord;
                this.accelerationX = this.motionX * 0.1D;
                this.accelerationY = this.motionY * 0.1D;
                this.accelerationZ = this.motionZ * 0.1D;
            }

            if (p_70097_1_.getEntity() instanceof EntityLivingBase)
            {
                this.shootingEntity = (EntityLivingBase)p_70097_1_.getEntity();
                this.projectileSource = (org.bukkit.projectiles.ProjectileSource) this.shootingEntity.getBukkitEntity(); // CraftBukkit
            }

            return true;
        }
        else
        {
            return false;
        }
    }
}
 
开发者ID:xtrafrancyz,项目名称:Cauldron,代码行数:46,代码来源:EntityFireball.java


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