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


Java Entity.setFire方法代碼示例

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


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

示例1: onEntityCollidedWithBlock

import net.minecraft.entity.Entity; //導入方法依賴的package包/類
@Override
public void onEntityCollidedWithBlock(World world, BlockPos pos, IBlockState state, Entity entity) {
    TileEntity te = world.getTileEntity(pos);
    if (te instanceof TileEntityHeatSink && entity instanceof EntityLivingBase) {
        IHeatExchangerLogic heat = ((TileEntityHeatSink) te).getHeatExchangerLogic(null);
        int temp = (int) ((TileEntityHeatSink) te).getHeatExchangerLogic(null).getTemperature();
        if (temp > 323) { // +50C
            entity.attackEntityFrom(DamageSource.HOT_FLOOR, 2);
            if (temp > 373) { // +100C
                entity.setFire(3);
            }
        } else if (temp < 243) { // -30C
            int durationSec = (243 - (int)heat.getTemperature()) / 10;
            int amplifier = (243 - (int) heat.getTemperature()) / 80;
            ((EntityLivingBase) entity).addPotionEffect(new PotionEffect(MobEffects.SLOWNESS, durationSec * 20, amplifier));
            if (temp < 213) { // -60C
                entity.attackEntityFrom(DamageSourcePneumaticCraft.FREEZING, 2);
            }
        }
    }
}
 
開發者ID:TeamPneumatic,項目名稱:pnc-repressurized,代碼行數:22,代碼來源:BlockHeatSink.java

示例2: attackEntityAsMob

import net.minecraft.entity.Entity; //導入方法依賴的package包/類
public boolean attackEntityAsMob(Entity entityIn)
{
    boolean flag = super.attackEntityAsMob(entityIn);

    if (flag)
    {
        int i = this.worldObj.getDifficulty().getDifficultyId();

        if (this.getHeldItem() == null && this.isBurning() && this.rand.nextFloat() < (float)i * 0.3F)
        {
            entityIn.setFire(2 * i);
        }
    }

    return flag;
}
 
開發者ID:Notoh,項目名稱:DecompiledMinecraft,代碼行數:17,代碼來源:EntityZombie.java

示例3: attackEntityAsMob

import net.minecraft.entity.Entity; //導入方法依賴的package包/類
public boolean attackEntityAsMob(Entity entityIn)
{
    boolean flag = super.attackEntityAsMob(entityIn);

    if (flag)
    {
        float f = this.worldObj.getDifficultyForLocation(new BlockPos(this)).getAdditionalDifficulty();

        if (this.getHeldItemMainhand() == null)
        {
            if (this.isBurning() && this.rand.nextFloat() < f * 0.3F)
            {
                entityIn.setFire(2 * (int)f);
            }

            if (this.getZombieType() == ZombieType.HUSK && entityIn instanceof EntityLivingBase)
            {
                ((EntityLivingBase)entityIn).addPotionEffect(new PotionEffect(MobEffects.HUNGER, 140 * (int)f));
            }
        }
    }

    return flag;
}
 
開發者ID:F1r3w477,項目名稱:CustomWorldGen,代碼行數:25,代碼來源:EntityZombie.java

示例4: onLeftClickEntity

import net.minecraft.entity.Entity; //導入方法依賴的package包/類
@Override
public boolean onLeftClickEntity(ItemStack stack, EntityPlayer player, Entity entity)
{
	if (player.worldObj.isRemote) { return false; }	// Not doing this on client side

	if (this.getDamage(stack) >= this.getMaxDamage())
	{
		entity.attackEntityFrom(DamageSource.causePlayerDamage(player), this.DmgMin);
		entity.hurtResistantTime = 0;	// No invincibility frames

		return false; 				// We're not loaded, getting out of here with minimal damage
	}

	this.consumeAmmo(stack, entity, 1);

	// SFX
	NetHelper.sendParticleMessageToAllPlayers(entity.worldObj, player.getEntityId(), (byte) 3, (byte) 4);	// smoke

	// Dmg
	entity.worldObj.createExplosion(player, entity.posX, entity.posY +0.5D, entity.posZ, (float) this.ExplosionSize, this.dmgTerrain); 	// 4.0F is TNT
	entity.setFire(2);																	// Setting fire to them for 2 sec, so pigs can drop cooked porkchops

	entity.attackEntityFrom(DamageSource.causePlayerDamage(player), this.DmgMax);	// Dealing damage directly. Screw weapon attributes

	return false;
}
 
