当前位置: 首页>>代码示例>>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;未经允许,请勿转载。