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


Java EntityLivingBase.setFire方法代碼示例

本文整理匯總了Java中net.minecraft.entity.EntityLivingBase.setFire方法的典型用法代碼示例。如果您正苦於以下問題:Java EntityLivingBase.setFire方法的具體用法?Java EntityLivingBase.setFire怎麽用?Java EntityLivingBase.setFire使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在net.minecraft.entity.EntityLivingBase的用法示例。


在下文中一共展示了EntityLivingBase.setFire方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: apply

import net.minecraft.entity.EntityLivingBase; //導入方法依賴的package包/類
@Override
public void apply(World world, BlockPos pos, EntityLivingBase entity, int amplifier, int tick) {
	if (amplifier >= 3) {
		if (entity instanceof EntityWitch) {
			entity.setFire(500);
			entity.attackEntityFrom(DamageSource.MAGIC, 20);
		} else if (entity.getCreatureAttribute() == EnumCreatureAttribute.ILLAGER) {
			entity.addPotionEffect(new PotionEffect(MobEffects.WITHER, 1500, 0));
			entity.attackEntityFrom(DamageSource.MAGIC, 20);
		}
	} else if (amplifier == 2 && entity.getCreatureAttribute() == EnumCreatureAttribute.ILLAGER || entity instanceof EntityWitch) {
		entity.attackEntityFrom(DamageSource.MAGIC, 16);
	} else if (entity.getCreatureAttribute() == EnumCreatureAttribute.ILLAGER) {
		entity.attackEntityFrom(DamageSource.MAGIC, 10);
	}
}
 
開發者ID:Um-Mitternacht,項目名稱:Bewitchment,代碼行數:17,代碼來源:OutcastsShameBrew.java

示例2: apply

import net.minecraft.entity.EntityLivingBase; //導入方法依賴的package包/類
@Override
public void apply(World world, BlockPos pos, EntityLivingBase entity, int amplifier, int tick) {
	if (entity.isEntityUndead()) {
		if (amplifier >= 3 && entity.isEntityUndead()) {
			entity.setFire(500);
			entity.attackEntityFrom(DamageSource.MAGIC, 20);
		} else if (amplifier == 2) {
			entity.attackEntityFrom(DamageSource.MAGIC, 16);
		} else {
			entity.attackEntityFrom(DamageSource.MAGIC, 10);
		}
	}
}
 
開發者ID:Um-Mitternacht,項目名稱:Bewitchment,代碼行數:14,代碼來源:HolyWaterBrew.java

示例3: onEntityUpdate

import net.minecraft.entity.EntityLivingBase; //導入方法依賴的package包/類
@SubscribeEvent
public void onEntityUpdate(LivingUpdateEvent event)
{
	EntityLivingBase living = event.getEntityLiving();
	if(living instanceof IBurnInDay && living.world.isDaytime() && !living.world.isRemote && !living.isChild() && ((IBurnInDay)living).shouldBurn() && living.getBrightness() > 0.5F && 
			living.getRNG().nextFloat() * 30.0F < (living.getBrightness() - 0.4F) * 2.0F && living.world.canSeeSky(new BlockPos(living.posX, living.posY + (double)living.getEyeHeight(), living.posZ)))
	{
		boolean flag = true;
           ItemStack itemstack = living.getItemStackFromSlot(EntityEquipmentSlot.HEAD);
           if (!itemstack.isEmpty())
           {
               if (itemstack.isItemStackDamageable())
               {
                   itemstack.setItemDamage(itemstack.getItemDamage() + living.getRNG().nextInt(2));

                   if (itemstack.getItemDamage() >= itemstack.getMaxDamage())
                   {
                   	living.renderBrokenItemStack(itemstack);
                   	living.setItemStackToSlot(EntityEquipmentSlot.HEAD, ItemStack.EMPTY);
                   }
               }

               flag = false;
           }

           if (flag)
           {
           	living.setFire(8);
           }
	}
}
 
開發者ID:kenijey,項目名稱:harshencastle,代碼行數:32,代碼來源:HandlerBurnInDaylight.java

示例4: onCastMelee

import net.minecraft.entity.EntityLivingBase; //導入方法依賴的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

示例5: apply

import net.minecraft.entity.EntityLivingBase; //導入方法依賴的package包/類
@Override
public void apply(World world, BlockPos pos, EntityLivingBase entity, int amplifier, int tick) {
	if (!entity.isBurning()) {
		entity.setFire(500);
	}
}
 
開發者ID:Um-Mitternacht,項目名稱:Bewitchment,代碼行數:7,代碼來源:IgnitionBrew.java


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