當前位置: 首頁>>代碼示例>>Java>>正文


Java EntityLiving.isNotColliding方法代碼示例

本文整理匯總了Java中net.minecraft.entity.EntityLiving.isNotColliding方法的典型用法代碼示例。如果您正苦於以下問題:Java EntityLiving.isNotColliding方法的具體用法?Java EntityLiving.isNotColliding怎麽用?Java EntityLiving.isNotColliding使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在net.minecraft.entity.EntityLiving的用法示例。


在下文中一共展示了EntityLiving.isNotColliding方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: canEntitySpawnSpawner

import net.minecraft.entity.EntityLiving; //導入方法依賴的package包/類
public static boolean canEntitySpawnSpawner(EntityLiving entity, World world, float x, float y, float z)
{
    Result result = canEntitySpawn(entity, world, x, y, z);
    if (result == Result.DEFAULT)
    {
        return entity.getCanSpawnHere() && entity.isNotColliding(); // vanilla logic
    }
    else
    {
        return result == Result.ALLOW;
    }
}
 
開發者ID:F1r3w477,項目名稱:CustomWorldGen,代碼行數:13,代碼來源:ForgeEventFactory.java

示例2: 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.isNotColliding方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。