本文整理汇总了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;
}
}
示例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;
}
}
示例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;
}
}
示例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;
}
}
示例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;
}
}
示例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;
}
}
示例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;
}
}
示例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;
}
}
示例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;
}
}