Java Code Examples for net.minecraft.entity.Entity#setFire()
The following examples show how to use
net.minecraft.entity.Entity#setFire() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: EntityToroNpc.java From ToroQuest with GNU General Public License v3.0 | 7 votes |
protected void handleSuccessfulAttack(Entity entityIn, int knockback) { if (knockback > 0 && entityIn instanceof EntityLivingBase) { ((EntityLivingBase) entityIn).knockBack(this, (float) knockback * 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.world.setEntityState(entityplayer, (byte) 30); } } } this.applyEnchantments(this, entityIn); }
Example 2
Source File: EntityBackupZombie.java From Wizardry with GNU Lesser General Public License v3.0 | 5 votes |
@Override public boolean attackEntityAsMob(Entity entityIn) { boolean flag = super.attackEntityAsMob(entityIn); if (flag) { float f = this.world.getDifficultyForLocation(new BlockPos(this)).getAdditionalDifficulty(); if (this.getHeldItemMainhand().isEmpty() && this.isBurning() && this.rand.nextFloat() < f * 0.3F) { entityIn.setFire(2 * (int) f); } } return flag; }
Example 3
Source File: ModuleEffectBurn.java From Wizardry with GNU Lesser General Public License v3.0 | 5 votes |
@Override public boolean run(@NotNull World world, ModuleInstanceEffect instance, @Nonnull SpellData spell, @Nonnull SpellRing spellRing) { Entity targetEntity = spell.getVictim(world); BlockPos targetPos = spell.getTargetPos(); Entity caster = spell.getCaster(world); EnumFacing facing = spell.getData(FACE_HIT); double area = spellRing.getAttributeValue(world, AttributeRegistry.AREA, spell) / 2.0; double time = spellRing.getAttributeValue(world, AttributeRegistry.DURATION, spell); if (!spellRing.taxCaster(world, spell, true)) return false; if (targetEntity != null) { targetEntity.setFire((int) time); world.playSound(null, targetEntity.getPosition(), ModSounds.FIRE, SoundCategory.NEUTRAL, RandUtil.nextFloat(0.35f, 0.75f), RandUtil.nextFloat(0.35f, 1.5f)); } if (targetPos != null) { for (int x = (int) area; x >= -area; x--) for (int y = (int) area; y >= -area; y--) for (int z = (int) area; z >= -area; z--) { BlockPos pos = targetPos.add(x, y, z); double dist = pos.getDistance(targetPos.getX(), targetPos.getY(), targetPos.getZ()); if (dist > area) continue; if (facing != null) { if (!world.isAirBlock(pos.offset(facing))) continue; BlockUtils.placeBlock(world, pos.offset(facing), Blocks.FIRE.getDefaultState(), BlockUtils.makePlacer(world, pos, caster)); } else for (EnumFacing face : EnumFacing.VALUES) { if (world.isAirBlock(pos.offset(face)) || world.getBlockState(pos.offset(face)).getBlock() == Blocks.SNOW_LAYER) { BlockUtils.placeBlock(world, pos.offset(face), Blocks.AIR.getDefaultState(), BlockUtils.makePlacer(world, pos, caster)); } } } world.playSound(null, targetPos, ModSounds.FIRE, SoundCategory.AMBIENT, 0.5f, RandUtil.nextFloat()); } return true; }
Example 4
Source File: EntityFluidCow.java From Moo-Fluids with GNU General Public License v3.0 | 5 votes |
private void applyDamagesToEntity(final Entity entity) { if (entity instanceof EntityLivingBase) { if (entityTypeData.canCauseFireDamage()) { byte ticksOfDamage = 8; if (entity instanceof EntityPlayer) { final EntityPlayer entityPlayer = (EntityPlayer) entity; final int armorInventoryLength = entityPlayer.inventory.armorInventory.size(); int currentArmorSlot; for (currentArmorSlot = 0; currentArmorSlot < armorInventoryLength; currentArmorSlot++) { if (!entityPlayer.inventory.armorInventory.get(currentArmorSlot).isEmpty()) { ticksOfDamage -= 2; } } } entity.attackEntityFrom(new BurnDamageSource("burn", this), entityTypeData.getFireDamageAmount()); entity.setFire(ticksOfDamage); } if (entityTypeData.canCauseNormalDamage()) { entity.attackEntityFrom(new AttackDamageSource("whacked", this), entityTypeData.getNormalDamageAmount()); } } }
Example 5
Source File: BlockHeatSink.java From PneumaticCraft with GNU General Public License v3.0 | 5 votes |
@Override public void onEntityCollidedWithBlock(World world, int x, int y, int z, Entity entity){ TileEntityHeatSink heatSink = (TileEntityHeatSink)world.getTileEntity(x, y, z); if(heatSink.getHeatExchangerLogic(ForgeDirection.UNKNOWN).getTemperature() > 323) { entity.setFire(3); } }
Example 6
Source File: TileMicrowaveReciever.java From AdvancedRocketry with MIT License | 4 votes |
@Override public void update() { if(!initialCheck && !world.isRemote) { completeStructure = attemptCompleteStructure(world.getBlockState(pos)); onInventoryUpdated(); initialCheck = true; } if(!isComplete()) return; //Periodically check for obstructing blocks above the panel if(!world.isRemote && getPowerMadeLastTick() > 0 && world.getTotalWorldTime() % 100 == 0) { Vector3F<Integer> offset = getControllerOffset(getStructure()); List<Entity> entityList = world.getEntitiesWithinAABB(Entity.class, new AxisAlignedBB(this.getPos().getX() - offset.x, this.getPos().getY(), this.getPos().getZ() - offset.z, this.getPos().getX() - offset.x + getStructure()[0][0].length, 256, this.getPos().getZ() - offset.z + getStructure()[0].length)); for(Entity e : entityList) { e.setFire(5); } for(int x=0 ; x < getStructure()[0][0].length; x++) { for(int z=0 ; z < getStructure()[0].length; z++) { BlockPos pos2; IBlockState state = world.getBlockState(pos2 = (world.getHeight(pos.add(x - offset.x, 128, z - offset.z)).add(0, -1, 0))); if(pos2.getY() > this.getPos().getY()) { if(!world.isAirBlock(pos2.add(0,1,0))) { world.setBlockToAir(pos2); world.playSound((double)pos2.getX(), (double)pos2.getY(), (double)pos2.getZ(), new SoundEvent(new ResourceLocation("fire.fire")), SoundCategory.BLOCKS, 1f, 3f, false); } } } } } DimensionProperties properties; if(!world.isRemote && (DimensionManager.getInstance().isDimensionCreated(world.provider.getDimension()) || world.provider.getDimension() == 0)) { properties = DimensionManager.getInstance().getDimensionProperties(world.provider.getDimension()); int energyRecieved = 0; if(enabled) { for(long lng : connectedSatellites) { SatelliteBase satellite = properties.getSatellite(lng); if(satellite instanceof IUniversalEnergyTransmitter) { energyRecieved += ((IUniversalEnergyTransmitter)satellite).transmitEnergy(EnumFacing.UP, false); } } } powerMadeLastTick = (int) (energyRecieved*Configuration.microwaveRecieverMulitplier); if(powerMadeLastTick != prevPowerMadeLastTick) { prevPowerMadeLastTick = powerMadeLastTick; PacketHandler.sendToNearby(new PacketMachine(this, (byte)1), world.provider.getDimension(),pos, 128); } producePower(powerMadeLastTick); } if(world.isRemote) textModule.setText(LibVulpes.proxy.getLocalizedString("msg.microwaverec.generating") + powerMadeLastTick + " " + LibVulpes.proxy.getLocalizedString("msg.powerunit.rfpertick")); }
Example 7
Source File: BlockSmallFire.java From GardenCollection with MIT License | 4 votes |
@Override public void onEntityCollidedWithBlock (World world, int x, int y, int z, Entity entity) { entity.setFire(1); }
Example 8
Source File: ItemRockbreakerDrill.java From Electro-Magic-Tools with GNU General Public License v3.0 | 4 votes |
public boolean onLeftClickEntity(ItemStack stack, EntityPlayer player, Entity entity) { if (!((Entity) (player)).worldObj.isRemote && (!(entity instanceof EntityPlayer) || MinecraftServer.getServer().isPVPEnabled())) { entity.setFire(2); } return super.onLeftClickEntity(stack, player, entity); }