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


Java EntityEnderCrystal.getDistanceSqToEntity方法代码示例

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


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

示例1: updateDragonEnderCrystal

import net.minecraft.entity.item.EntityEnderCrystal; //导入方法依赖的package包/类
/**
 * Updates the state of the enderdragon's current endercrystal.
 */
private void updateDragonEnderCrystal()
{
    if (this.healingEnderCrystal != null)
    {
        if (this.healingEnderCrystal.isDead)
        {
            this.healingEnderCrystal = null;
        }
        else if (this.ticksExisted % 10 == 0 && this.getHealth() < this.getMaxHealth())
        {
            this.setHealth(this.getHealth() + 1.0F);
        }
    }

    if (this.rand.nextInt(10) == 0)
    {
        List<EntityEnderCrystal> list = this.world.<EntityEnderCrystal>getEntitiesWithinAABB(EntityEnderCrystal.class, this.getEntityBoundingBox().expandXyz(32.0D));
        EntityEnderCrystal entityendercrystal = null;
        double d0 = Double.MAX_VALUE;

        for (EntityEnderCrystal entityendercrystal1 : list)
        {
            double d1 = entityendercrystal1.getDistanceSqToEntity(this);

            if (d1 < d0)
            {
                d0 = d1;
                entityendercrystal = entityendercrystal1;
            }
        }

        this.healingEnderCrystal = entityendercrystal;
    }
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:38,代码来源:EntityDragon.java

示例2: updateDragonEnderCrystal

import net.minecraft.entity.item.EntityEnderCrystal; //导入方法依赖的package包/类
/**
 * Updates the state of the enderdragon's current endercrystal.
 */
private void updateDragonEnderCrystal()
{
    if (this.healingEnderCrystal != null)
    {
        if (this.healingEnderCrystal.isDead)
        {
            this.healingEnderCrystal = null;
        }
        else if (this.ticksExisted % 10 == 0 && this.getHealth() < this.getMaxHealth())
        {
            this.setHealth(this.getHealth() + 1.0F);
        }
    }

    if (this.rand.nextInt(10) == 0)
    {
        List<EntityEnderCrystal> list = this.worldObj.<EntityEnderCrystal>getEntitiesWithinAABB(EntityEnderCrystal.class, this.getEntityBoundingBox().expandXyz(32.0D));
        EntityEnderCrystal entityendercrystal = null;
        double d0 = Double.MAX_VALUE;

        for (EntityEnderCrystal entityendercrystal1 : list)
        {
            double d1 = entityendercrystal1.getDistanceSqToEntity(this);

            if (d1 < d0)
            {
                d0 = d1;
                entityendercrystal = entityendercrystal1;
            }
        }

        this.healingEnderCrystal = entityendercrystal;
    }
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:38,代码来源:EntityDragon.java

示例3: updateDragonEnderCrystal

import net.minecraft.entity.item.EntityEnderCrystal; //导入方法依赖的package包/类
/**
 * Updates the state of the enderdragon's current endercrystal.
 */
private void updateDragonEnderCrystal()
{
    if (this.healingEnderCrystal != null)
    {
        if (this.healingEnderCrystal.isDead)
        {
            if (!this.worldObj.isRemote)
            {
                this.attackEntityFromPart(this.dragonPartHead, DamageSource.setExplosionSource((Explosion)null), 10.0F);
            }

            this.healingEnderCrystal = null;
        }
        else if (this.ticksExisted % 10 == 0 && this.getHealth() < this.getMaxHealth())
        {
            this.setHealth(this.getHealth() + 1.0F);
        }
    }

    if (this.rand.nextInt(10) == 0)
    {
        float f = 32.0F;
        List<EntityEnderCrystal> list = this.worldObj.<EntityEnderCrystal>getEntitiesWithinAABB(EntityEnderCrystal.class, this.getEntityBoundingBox().expand((double)f, (double)f, (double)f));
        EntityEnderCrystal entityendercrystal = null;
        double d0 = Double.MAX_VALUE;

        for (EntityEnderCrystal entityendercrystal1 : list)
        {
            double d1 = entityendercrystal1.getDistanceSqToEntity(this);

            if (d1 < d0)
            {
                d0 = d1;
                entityendercrystal = entityendercrystal1;
            }
        }

        this.healingEnderCrystal = entityendercrystal;
    }
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:44,代码来源:EntityDragon.java

示例4: updateDragonEnderCrystal

import net.minecraft.entity.item.EntityEnderCrystal; //导入方法依赖的package包/类
/**
 * Updates the state of the enderdragon's current endercrystal.
 */
private void updateDragonEnderCrystal()
{
    if (this.healingEnderCrystal != null)
    {
        if (this.healingEnderCrystal.isDead)
        {
            if (!this.worldObj.isRemote)
            {
                this.attackEntityFromPart(this.dragonPartHead, DamageSource.generic, 10);
            }

            this.healingEnderCrystal = null;
        }
        else if (this.ticksExisted % 10 == 0 && this.getMaxHealth() < this.getMaxHealth())
        {
            ++health;
        }
    }

    if (this.rand.nextInt(10) == 0)
    {
        float f = 32.0F;
        List var2 = this.worldObj.getEntitiesWithinAABB(EntityEnderCrystal.class, this.getEntityBoundingBox().expand((double)f, (double)f, (double)f));
        EntityEnderCrystal var3 = null;
        double var4 = Double.MAX_VALUE;
        Iterator var6 = var2.iterator();

        while (var6.hasNext())
        {
            EntityEnderCrystal var7 = (EntityEnderCrystal)var6.next();
            double var8 = var7.getDistanceSqToEntity(this);

            if (var8 < var4)
            {
                var4 = var8;
                var3 = var7;
            }
        }

        this.healingEnderCrystal = var3;
    }
}
 
开发者ID:Stormister,项目名称:Rediscovered-Mod-1.8,代码行数:46,代码来源:EntityGoodDragon.java

示例5: updateDragonEnderCrystal

import net.minecraft.entity.item.EntityEnderCrystal; //导入方法依赖的package包/类
/**
 * Updates the state of the enderdragon's current endercrystal.
 */
private void updateDragonEnderCrystal()
{
    if (this.healingEnderCrystal != null)
    {
        if (this.healingEnderCrystal.isDead)
        {
            if (!this.worldObj.isClient)
            {
                this.attackEntityFromPart(this.dragonPartHead, DamageSource.setExplosionSource((Explosion)null), 10.0F);
            }

            this.healingEnderCrystal = null;
        }
        else if (this.ticksExisted % 10 == 0 && this.getHealth() < this.getMaxHealth())
        {
            this.setHealth(this.getHealth() + 1.0F);
        }
    }

    if (this.rand.nextInt(10) == 0)
    {
        float var1 = 32.0F;
        List var2 = this.worldObj.getEntitiesWithinAABB(EntityEnderCrystal.class, this.boundingBox.expand((double)var1, (double)var1, (double)var1));
        EntityEnderCrystal var3 = null;
        double var4 = Double.MAX_VALUE;
        Iterator var6 = var2.iterator();

        while (var6.hasNext())
        {
            EntityEnderCrystal var7 = (EntityEnderCrystal)var6.next();
            double var8 = var7.getDistanceSqToEntity(this);

            if (var8 < var4)
            {
                var4 = var8;
                var3 = var7;
            }
        }

        this.healingEnderCrystal = var3;
    }
}
 
开发者ID:MinecraftModdedClients,项目名称:Resilience-Client-Source,代码行数:46,代码来源:EntityDragon.java

示例6: updateDragonEnderCrystal

import net.minecraft.entity.item.EntityEnderCrystal; //导入方法依赖的package包/类
private void updateDragonEnderCrystal()
{
    if (this.healingEnderCrystal != null)
    {
        if (this.healingEnderCrystal.isDead)
        {
            if (!this.worldObj.isRemote)
            {
                CraftEventFactory.entityDamage = this.healingEnderCrystal; // CraftBukkit
                this.attackEntityFromPart(this.dragonPartHead, DamageSource.setExplosionSource((Explosion) null), 10.0F);
                CraftEventFactory.entityDamage = null; // CraftBukkit
            }

            this.healingEnderCrystal = null;
        }
        else if (this.ticksExisted % 10 == 0 && this.getHealth() < this.getMaxHealth())
        {
            // CraftBukkit start
            EntityRegainHealthEvent event = new EntityRegainHealthEvent(this.getBukkitEntity(), 1.0D, EntityRegainHealthEvent.RegainReason.ENDER_CRYSTAL);
            this.worldObj.getServer().getPluginManager().callEvent(event);

            if (!event.isCancelled())
            {
                this.setHealth((float)(this.getHealth() + event.getAmount()));
            }

            // CraftBukkit end
        }
    }

    if (this.rand.nextInt(10) == 0)
    {
        float f = 32.0F;
        List list = this.worldObj.getEntitiesWithinAABB(EntityEnderCrystal.class, this.boundingBox.expand((double)f, (double)f, (double)f));
        EntityEnderCrystal entityendercrystal = null;
        double d0 = Double.MAX_VALUE;
        Iterator iterator = list.iterator();

        while (iterator.hasNext())
        {
            EntityEnderCrystal entityendercrystal1 = (EntityEnderCrystal)iterator.next();
            double d1 = entityendercrystal1.getDistanceSqToEntity(this);

            if (d1 < d0)
            {
                d0 = d1;
                entityendercrystal = entityendercrystal1;
            }
        }

        this.healingEnderCrystal = entityendercrystal;
    }
}
 
开发者ID:xtrafrancyz,项目名称:Cauldron,代码行数:54,代码来源:EntityDragon.java

示例7: updateDragonEnderCrystal

import net.minecraft.entity.item.EntityEnderCrystal; //导入方法依赖的package包/类
private void updateDragonEnderCrystal()
{
    if (this.healingEnderCrystal != null)
    {
        if (this.healingEnderCrystal.isDead)
        {
            if (!this.worldObj.isRemote)
            {
                this.attackEntityFromPart(this.dragonPartHead, DamageSource.setExplosionSource((Explosion)null), 10.0F);
            }

            this.healingEnderCrystal = null;
        }
        else if (this.ticksExisted % 10 == 0 && this.getHealth() < this.getMaxHealth())
        {
            this.setHealth(this.getHealth() + 1.0F);
        }
    }

    if (this.rand.nextInt(10) == 0)
    {
        float f = 32.0F;
        List list = this.worldObj.getEntitiesWithinAABB(EntityEnderCrystal.class, this.boundingBox.expand((double)f, (double)f, (double)f));
        EntityEnderCrystal entityendercrystal = null;
        double d0 = Double.MAX_VALUE;
        Iterator iterator = list.iterator();

        while (iterator.hasNext())
        {
            EntityEnderCrystal entityendercrystal1 = (EntityEnderCrystal)iterator.next();
            double d1 = entityendercrystal1.getDistanceSqToEntity(this);

            if (d1 < d0)
            {
                d0 = d1;
                entityendercrystal = entityendercrystal1;
            }
        }

        this.healingEnderCrystal = entityendercrystal;
    }
}
 
开发者ID:xtrafrancyz,项目名称:Cauldron,代码行数:43,代码来源:EntityDragon.java

示例8: updateDragonEnderCrystal

import net.minecraft.entity.item.EntityEnderCrystal; //导入方法依赖的package包/类
/**
 * Updates the state of the enderdragon's current endercrystal.
 */
private void updateDragonEnderCrystal()
{
    if (this.healingEnderCrystal != null)
    {
        if (this.healingEnderCrystal.isDead)
        {
            if (!this.worldObj.isRemote)
            {
                this.attackEntityFromPart(this.dragonPartHead, DamageSource.generic, 10);
            }

            this.healingEnderCrystal = null;
        }
        else if (this.ticksExisted % 10 == 0 && this.getMaxHealth() < this.getMaxHealth())
        {
            ++health;
        }
    }

    if (this.rand.nextInt(10) == 0)
    {
        float var1 = 32.0F;
        List var2 = this.worldObj.getEntitiesWithinAABB(EntityEnderCrystal.class, this.boundingBox.expand((double)var1, (double)var1, (double)var1));
        EntityEnderCrystal var3 = null;
        double var4 = Double.MAX_VALUE;
        Iterator var6 = var2.iterator();

        while (var6.hasNext())
        {
            EntityEnderCrystal var7 = (EntityEnderCrystal)var6.next();
            double var8 = var7.getDistanceSqToEntity(this);

            if (var8 < var4)
            {
                var4 = var8;
                var3 = var7;
            }
        }

        this.healingEnderCrystal = var3;
    }
}
 
开发者ID:Stormister,项目名称:Rediscovered-Mod-1.6.4,代码行数:46,代码来源:EntityGoodDragon.java

示例9: updateDragonEnderCrystal

import net.minecraft.entity.item.EntityEnderCrystal; //导入方法依赖的package包/类
/**
 * Updates the state of the enderdragon's current endercrystal.
 */
private void updateDragonEnderCrystal()
{
    if (this.healingEnderCrystal != null)
    {
        if (this.healingEnderCrystal.isDead)
        {
            if (!this.worldObj.isRemote)
            {
                this.attackEntityFromPart(this.dragonPartHead, DamageSource.setExplosionSource((Explosion)null), 10.0F);
            }

            this.healingEnderCrystal = null;
        }
        else if (this.ticksExisted % 10 == 0 && this.getHealth() < this.getMaxHealth())
        {
            this.setHealth(this.getHealth() + 1.0F);
        }
    }

    if (this.rand.nextInt(10) == 0)
    {
        float f = 32.0F;
        List list = this.worldObj.getEntitiesWithinAABB(EntityEnderCrystal.class, this.boundingBox.expand((double)f, (double)f, (double)f));
        EntityEnderCrystal entityendercrystal = null;
        double d0 = Double.MAX_VALUE;
        Iterator iterator = list.iterator();

        while (iterator.hasNext())
        {
            EntityEnderCrystal entityendercrystal1 = (EntityEnderCrystal)iterator.next();
            double d1 = entityendercrystal1.getDistanceSqToEntity(this);

            if (d1 < d0)
            {
                d0 = d1;
                entityendercrystal = entityendercrystal1;
            }
        }

        this.healingEnderCrystal = entityendercrystal;
    }
}
 
开发者ID:HATB0T,项目名称:RuneCraftery,代码行数:46,代码来源:EntityDragon.java


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