本文整理匯總了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);
}
}
}
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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);
}
}
示例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;
}
示例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();
}
示例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);
}
}
示例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);
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}