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


Java EntityLiving.spawnExplosionParticle方法代码示例

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


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

示例1: updateSpawner

import net.minecraft.entity.EntityLiving; //导入方法依赖的package包/类
public void updateSpawner()
{
    if (this.isActivated())
    {
        BlockPos blockpos = this.getSpawnerPosition();

        if (this.getSpawnerWorld().isRemote)
        {
            double d3 = (double)((float)blockpos.getX() + this.getSpawnerWorld().rand.nextFloat());
            double d4 = (double)((float)blockpos.getY() + this.getSpawnerWorld().rand.nextFloat());
            double d5 = (double)((float)blockpos.getZ() + this.getSpawnerWorld().rand.nextFloat());
            this.getSpawnerWorld().spawnParticle(EnumParticleTypes.SMOKE_NORMAL, d3, d4, d5, 0.0D, 0.0D, 0.0D, new int[0]);
            this.getSpawnerWorld().spawnParticle(EnumParticleTypes.FLAME, d3, d4, d5, 0.0D, 0.0D, 0.0D, new int[0]);

            if (this.spawnDelay > 0)
            {
                --this.spawnDelay;
            }

            this.prevMobRotation = this.mobRotation;
            this.mobRotation = (this.mobRotation + (double)(1000.0F / ((float)this.spawnDelay + 200.0F))) % 360.0D;
        }
        else
        {
            if (this.spawnDelay == -1)
            {
                this.resetTimer();
            }

            if (this.spawnDelay > 0)
            {
                --this.spawnDelay;
                return;
            }

            boolean flag = false;

            for (int i = 0; i < this.spawnCount; ++i)
            {
                Entity entity = EntityList.createEntityByName(this.getEntityNameToSpawn(), this.getSpawnerWorld());

                if (entity == null)
                {
                    return;
                }

                int j = this.getSpawnerWorld().getEntitiesWithinAABB(entity.getClass(), (new AxisAlignedBB((double)blockpos.getX(), (double)blockpos.getY(), (double)blockpos.getZ(), (double)(blockpos.getX() + 1), (double)(blockpos.getY() + 1), (double)(blockpos.getZ() + 1))).expand((double)this.spawnRange, (double)this.spawnRange, (double)this.spawnRange)).size();

                if (j >= this.maxNearbyEntities)
                {
                    this.resetTimer();
                    return;
                }

                double d0 = (double)blockpos.getX() + (this.getSpawnerWorld().rand.nextDouble() - this.getSpawnerWorld().rand.nextDouble()) * (double)this.spawnRange + 0.5D;
                double d1 = (double)(blockpos.getY() + this.getSpawnerWorld().rand.nextInt(3) - 1);
                double d2 = (double)blockpos.getZ() + (this.getSpawnerWorld().rand.nextDouble() - this.getSpawnerWorld().rand.nextDouble()) * (double)this.spawnRange + 0.5D;
                EntityLiving entityliving = entity instanceof EntityLiving ? (EntityLiving)entity : null;
                entity.setLocationAndAngles(d0, d1, d2, this.getSpawnerWorld().rand.nextFloat() * 360.0F, 0.0F);

                if (entityliving == null || entityliving.getCanSpawnHere() && entityliving.isNotColliding())
                {
                    this.spawnNewEntity(entity, true);
                    this.getSpawnerWorld().playAuxSFX(2004, blockpos, 0);

                    if (entityliving != null)
                    {
                        entityliving.spawnExplosionParticle();
                    }

                    flag = true;
                }
            }

            if (flag)
            {
                this.resetTimer();
            }
        }
    }
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:82,代码来源:MobSpawnerBaseLogic.java


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