開發者ID:Domochevsky,項目名稱:minecraft-quiverbow,代碼行數:27,代碼來源:PowderKnuckle_Mod.java

示例5: onLeftClickEntity

import net.minecraft.entity.Entity; //導入方法依賴的package包/類
@Override
public boolean onLeftClickEntity(ItemStack stack, EntityPlayer player, Entity entity)
{
	if (player.worldObj.isRemote) { return false; }	// Not doing this on client side

	if (this.getDamage(stack) >= this.getMaxDamage())
	{
		entity.attackEntityFrom(DamageSource.causePlayerDamage(player), this.DmgMin);
		entity.hurtResistantTime = 0;	// No invincibility frames

		return false; 				// We're not loaded, getting out of here with minimal damage
	}

	this.consumeAmmo(stack, entity, 1);

	// SFX
	NetHelper.sendParticleMessageToAllPlayers(entity.worldObj, player.getEntityId(), (byte) 3, (byte) 4);	// smoke

	// Dmg
	entity.setFire(2);																	// Setting fire to them for 2 sec, so pigs can drop cooked porkchops
	entity.worldObj.createExplosion(player, entity.posX, entity.posY + 0.5D, entity.posZ, (float) this.ExplosionSize, this.dmgTerrain); 	// 4.0F is TNT

	entity.attackEntityFrom(DamageSource.causePlayerDamage(player), this.DmgMax);	// Dealing damage directly. Screw weapon attributes

	return false;
}
 
開發者ID:Domochevsky,項目名稱:minecraft-quiverbow,代碼行數:27,代碼來源:PowderKnuckle.java

示例6: attackEntityAsMob

import net.minecraft.entity.Entity; //導入方法依賴的package包/類
public boolean attackEntityAsMob(Entity entityIn)
{
    boolean flag = super.attackEntityAsMob(entityIn);

    if (flag)
    {
        float f = this.world.getDifficultyForLocation(new BlockPos(this)).getAdditionalDifficulty();

        if (this.getHeldItemMainhand().func_190926_b() && this.isBurning() && this.rand.nextFloat() < f * 0.3F)
        {
            entityIn.setFire(2 * (int)f);
        }
    }

    return flag;
}
 
開發者ID:sudofox,項目名稱:Backmemed,代碼行數:17,代碼來源:EntityZombie.java

示例7: onEntityCollidedWithBlock

import net.minecraft.entity.Entity; //導入方法依賴的package包/類
@Override
public void onEntityCollidedWithBlock(World worldIn, BlockPos pos, IBlockState state, Entity entityIn) {
	super.onEntityCollidedWithBlock(worldIn, pos, state, entityIn);
	if (!entityIn.isWet()) {
		entityIn.setFire(8);
	}
}
 
開發者ID:MinecraftModDevelopmentMods,項目名稱:Got-Wood,代碼行數:8,代碼來源:BlockSpecialFire.java

示例8: attackEntityAsMob

import net.minecraft.entity.Entity; //導入方法依賴的package包/類
public boolean attackEntityAsMob(Entity entityIn)
{
    float f = (float)this.getEntityAttribute(SharedMonsterAttributes.attackDamage).getAttributeValue();
    int i = 0;

    if (entityIn instanceof EntityLivingBase)
    {
        f += EnchantmentHelper.func_152377_a(this.getHeldItem(), ((EntityLivingBase)entityIn).getCreatureAttribute());
        i += EnchantmentHelper.getKnockbackModifier(this);
    }

    boolean flag = entityIn.attackEntityFrom(DamageSource.causeMobDamage(this), f);

    if (flag)
    {
        if (i > 0)
        {
            entityIn.addVelocity((double)(-MathHelper.sin(this.rotationYaw * (float)Math.PI / 180.0F) * (float)i * 0.5F), 0.1D, (double)(MathHelper.cos(this.rotationYaw * (float)Math.PI / 180.0F) * (float)i * 0.5F));
            this.motionX *= 0.6D;
            this.motionZ *= 0.6D;
        }

        int j = EnchantmentHelper.getFireAspectModifier(this);

        if (j > 0)
        {
            entityIn.setFire(j * 4);
        }

        this.applyEnchantments(this, entityIn);
    }

    return flag;
}
 
開發者ID:Notoh,項目名稱:DecompiledMinecraft,代碼行數:35,代碼來源:EntityMob.java

