本文整理匯總了Java中net.minecraft.entity.Entity.isImmuneToFire方法的典型用法代碼示例。如果您正苦於以下問題:Java Entity.isImmuneToFire方法的具體用法?Java Entity.isImmuneToFire怎麽用?Java Entity.isImmuneToFire使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類net.minecraft.entity.Entity
的用法示例。
在下文中一共展示了Entity.isImmuneToFire方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: onImpact
import net.minecraft.entity.Entity; //導入方法依賴的package包/類
protected void onImpact(RayTraceResult result) {
if (!this.world.isRemote && this.world instanceof WorldServer) {
if (result.typeOfHit == RayTraceResult.Type.ENTITY && result.entityHit != null
&& !result.entityHit.equals(this.caster)) {
Entity entity = result.entityHit;
if (!entity.isImmuneToFire()) {
entity.setFire(7);
}
} else if (result.typeOfHit == RayTraceResult.Type.BLOCK && result.getBlockPos() != null
&& result.sideHit != null) {
BlockPos offsetPos = result.getBlockPos().offset(result.sideHit);
if (this.world.getBlockState(offsetPos).getMaterial() != Material.WATER
&& (this.world.isAirBlock(offsetPos)
|| this.world.getBlockState(offsetPos).getBlock().isReplaceable(this.world, offsetPos))
&& Blocks.FIRE.canPlaceBlockAt(this.world, offsetPos)) {
this.world.setBlockState(offsetPos, Blocks.FIRE.getDefaultState(), 11);
}
}
}
}
示例2: onCastMelee
import net.minecraft.entity.Entity; //導入方法依賴的package包/類
@Override
public boolean onCastMelee(World world, EntityPlayer player, Entity entity, ItemStack stack) {
if (!entity.isImmuneToFire() && entity instanceof EntityLivingBase && consumePower(player)) {
EntityLivingBase entityLivingBase = (EntityLivingBase) entity;
entityLivingBase.attackEntityFrom(new EntityDamageSourceSpell(player), 4);
entityLivingBase.setFire(5);
if (!world.isRemote && world instanceof WorldServer) {
((WorldServer) world).spawnParticle(EnumParticleTypes.FLAME, true, entity.posX, entity.posY + (entity.height / 2F), entity.posZ, world.rand.nextInt(8) + 12, entity.width / 2F, entity.height / 2F, entity.width / 2F, 0.01F);
}
}
return false;
}
示例3: onEntityWalk
import net.minecraft.entity.Entity; //導入方法依賴的package包/類
/**
* Triggered whenever an entity collides with this block (enters into the block)
*/
public void onEntityWalk(World worldIn, BlockPos pos, Entity entityIn)
{
if (!entityIn.isImmuneToFire() && entityIn instanceof EntityLivingBase && !EnchantmentHelper.hasFrostWalkerEnchantment((EntityLivingBase)entityIn))
{
entityIn.attackEntityFrom(DamageSource.hotFloor, 1.0F);
}
super.onEntityWalk(worldIn, pos, entityIn);
}
示例4: canEntitySpawn
import net.minecraft.entity.Entity; //導入方法依賴的package包/類
public boolean canEntitySpawn(IBlockState state, Entity entityIn)
{
return entityIn.isImmuneToFire();
}