本文整理匯總了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;
}
}
示例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();
}
}
}
}