示例9: onImpact

import net.minecraft.entity.Entity; //導入方法依賴的package包/類
@Override
protected void onImpact(RayTraceResult result) {
	if (result.typeOfHit == RayTraceResult.Type.ENTITY) {
		EntityLivingBase thrower = getThrower();
		// prevent damaging thrower
		if (result.entityHit == thrower)
			return;

		Entity entity = result.entityHit;
		DamageSource ds = createDamageSource(null == thrower ? this : thrower);

		if (isBurning() && !(entity instanceof EntityEnderman))
			entity.setFire(5);
		if (entity.attackEntityFrom(ds, getDamage())) {
			if (entity instanceof EntityLivingBase) {
				EntityLivingBase base = (EntityLivingBase) entity;

				if (knockbackStrength > 0) {
					float f1 = MathHelper.sqrt_double(motionX * motionX + motionZ * motionZ);
					if (f1 > 0f) {
						base.addVelocity(motionX * knockbackStrength * 0.6000000238418579D / f1,
							0.1D, motionZ * knockbackStrength * 0.6000000238418579D / f1);
					}
				}

				if (null != thrower) {
					EnchantmentHelper.applyThornEnchantments(base, thrower);
					EnchantmentHelper.applyArthropodEnchantments(thrower, base);
					if (base != thrower && base instanceof EntityPlayer && thrower instanceof EntityPlayerMP)
					{
						((EntityPlayerMP)thrower).connection.sendPacket(new SPacketChangeGameState(6, 0.0F));
					}
				}
			}
		}
	}
	if (!worldObj.isRemote)
        setDead();
}
 
開發者ID:arucil,項目名稱:mc-Slingshot,代碼行數:40,代碼來源:EntityBall.java

示例10: makeBurn

import net.minecraft.entity.Entity; //導入方法依賴的package包/類
public void makeBurn(BlockPos pos) {
	// System.out.println("burned2");
	List<Entity> entities = this.world.getEntitiesWithinAABBExcludingEntity(this,
			new AxisAlignedBB(pos.getX(), pos.getY(), pos.getZ(), pos.getX() + 1, pos.getY() + 1, pos.getZ() + 1));
	for (Entity entity : entities) {
		entity.setFire(15);
		if (entity != this.owner)
			BlockEventBus.extraBurn.put(entity, 100);
	}
}
 
開發者ID:rafradek,項目名稱:Mods,代碼行數:11,代碼來源:EntityFallingEnchantedBlock.java

示例11: igniteAndAchievement

import net.minecraft.entity.Entity; //導入方法依賴的package包/類
public static void igniteAndAchievement(Entity target, EntityLivingBase living, int sec) {

	/*if (living instanceof EntityPlayerMP) {
		if (target.hasCapability(TF2weapons.WEAPONS_CAP, null) && target.getDataManager().get(TF2EventsCommon.ENTITY_EXP_JUMP)) {
			((EntityPlayer) living).addStat(TF2Achievements.PILOT_LIGHT);
		}
		if (ItemFromData.isSameType(living.getHeldItemMainhand(), "flaregun") && !target.isBurning()) {
			((EntityPlayer) living).addStat(TF2Achievements.FLAREGUN_IGNITED);
			if (((EntityPlayerMP) living).getStatFile().readStat(TF2Achievements.FLAREGUN_IGNITED) >= 100)
				((EntityPlayer) living).addStat(TF2Achievements.ATTENTION_GETTER);
		}
	}*/
	target.setFire(sec);
}
 
開發者ID:rafradek,項目名稱:Mods,代碼行數:15,代碼來源:TF2Util.java

示例12: attackEntityAsMob

