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


Java Entity.isImmuneToFire方法代碼示例

本文整理匯總了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);
			}
		}
	}
}
 
開發者ID:the-realest-stu,項目名稱:Infernum,代碼行數:21,代碼來源:EntityFireBreath.java

示例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;
}
 
開發者ID:the-realest-stu,項目名稱:Infernum,代碼行數:13,代碼來源:SpellBlazingFist.java

示例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);
}
 
開發者ID:sudofox,項目名稱:Backmemed,代碼行數:13,代碼來源:BlockMagma.java

示例4: canEntitySpawn

import net.minecraft.entity.Entity; //導入方法依賴的package包/類
public boolean canEntitySpawn(IBlockState state, Entity entityIn)
{
    return entityIn.isImmuneToFire();
}
 
開發者ID:sudofox,項目名稱:Backmemed,代碼行數:5,代碼來源:BlockMagma.java


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