/* * Decompiled with CFR 0.152. * * Could not load the following classes: * mods.flammpfeil.slashblade.ItemSlashBlade * mods.flammpfeil.slashblade.ability.StylishRankManager * net.minecraft.command.IEntitySelector * net.minecraft.enchantment.Enchantment * net.minecraft.enchantment.EnchantmentHelper * net.minecraft.entity.Entity * net.minecraft.entity.effect.EntityLightningBolt * net.minecraft.entity.player.EntityPlayer * net.minecraft.item.ItemStack * net.minecraft.nbt.NBTTagCompound * net.minecraft.util.AxisAlignedBB * net.minecraft.util.DamageSource * net.minecraft.world.World * net.minecraftforge.event.ForgeEventFactory */ package Fish.mods.slashblade.SA.entity; import Fish.mods.slashblade.SA.ability.EnderTeleportCanceller; import java.util.List; import mods.flammpfeil.slashblade.ItemSlashBlade; import mods.flammpfeil.slashblade.ability.StylishRankManager; import net.minecraft.command.IEntitySelector; import net.minecraft.enchantment.Enchantment; import net.minecraft.enchantment.EnchantmentHelper; import net.minecraft.entity.Entity; import net.minecraft.entity.effect.EntityLightningBolt; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.AxisAlignedBB; import net.minecraft.util.DamageSource; import net.minecraft.world.World; import net.minecraftforge.event.ForgeEventFactory; public class EntityNoFireLightningBolt extends EntityLightningBolt { private int lightningState; private int boltLivingTime; private Entity target; private IEntitySelector selector; private static String doFireTickTmp = "true"; protected float AttackLevel = 0.0f; protected Entity thrower; private float magicDamage = 0.0f; public static World StoreDoFireTick(World world) { doFireTickTmp = world.getGameRules().getGameRuleStringValue("doFireTick"); world.getGameRules().setOrCreateGameRule("doFireTick", "false"); return world; } public static World RestoreDoFireTick(World world) { world.getGameRules().setOrCreateGameRule("doFireTick", doFireTickTmp); return world; } public EntityNoFireLightningBolt(World p_i1703_1_, double p_i1703_2_, double p_i1703_4_, double p_i1703_6_, Entity target, IEntitySelector selector, Entity thrower) { this(p_i1703_1_, p_i1703_2_, p_i1703_4_, p_i1703_6_, target, selector, thrower, 0.0f); } public EntityNoFireLightningBolt(World p_i1703_1_, double p_i1703_2_, double p_i1703_4_, double p_i1703_6_, Entity target, IEntitySelector selector, Entity thrower, float magicDamage) { super(EntityNoFireLightningBolt.StoreDoFireTick(p_i1703_1_), p_i1703_2_, p_i1703_4_, p_i1703_6_); EntityNoFireLightningBolt.RestoreDoFireTick(p_i1703_1_); this.lightningState = 2; this.boltLivingTime = this.rand.nextInt(3) + 1; this.target = target; this.selector = selector; this.thrower = thrower; this.magicDamage = magicDamage; } public void onUpdate() { if (this.thrower == null) { this.setDead(); return; } this.onEntityUpdate(); if (this.lightningState == 2) { this.worldObj.playSoundEffect(this.posX, this.posY, this.posZ, "ambient.weather.thunder", 10000.0f, 0.8f + this.rand.nextFloat() * 0.2f); this.worldObj.playSoundEffect(this.posX, this.posY, this.posZ, "random.explode", 2.0f, 0.5f + this.rand.nextFloat() * 0.2f); } --this.lightningState; if (this.lightningState < 0) { if (this.boltLivingTime <= 0) { this.setDead(); } else if (this.lightningState < -this.rand.nextInt(10)) { --this.boltLivingTime; this.lightningState = 1; this.boltVertex = this.rand.nextLong(); } } if (this.lightningState >= 0) { ItemStack stack; double d0 = 3.0; List list = this.worldObj.getEntitiesWithinAABBExcludingEntity((Entity)this, AxisAlignedBB.getBoundingBox((double)(this.posX - d0), (double)(this.posY - d0), (double)(this.posZ - d0), (double)(this.posX + d0), (double)(this.posY + 6.0 + d0), (double)(this.posZ + d0)), this.selector); if (this.target.isEntityAlive()) { list.add(this.target); } if ((stack = ((EntityPlayer)this.thrower).getHeldItem()) != null && stack.getItem() instanceof ItemSlashBlade) { int spLightLevel; if (this.magicDamage == 0.0f) { NBTTagCompound tag = ItemSlashBlade.getItemTagCompound((ItemStack)stack); int rank = StylishRankManager.getStylishRank((Entity)this.thrower); int level = EnchantmentHelper.getEnchantmentLevel((int)Enchantment.power.effectId, (ItemStack)stack); this.magicDamage = 1.0f + (ItemSlashBlade.AttackAmplifier.get(tag).floatValue() * -0.2f + (float)level / 20.0f + 0.04f * (float)rank); } stack.getItem(); NBTTagCompound nbt = ItemSlashBlade.getSpecialEffect((ItemStack)stack); if (nbt != null && (spLightLevel = nbt.getInteger("SPLighting")) > 1) { this.magicDamage = (float)((double)this.magicDamage * ((double)spLightLevel * 0.5)); } if (this.magicDamage < 1.0f) { this.magicDamage = 1.0f; } for (int l = 0; l < list.size(); ++l) { Entity entity; if (this.worldObj.isRemote || (entity = (Entity)list.get(l)) == null || entity.isDead) continue; if (entity.hurtResistantTime != 5) { entity.hurtResistantTime = 5; } EnderTeleportCanceller.setTeleportCancel(entity, 600); if (ForgeEventFactory.onEntityStruckByLightning((Entity)entity, (EntityLightningBolt)this)) continue; entity.attackEntityFrom(DamageSource.onFire, this.magicDamage); entity.setFire(6); } } } } protected void entityInit() { } protected void readEntityFromNBT(NBTTagCompound p_70037_1_) { } protected void writeEntityToNBT(NBTTagCompound p_70014_1_) { } }