import net.minecraft.entity.Entity; //導入方法依賴的package包/類
public boolean attackEntityAsMob(Entity entityIn)
{
    float f = (float)this.getEntityAttribute(SharedMonsterAttributes.ATTACK_DAMAGE).getAttributeValue();
    int i = 0;

    if (entityIn instanceof EntityLivingBase)
    {
        f += EnchantmentHelper.getModifierForCreature(this.getHeldItemMainhand(), ((EntityLivingBase)entityIn).getCreatureAttribute());
        i += EnchantmentHelper.getKnockbackModifier(this);
    }

    boolean flag = entityIn.attackEntityFrom(DamageSource.causeMobDamage(this), f);

    if (flag)
    {
        if (i > 0 && entityIn instanceof EntityLivingBase)
        {
            ((EntityLivingBase)entityIn).knockBack(this, (float)i * 0.5F, (double)MathHelper.sin(this.rotationYaw * 0.017453292F), (double)(-MathHelper.cos(this.rotationYaw * 0.017453292F)));
            this.motionX *= 0.6D;
            this.motionZ *= 0.6D;
        }

        int j = EnchantmentHelper.getFireAspectModifier(this);

        if (j > 0)
        {
            entityIn.setFire(j * 4);
        }

        if (entityIn instanceof EntityPlayer)
        {
            EntityPlayer entityplayer = (EntityPlayer)entityIn;
            ItemStack itemstack = this.getHeldItemMainhand();
            ItemStack itemstack1 = entityplayer.isHandActive() ? entityplayer.getActiveItemStack() : null;

            if (itemstack != null && itemstack1 != null && itemstack.getItem() instanceof ItemAxe && itemstack1.getItem() == Items.SHIELD)
            {
                float f1 = 0.25F + (float)EnchantmentHelper.getEfficiencyModifier(this) * 0.05F;

                if (this.rand.nextFloat() < f1)
                {
                    entityplayer.getCooldownTracker().setCooldown(Items.SHIELD, 100);
                    this.worldObj.setEntityState(entityplayer, (byte)30);
                }
            }
        }

        this.applyEnchantments(this, entityIn);
    }

    return flag;
}
 
開發者ID:F1r3w477,項目名稱:CustomWorldGen,代碼行數:53,代碼來源:EntityMob.java

示例13: attackEntityAsMob

import net.minecraft.entity.Entity; //導入方法依賴的package包/類
@Override
public boolean attackEntityAsMob(Entity entityIn) {
	float f = (float) this.getEntityAttribute(SharedMonsterAttributes.ATTACK_DAMAGE).getAttributeValue();
	int i = 0;

	if (entityIn instanceof EntityLivingBase) {
		f += EnchantmentHelper.getModifierForCreature(this.getHeldItemMainhand(),
				((EntityLivingBase) entityIn).getCreatureAttribute());
		i += EnchantmentHelper.getKnockbackModifier(this);
	}

	boolean flag = entityIn.attackEntityFrom(DamageSource.causeMobDamage(this), f);

	if (flag) {
		if (i > 0 && entityIn instanceof EntityLivingBase) {
			((EntityLivingBase) entityIn).knockBack(this, i * 0.5F, MathHelper.sin(this.rotationYaw * 0.017453292F),
					(-MathHelper.cos(this.rotationYaw * 0.017453292F)));
			this.motionX *= 0.6D;
			this.motionZ *= 0.6D;
		}

		int j = EnchantmentHelper.getFireAspectModifier(this);

		if (j > 0)
			entityIn.setFire(j * 4);

		if (entityIn instanceof EntityPlayer) {
			EntityPlayer entityplayer = (EntityPlayer) entityIn;
			ItemStack itemstack = this.getHeldItemMainhand();
			ItemStack itemstack1 = entityplayer.isHandActive() ? entityplayer.getActiveItemStack() : null;

			if (!itemstack.isEmpty() && itemstack1 != null && itemstack.getItem() instanceof ItemAxe
					&& itemstack1.getItem() == Items.SHIELD) {
				float f1 = 0.25F + EnchantmentHelper.getEfficiencyModifier(this) * 0.05F;

				if (this.rand.nextFloat() < f1) {
					entityplayer.getCooldownTracker().setCooldown(Items.SHIELD, 100);
					this.world.setEntityState(entityplayer, (byte) 30);
				}
			}
		}

		this.applyEnchantments(this, entityIn);

		if (entityIn instanceof EntityLivingBase && ((EntityLivingBase) entityIn).getHealth() <= 0)
			if (entityIn instanceof EntityBuilding)
				this.playSound(TF2Sounds.MOB_SAXTON_DESTROY, 2.2F, 1f);
			else
				this.playSound(TF2Sounds.MOB_SAXTON_KILL, 2.2F, 1f);
	}

	return flag;
}
 
開發者ID:rafradek,項目名稱:Mods,代碼行數:54,代碼來源:EntitySaxtonHale.java

示例14: attackEntityAsMob

