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