From 51897c6923fe0592301ed769da827d77c4a343ab Mon Sep 17 00:00:00 2001 From: WayofTime Date: Sun, 19 Jan 2014 16:42:31 -0500 Subject: [PATCH] Fire stuff --- .../AlchemicalWizardry.java | 5 ++- .../{common => }/BloodMagicConfiguration.java | 6 +-- .../common/AlchemicalWizardryEventHooks.java | 39 +++++++++++++++++++ .../common/PotionFlameCloak.java | 18 +++++++++ .../impactEffects/fire/SelfDefaultFire.java | 2 +- .../impactEffects/fire/SelfDefensiveFire.java | 3 ++ .../impactEffects/fire/SelfOffensiveFire.java | 5 ++- 7 files changed, 71 insertions(+), 7 deletions(-) rename BM_src/WayofTime/alchemicalWizardry/{common => }/BloodMagicConfiguration.java (99%) create mode 100644 BM_src/WayofTime/alchemicalWizardry/common/PotionFlameCloak.java diff --git a/BM_src/WayofTime/alchemicalWizardry/AlchemicalWizardry.java b/BM_src/WayofTime/alchemicalWizardry/AlchemicalWizardry.java index 076163e1..3112ef8b 100644 --- a/BM_src/WayofTime/alchemicalWizardry/AlchemicalWizardry.java +++ b/BM_src/WayofTime/alchemicalWizardry/AlchemicalWizardry.java @@ -23,7 +23,6 @@ import thaumcraft.api.ItemApi; import WayofTime.alchemicalWizardry.common.AlchemicalWizardryEventHooks; import WayofTime.alchemicalWizardry.common.AlchemicalWizardryFuelHandler; import WayofTime.alchemicalWizardry.common.AlchemicalWizardryTickHandler; -import WayofTime.alchemicalWizardry.common.BloodMagicConfiguration; import WayofTime.alchemicalWizardry.common.CommonProxy; import WayofTime.alchemicalWizardry.common.EntityAirElemental; import WayofTime.alchemicalWizardry.common.LifeBucketHandler; @@ -31,6 +30,7 @@ import WayofTime.alchemicalWizardry.common.ModLivingDropsEvent; import WayofTime.alchemicalWizardry.common.PacketHandler; import WayofTime.alchemicalWizardry.common.PotionBoost; import WayofTime.alchemicalWizardry.common.PotionDrowning; +import WayofTime.alchemicalWizardry.common.PotionFlameCloak; import WayofTime.alchemicalWizardry.common.PotionFlight; import WayofTime.alchemicalWizardry.common.PotionInhibit; import WayofTime.alchemicalWizardry.common.PotionProjectileProtect; @@ -119,6 +119,7 @@ public class AlchemicalWizardry public static Potion customPotionInhibit; public static Potion customPotionFlight; public static Potion customPotionReciprocation; + public static Potion customPotionFlameCloak; public static int customPotionDrowningID; public static int customPotionBoostID; @@ -126,6 +127,7 @@ public class AlchemicalWizardry public static int customPotionInhibitID; public static int customPotionFlightID; public static int customPotionReciprocationID; + public static int customPotionFlameCloakID; public static boolean isThaumcraftLoaded; @@ -537,6 +539,7 @@ public class AlchemicalWizardry customPotionInhibit = (new PotionInhibit(customPotionInhibitID, false, 0)).setIconIndex(0, 0).setPotionName("Inhibit"); customPotionFlight = (new PotionFlight(customPotionFlightID, false, 0)).setIconIndex(0, 0).setPotionName("Flight"); customPotionReciprocation = (new PotionReciprocation(customPotionReciprocationID, false, 0xFFFFFF)).setIconIndex(0, 0).setPotionName("Reciprocation"); + customPotionFlameCloak = (new PotionFlameCloak(customPotionFlameCloakID,false,0).setIconIndex(0,0).setPotionName("Flame Cloak")); //All items registered go here //LanguageRegistry.addName(orbOfTesting, "Orb of Testing"); LanguageRegistry.addName(ModItems.weakBloodOrb, "Weak Blood Orb"); diff --git a/BM_src/WayofTime/alchemicalWizardry/common/BloodMagicConfiguration.java b/BM_src/WayofTime/alchemicalWizardry/BloodMagicConfiguration.java similarity index 99% rename from BM_src/WayofTime/alchemicalWizardry/common/BloodMagicConfiguration.java rename to BM_src/WayofTime/alchemicalWizardry/BloodMagicConfiguration.java index 03cbb9af..132721ea 100644 --- a/BM_src/WayofTime/alchemicalWizardry/common/BloodMagicConfiguration.java +++ b/BM_src/WayofTime/alchemicalWizardry/BloodMagicConfiguration.java @@ -1,6 +1,5 @@ -package WayofTime.alchemicalWizardry.common; +package WayofTime.alchemicalWizardry; -import WayofTime.alchemicalWizardry.AlchemicalWizardry; import WayofTime.alchemicalWizardry.common.summoning.meteor.MeteorParadigm; import cpw.mods.fml.common.FMLLog; import net.minecraftforge.common.Configuration; @@ -45,7 +44,8 @@ public class BloodMagicConfiguration AlchemicalWizardry.customPotionInhibitID = config.get("Potion ID", "Inhibit", 103).getInt(); AlchemicalWizardry.customPotionFlightID = config.get("Potion ID", "Flight", 104).getInt(); AlchemicalWizardry.customPotionReciprocationID = config.get("Potion ID", "Reciprocation", 105).getInt(); - + AlchemicalWizardry.customPotionFlameCloakID = config.get("Potion ID","FlameCloak",106).getInt(); + MeteorParadigm.maxChance = config.get("meteor", "maxChance", 1000).getInt(); AlchemicalWizardry.doMeteorsDestroyBlocks = config.get("meteor", "doMeteorsDestroyBlocks", true).getBoolean(true); AlchemicalWizardry.diamondMeteorArray = config.get("meteor", "diamondMeteor", new String[]{"oreDiamond", "100", "oreEmerald", "75", "oreCinnabar", "200", "oreAmber", "200"}).getStringList(); diff --git a/BM_src/WayofTime/alchemicalWizardry/common/AlchemicalWizardryEventHooks.java b/BM_src/WayofTime/alchemicalWizardry/common/AlchemicalWizardryEventHooks.java index b76a4824..7848d707 100644 --- a/BM_src/WayofTime/alchemicalWizardry/common/AlchemicalWizardryEventHooks.java +++ b/BM_src/WayofTime/alchemicalWizardry/common/AlchemicalWizardryEventHooks.java @@ -2,6 +2,7 @@ package WayofTime.alchemicalWizardry.common; import WayofTime.alchemicalWizardry.AlchemicalWizardry; import WayofTime.alchemicalWizardry.common.entity.projectile.EnergyBlastProjectile; +import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper; import cpw.mods.fml.common.ObfuscationReflectionHelper; import cpw.mods.fml.relauncher.ReflectionHelper; import net.minecraft.entity.Entity; @@ -10,6 +11,7 @@ import net.minecraft.entity.IProjectile; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.PlayerCapabilities; import net.minecraft.entity.projectile.EntityArrow; +import net.minecraft.potion.Potion; import net.minecraft.util.AxisAlignedBB; import net.minecraft.util.DamageSource; import net.minecraftforge.event.ForgeSubscribe; @@ -51,6 +53,19 @@ public class AlchemicalWizardryEventHooks ((EntityLivingBase) entityAttacking).attackEntityFrom(DamageSource.generic, damageRecieve); } } + + if(entityAttacked.isPotionActive(AlchemicalWizardry.customPotionFlameCloak)) + { + int i = event.entityLiving.getActivePotionEffect(AlchemicalWizardry.customPotionFlameCloak).getAmplifier(); + + Entity entityAttacking = event.source.getSourceOfDamage(); + + if(entityAttacking != null && entityAttacking instanceof EntityLivingBase && !entityAttacking.isImmuneToFire() && !((EntityLivingBase)entityAttacking).isPotionActive(Potion.fireResistance)) + { + entityAttacking.attackEntityFrom(DamageSource.inFire, 2*i+2); + entityAttacking.setFire(3); + } + } } // @ForgeSubscribe @@ -63,6 +78,9 @@ public class AlchemicalWizardryEventHooks public void onEntityUpdate(LivingUpdateEvent event) { EntityLivingBase entityLiving = event.entityLiving; + double x = entityLiving.posX; + double y = entityLiving.posY; + double z = entityLiving.posZ; if (entityLiving instanceof EntityPlayer && entityLiving.worldObj.isRemote) { @@ -210,5 +228,26 @@ public class AlchemicalWizardryEventHooks } } } + + if(entityLiving.isPotionActive(AlchemicalWizardry.customPotionFlameCloak)) + { + entityLiving.worldObj.spawnParticle("flame", x+SpellHelper.gaussian(1),y-1.3+SpellHelper.gaussian(0.3),z+SpellHelper.gaussian(1), 0, 0.06d, 0); + + int i = event.entityLiving.getActivePotionEffect(AlchemicalWizardry.customPotionFlameCloak).getAmplifier(); + double range = i*0.5; + + List entities = SpellHelper.getEntitiesInRange(entityLiving.worldObj, x, y, z, range, range); + if(entities!=null) + { + for(Entity entity : entities) + { + if(!entity.equals(entityLiving)&&!entity.isImmuneToFire()&&!(entity instanceof EntityLivingBase && ((EntityLivingBase)entity).isPotionActive(Potion.fireResistance))) + { + entity.setFire(3); + } + } + } + } + } } diff --git a/BM_src/WayofTime/alchemicalWizardry/common/PotionFlameCloak.java b/BM_src/WayofTime/alchemicalWizardry/common/PotionFlameCloak.java new file mode 100644 index 00000000..e25a7c06 --- /dev/null +++ b/BM_src/WayofTime/alchemicalWizardry/common/PotionFlameCloak.java @@ -0,0 +1,18 @@ +package WayofTime.alchemicalWizardry.common; + +import net.minecraft.potion.Potion; + +public class PotionFlameCloak extends Potion +{ + public PotionFlameCloak(int par1, boolean par2, int par3) + { + super(par1, par2, par3); + } + + @Override + public Potion setIconIndex(int par1, int par2) + { + super.setIconIndex(par1, par2); + return this; + } +} diff --git a/BM_src/WayofTime/alchemicalWizardry/common/spell/complex/effect/impactEffects/fire/SelfDefaultFire.java b/BM_src/WayofTime/alchemicalWizardry/common/spell/complex/effect/impactEffects/fire/SelfDefaultFire.java index 9ea92fcf..209118a1 100644 --- a/BM_src/WayofTime/alchemicalWizardry/common/spell/complex/effect/impactEffects/fire/SelfDefaultFire.java +++ b/BM_src/WayofTime/alchemicalWizardry/common/spell/complex/effect/impactEffects/fire/SelfDefaultFire.java @@ -17,6 +17,6 @@ public class SelfDefaultFire extends SelfSpellEffect @Override public void onSelfUse(World world, EntityPlayer player) { - player.addPotionEffect(new PotionEffect(Potion.fireResistance.id,1000,0)); + player.setFire((int)(10*Math.pow(1.5, powerUpgrades+1.5*potencyUpgrades))); } } diff --git a/BM_src/WayofTime/alchemicalWizardry/common/spell/complex/effect/impactEffects/fire/SelfDefensiveFire.java b/BM_src/WayofTime/alchemicalWizardry/common/spell/complex/effect/impactEffects/fire/SelfDefensiveFire.java index 6dbc2f80..16e57c2f 100644 --- a/BM_src/WayofTime/alchemicalWizardry/common/spell/complex/effect/impactEffects/fire/SelfDefensiveFire.java +++ b/BM_src/WayofTime/alchemicalWizardry/common/spell/complex/effect/impactEffects/fire/SelfDefensiveFire.java @@ -16,6 +16,9 @@ public class SelfDefensiveFire extends SelfSpellEffect { { // TODO Auto-generated method stub + world.playAuxSFXAtEntity(player, 1008, (int)player.posX, (int)player.posY, (int)player.posZ, 0); + + } } diff --git a/BM_src/WayofTime/alchemicalWizardry/common/spell/complex/effect/impactEffects/fire/SelfOffensiveFire.java b/BM_src/WayofTime/alchemicalWizardry/common/spell/complex/effect/impactEffects/fire/SelfOffensiveFire.java index 037f1ae0..8e51a25d 100644 --- a/BM_src/WayofTime/alchemicalWizardry/common/spell/complex/effect/impactEffects/fire/SelfOffensiveFire.java +++ b/BM_src/WayofTime/alchemicalWizardry/common/spell/complex/effect/impactEffects/fire/SelfOffensiveFire.java @@ -1,7 +1,9 @@ package WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.fire; import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.potion.PotionEffect; import net.minecraft.world.World; +import WayofTime.alchemicalWizardry.AlchemicalWizardry; import WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.SelfSpellEffect; public class SelfOffensiveFire extends SelfSpellEffect @@ -14,7 +16,6 @@ public class SelfOffensiveFire extends SelfSpellEffect @Override public void onSelfUse(World world, EntityPlayer player) { - + player.addPotionEffect(new PotionEffect(AlchemicalWizardry.customPotionFlameCloak.id,(this.powerUpgrades+1)*this.powerUpgrades,this.potencyUpgrades)); } - }