import net.minecraft.entity.Entity; //導入方法依賴的package包/類
public boolean attackEntityAsMob(Entity entityIn)
{
    float f = (float)this.getEntityAttribute(SharedMonsterAttributes.ATTACK_DAMAGE).getAttributeValue();
    int i = 0;

    if (entityIn instanceof EntityLivingBase)
    {
        f += EnchantmentHelper.getModifierForCreature(this.getHeldItemMainhand(), ((EntityLivingBase)entityIn).getCreatureAttribute());
        i += EnchantmentHelper.getKnockbackModifier(this);
    }

    boolean flag = entityIn.attackEntityFrom(DamageSource.causeMobDamage(this), f);

    if (flag)
    {
        if (i > 0 && entityIn instanceof EntityLivingBase)
        {
            ((EntityLivingBase)entityIn).knockBack(this, (float)i * 0.5F, (double)MathHelper.sin(this.rotationYaw * 0.017453292F), (double)(-MathHelper.cos(this.rotationYaw * 0.017453292F)));
            this.motionX *= 0.6D;
            this.motionZ *= 0.6D;
        }

        int j = EnchantmentHelper.getFireAspectModifier(this);

        if (j > 0)
        {
            entityIn.setFire(j * 4);
        }

        if (entityIn instanceof EntityPlayer)
        {
            EntityPlayer entityplayer = (EntityPlayer)entityIn;
            ItemStack itemstack = this.getHeldItemMainhand();
            ItemStack itemstack1 = entityplayer.isHandActive() ? entityplayer.getActiveItemStack() : ItemStack.field_190927_a;

            if (!itemstack.func_190926_b() && !itemstack1.func_190926_b() && itemstack.getItem() instanceof ItemAxe && itemstack1.getItem() == Items.SHIELD)
            {
                float f1 = 0.25F + (float)EnchantmentHelper.getEfficiencyModifier(this) * 0.05F;

                if (this.rand.nextFloat() < f1)
                {
                    entityplayer.getCooldownTracker().setCooldown(Items.SHIELD, 100);
                    this.world.setEntityState(entityplayer, (byte)30);
                }
            }
        }

        this.applyEnchantments(this, entityIn);
    }

    return flag;
}
 
開發者ID:sudofox,項目名稱:Backmemed,代碼行數:53,代碼來源:EntityMob.java

示例15: attackEntityAsMob

import net.minecraft.entity.Entity; //導入方法依賴的package包/類
@Override
public boolean attackEntityAsMob(Entity entityIn) {
	float f = (float) this.getEntityAttribute(SharedMonsterAttributes.ATTACK_DAMAGE).getBaseValue();
	int i = 0;

	if (entityIn instanceof EntityLivingBase) {
		f += EnchantmentHelper.getModifierForCreature(this.getHeldItemMainhand(),
				((EntityLivingBase) entityIn).getCreatureAttribute());
		i += EnchantmentHelper.getKnockbackModifier(this);
	}

	boolean flag = entityIn.attackEntityFrom(DamageSource.causeMobDamage(this), f);

	if (flag) {
		if (i > 0 && entityIn instanceof EntityLivingBase) {
			((EntityLivingBase) entityIn).knockBack(this, i * 0.5F, MathHelper.sin(this.rotationYaw * 0.017453292F),
					(-MathHelper.cos(this.rotationYaw * 0.017453292F)));
			this.motionX *= 0.6D;
			this.motionZ *= 0.6D;
		}

		int j = EnchantmentHelper.getFireAspectModifier(this);

		if (j > 0)
			entityIn.setFire(j * 4);

		if (entityIn instanceof EntityPlayer) {
			EntityPlayer entityplayer = (EntityPlayer) entityIn;
			ItemStack itemstack = this.getHeldItemMainhand();
			ItemStack itemstack1 = entityplayer.isHandActive() ? entityplayer.getActiveItemStack() : null;

			if (!itemstack.isEmpty() && itemstack1 != null && itemstack.getItem() instanceof ItemAxe
					&& itemstack1.getItem() == Items.SHIELD) {
				float f1 = 0.25F + EnchantmentHelper.getEfficiencyModifier(this) * 0.05F;

				if (this.rand.nextFloat() < f1) {
					entityplayer.getCooldownTracker().setCooldown(Items.SHIELD, 100);
					this.world.setEntityState(entityplayer, (byte) 30);
				}
			}
		}

		this.applyEnchantments(this, entityIn);
	}

	return flag;
}
 
開發者ID:rafradek,項目名稱:Mods,代碼行數:48,代碼來源:EntityTF2Character.java


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