From 112b4e6b5309741d789bac81558780f0b5dd1bb7 Mon Sep 17 00:00:00 2001 From: WayofTime Date: Sat, 25 Jan 2014 09:22:59 -0500 Subject: [PATCH] Spell Work Need to work on how the EntitySpellProjectile saves its data. Does not work properly. Perhaps it was not registered? --- .../BloodMagicConfiguration.java | 3 +- .../client/ClientProxy.java | 2 + .../common/CommonProxy.java | 19 ++++- .../common/block/BlockConduit.java | 42 +---------- .../common/block/BlockOrientable.java | 64 +++++++++++----- .../spell/complex/EntitySpellProjectile.java | 73 ++++++++++++------- .../common/spell/complex/SpellParadigm.java | 2 +- .../complex/SpellParadigmProjectile.java | 13 ++++ .../spell/complex/SpellParadigmSelf.java | 46 ++++++++++++ .../spell/complex/effect/SpellEffect.java | 46 ++++++++++++ .../spell/complex/effect/SpellEffectFire.java | 4 +- .../IProjectileImpactEffect.java | 3 +- .../impactEffects/ProjectileDefaultFire.java | 33 +++++++++ .../impactEffects/ProjectileImpactEffect.java | 15 ++++ .../tileEntity/TESpellParadigmBlock.java | 41 ++++++++++- 15 files changed, 314 insertions(+), 92 deletions(-) create mode 100644 BM_src/WayofTime/alchemicalWizardry/common/spell/complex/effect/impactEffects/ProjectileDefaultFire.java create mode 100644 BM_src/WayofTime/alchemicalWizardry/common/spell/complex/effect/impactEffects/ProjectileImpactEffect.java diff --git a/BM_src/WayofTime/alchemicalWizardry/BloodMagicConfiguration.java b/BM_src/WayofTime/alchemicalWizardry/BloodMagicConfiguration.java index 2be09e7e..7f864162 100644 --- a/BM_src/WayofTime/alchemicalWizardry/BloodMagicConfiguration.java +++ b/BM_src/WayofTime/alchemicalWizardry/BloodMagicConfiguration.java @@ -174,8 +174,7 @@ public class BloodMagicConfiguration AlchemicalWizardry.focusGravityWellItemID = config.getItem("FocusGravityWell", 17077).getInt(); AlchemicalWizardry.sigilOfMagnetismItemID = config.getItem("SigilOfMagnetism", 17080).getInt(); AlchemicalWizardry.itemComplexSpellCrystalItemID = config.getItem("ComplexSpellCrystal",17081).getInt(); - - + } catch (Exception e) { diff --git a/BM_src/WayofTime/alchemicalWizardry/client/ClientProxy.java b/BM_src/WayofTime/alchemicalWizardry/client/ClientProxy.java index c5ccd93b..9fadd55d 100644 --- a/BM_src/WayofTime/alchemicalWizardry/client/ClientProxy.java +++ b/BM_src/WayofTime/alchemicalWizardry/client/ClientProxy.java @@ -14,6 +14,7 @@ import WayofTime.alchemicalWizardry.common.renderer.model.*; import WayofTime.alchemicalWizardry.common.renderer.projectile.RenderEnergyBazookaMainProjectile; import WayofTime.alchemicalWizardry.common.renderer.projectile.RenderEnergyBlastProjectile; import WayofTime.alchemicalWizardry.common.renderer.projectile.RenderMeteor; +import WayofTime.alchemicalWizardry.common.spell.complex.EntitySpellProjectile; import WayofTime.alchemicalWizardry.common.tileEntity.*; import cpw.mods.fml.client.FMLClientHandler; import cpw.mods.fml.client.registry.ClientRegistry; @@ -32,6 +33,7 @@ public class ClientProxy extends CommonProxy //altarRenderType = RenderingRegistry.getNextAvailableRenderId(); RenderingRegistry.registerEntityRenderingHandler(EnergyBlastProjectile.class, new RenderEnergyBlastProjectile()); RenderingRegistry.registerEntityRenderingHandler(EntityEnergyBazookaMainProjectile.class, new RenderEnergyBazookaMainProjectile()); + RenderingRegistry.registerEntityRenderingHandler(EntitySpellProjectile.class, new RenderEnergyBlastProjectile()); RenderingRegistry.registerEntityRenderingHandler(EntityMeteor.class, new RenderMeteor()); //EntityRegistry.registerGlobalEntityID(EntityFallenAngel.class, "AlchemicalWizardry.FallenAngel", EntityRegistry.findGlobalUniqueEntityId(),0x40FF00, 0x0B610B); RenderingRegistry.registerEntityRenderingHandler(EntityFallenAngel.class, new RenderFallenAngel(new ModelFallenAngel(), 0.5F)); diff --git a/BM_src/WayofTime/alchemicalWizardry/common/CommonProxy.java b/BM_src/WayofTime/alchemicalWizardry/common/CommonProxy.java index 262506d6..43c7b129 100644 --- a/BM_src/WayofTime/alchemicalWizardry/common/CommonProxy.java +++ b/BM_src/WayofTime/alchemicalWizardry/common/CommonProxy.java @@ -1,12 +1,26 @@ package WayofTime.alchemicalWizardry.common; +import net.minecraft.world.World; import WayofTime.alchemicalWizardry.AlchemicalWizardry; -import WayofTime.alchemicalWizardry.common.entity.projectile.*; +import WayofTime.alchemicalWizardry.common.entity.projectile.EnergyBlastProjectile; +import WayofTime.alchemicalWizardry.common.entity.projectile.EntityBloodLightProjectile; +import WayofTime.alchemicalWizardry.common.entity.projectile.EntityEnergyBazookaMainProjectile; +import WayofTime.alchemicalWizardry.common.entity.projectile.EntityEnergyBazookaSecondaryProjectile; +import WayofTime.alchemicalWizardry.common.entity.projectile.EntityMeteor; +import WayofTime.alchemicalWizardry.common.entity.projectile.ExplosionProjectile; +import WayofTime.alchemicalWizardry.common.entity.projectile.FireProjectile; +import WayofTime.alchemicalWizardry.common.entity.projectile.HolyProjectile; +import WayofTime.alchemicalWizardry.common.entity.projectile.IceProjectile; +import WayofTime.alchemicalWizardry.common.entity.projectile.LightningBoltProjectile; +import WayofTime.alchemicalWizardry.common.entity.projectile.MudProjectile; +import WayofTime.alchemicalWizardry.common.entity.projectile.TeleportProjectile; +import WayofTime.alchemicalWizardry.common.entity.projectile.WaterProjectile; +import WayofTime.alchemicalWizardry.common.entity.projectile.WindGustProjectile; +import WayofTime.alchemicalWizardry.common.spell.complex.EntitySpellProjectile; import WayofTime.alchemicalWizardry.common.tileEntity.TEAltar; import WayofTime.alchemicalWizardry.common.tileEntity.TEMasterStone; import cpw.mods.fml.common.registry.EntityRegistry; import cpw.mods.fml.common.registry.GameRegistry; -import net.minecraft.world.World; public class CommonProxy { @@ -63,6 +77,7 @@ public class CommonProxy EntityRegistry.registerModEntity(EntityEnergyBazookaSecondaryProjectile.class, "energyBazookaSecondary", 11, AlchemicalWizardry.instance, 128, 3, true); EntityRegistry.registerModEntity(EntityBloodLightProjectile.class, "bloodLightProjectile", 12, AlchemicalWizardry.instance, 128, 3, true); EntityRegistry.registerModEntity(EntityMeteor.class, "Meteor", 13, AlchemicalWizardry.instance, 128, 3, true); + EntityRegistry.registerModEntity(EntitySpellProjectile.class, "spellProjectile", 14, AlchemicalWizardry.instance, 128, 3, true); } public void registerTickHandlers() diff --git a/BM_src/WayofTime/alchemicalWizardry/common/block/BlockConduit.java b/BM_src/WayofTime/alchemicalWizardry/common/block/BlockConduit.java index 18fe8099..1072bc8d 100644 --- a/BM_src/WayofTime/alchemicalWizardry/common/block/BlockConduit.java +++ b/BM_src/WayofTime/alchemicalWizardry/common/block/BlockConduit.java @@ -14,7 +14,7 @@ import WayofTime.alchemicalWizardry.common.tileEntity.TEOrientable; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; -public class BlockConduit extends BlockContainer +public class BlockConduit extends BlockOrientable { @SideOnly(Side.CLIENT) private static Icon topIcon; @@ -27,7 +27,7 @@ public class BlockConduit extends BlockContainer public BlockConduit(int id) { - super(id, Material.rock); + super(id); setHardness(2.0F); setResistance(5.0F); setCreativeTab(AlchemicalWizardry.tabBloodMagic); @@ -66,44 +66,6 @@ public class BlockConduit extends BlockContainer } } - @Override - public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float what, float these, float are) - { - if (world.isRemote) - { - return false; - } - - ForgeDirection sideClicked = ForgeDirection.getOrientation(side); - TileEntity tile = world.getBlockTileEntity(x, y, z); - - if (tile instanceof TEOrientable) - { - //TODO NEEDS WORK - if (((TEOrientable) tile).getInputDirection().equals(sideClicked)) - { - ((TEOrientable) tile).setInputDirection(((TEConduit) tile).getOutputDirection()); - ((TEOrientable) tile).setOutputDirection(sideClicked); - } else if (((TEOrientable) tile).getOutputDirection().equals(sideClicked)) - { - ((TEOrientable) tile).setOutputDirection(((TEConduit) tile).getInputDirection()); - ((TEOrientable) tile).setInputDirection(sideClicked); - } else - { - if (!player.isSneaking()) - { - ((TEOrientable) tile).setOutputDirection(sideClicked); - } else - { - ((TEOrientable) tile).setOutputDirection(sideClicked.getOpposite()); - } - } - } - - world.markBlockForUpdate(x, y, z); - return true; - } - @Override public void breakBlock(World world, int x, int y, int z, int par5, int par6) { diff --git a/BM_src/WayofTime/alchemicalWizardry/common/block/BlockOrientable.java b/BM_src/WayofTime/alchemicalWizardry/common/block/BlockOrientable.java index 169f81be..42c455d2 100644 --- a/BM_src/WayofTime/alchemicalWizardry/common/block/BlockOrientable.java +++ b/BM_src/WayofTime/alchemicalWizardry/common/block/BlockOrientable.java @@ -105,6 +105,7 @@ public class BlockOrientable extends BlockContainer @Override public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float what, float these, float are) { + //Right-click orients the output face. Shift-right-click orients the input face. if (world.isRemote) { return false; @@ -115,25 +116,44 @@ public class BlockOrientable extends BlockContainer if (tile instanceof TEOrientable) { - //TODO NEEDS WORK - if (((TEOrientable) tile).getInputDirection().equals(sideClicked)) - { - ((TEOrientable) tile).setInputDirection(((TEOrientable) tile).getOutputDirection()); - ((TEOrientable) tile).setOutputDirection(sideClicked); - } else if (((TEOrientable) tile).getOutputDirection().equals(sideClicked)) - { - ((TEOrientable) tile).setOutputDirection(((TEOrientable) tile).getInputDirection()); - ((TEOrientable) tile).setInputDirection(sideClicked); - } else - { - if (!player.isSneaking()) - { - ((TEOrientable) tile).setOutputDirection(sideClicked); - } else - { - ((TEOrientable) tile).setOutputDirection(sideClicked.getOpposite()); - } - } + TEOrientable newTile = (TEOrientable)tile; + if(player.isSneaking()) + { + int nextSide = TEOrientable.getIntForForgeDirection(newTile.getInputDirection())+1; + + if(nextSide>5) + { + nextSide = 0; + } + if(ForgeDirection.getOrientation(nextSide)==newTile.getOutputDirection()) + { + nextSide++; + if(nextSide>5) + { + nextSide = 0; + } + } + + newTile.setInputDirection(ForgeDirection.getOrientation(nextSide)); + }else + { + int nextSide = TEOrientable.getIntForForgeDirection(newTile.getOutputDirection())+1; + + if(nextSide>5) + { + nextSide = 0; + } + if(ForgeDirection.getOrientation(nextSide)==newTile.getInputDirection()) + { + nextSide++; + if(nextSide>5) + { + nextSide = 0; + } + } + + newTile.setOutputDirection(ForgeDirection.getOrientation(nextSide)); + } } world.markBlockForUpdate(x, y, z); @@ -221,4 +241,10 @@ public class BlockOrientable extends BlockContainer return 0; } + + @Override + public int damageDropped(int metadata) + { + return metadata; + } } diff --git a/BM_src/WayofTime/alchemicalWizardry/common/spell/complex/EntitySpellProjectile.java b/BM_src/WayofTime/alchemicalWizardry/common/spell/complex/EntitySpellProjectile.java index 743dfb5d..46f57975 100644 --- a/BM_src/WayofTime/alchemicalWizardry/common/spell/complex/EntitySpellProjectile.java +++ b/BM_src/WayofTime/alchemicalWizardry/common/spell/complex/EntitySpellProjectile.java @@ -5,18 +5,10 @@ import java.util.Iterator; import java.util.LinkedList; import java.util.List; -import WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.IProjectileImpactEffect; -import WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.IProjectileUpdateEffect; import net.minecraft.block.Block; import net.minecraft.entity.Entity; import net.minecraft.entity.IProjectile; -import net.minecraft.entity.boss.EntityWither; -import net.minecraft.entity.monster.EntityGhast; -import net.minecraft.entity.monster.EntityPigZombie; -import net.minecraft.entity.monster.EntitySkeleton; -import net.minecraft.entity.monster.EntityZombie; import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagList; import net.minecraft.util.AxisAlignedBB; @@ -26,6 +18,9 @@ import net.minecraft.util.MathHelper; import net.minecraft.util.MovingObjectPosition; import net.minecraft.util.Vec3; import net.minecraft.world.World; +import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellEffect; +import WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.IProjectileImpactEffect; +import WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.IProjectileUpdateEffect; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; @@ -50,6 +45,7 @@ public class EntitySpellProjectile extends Entity implements IProjectile private boolean penetration = false; public List updateEffectList = new ArrayList(); public List effectList = new LinkedList(); + public List spellEffectList = new LinkedList(); public EntitySpellProjectile(World par1World) { @@ -81,6 +77,7 @@ public class EntitySpellProjectile extends Entity implements IProjectile motionZ = MathHelper.cos(rotationYaw / 180.0F * (float)Math.PI) * MathHelper.cos(rotationPitch / 180.0F * (float)Math.PI); motionY = -MathHelper.sin(rotationPitch / 180.0F * (float)Math.PI); this.setThrowableHeading(motionX, motionY, motionZ, par3 * 1.5F, 1.0F); + } @Override @@ -272,19 +269,23 @@ public class EntitySpellProjectile extends Entity implements IProjectile NBTTagList effectList = new NBTTagList(); - for (String str : this.effectList) - { - if (str != null) - { - NBTTagCompound tag = new NBTTagCompound(); + for(SpellEffect eff : spellEffectList) + { + effectList.appendTag(eff.getTag()); + } + +// for (String str : this.effectList) +// { +// if (str != null) +// { +// NBTTagCompound tag = new NBTTagCompound(); +// +// tag.setString("Class", str); +// effectList.appendTag(tag); +// } +// } - tag.setString("Class", str); - effectList.appendTag(tag); - } - } - - par1NBTTagCompound.setTag("Effects", effectList); - + par1NBTTagCompound.setTag("Effects", effectList); } /** @@ -301,15 +302,32 @@ public class EntitySpellProjectile extends Entity implements IProjectile inGround = par1NBTTagCompound.getByte("inGround") == 1; NBTTagList tagList = par1NBTTagCompound.getTagList("Effects"); - this.effectList = new LinkedList(); - for (int i = 0; i < tagList.tagCount(); i++) + + List spellEffectList = new LinkedList(); + for (int i = 0; i < tagList.tagCount(); i++) { NBTTagCompound tag = (NBTTagCompound) tagList.tagAt(i); - this.effectList.add(tag.getString("Class")); + SpellEffect eff = SpellEffect.getEffectFromTag(tag); + if(eff!=null) + { + spellEffectList.add(eff); + } } + this.spellEffectList = spellEffectList; + + +// this.effectList = new LinkedList(); +// for (int i = 0; i < tagList.tagCount(); i++) +// { +// NBTTagCompound tag = (NBTTagCompound) tagList.tagAt(i); +// +// this.effectList.add(tag.getString("Class")); +// } - SpellParadigmProjectile parad = SpellParadigmProjectile.getParadigmForStringArray(effectList); + //SpellParadigmProjectile parad = SpellParadigmProjectile.getParadigmForStringArray(effectList); + SpellParadigmProjectile parad = SpellParadigmProjectile.getParadigmForEffectArray(spellEffectList); + parad.applyAllSpellEffects(); parad.prepareProjectile(this); } @@ -514,7 +532,7 @@ public class EntitySpellProjectile extends Entity implements IProjectile { for(IProjectileImpactEffect impactEffect : impactList) { - impactEffect.onTileImpact(mop); + impactEffect.onTileImpact(worldObj, mop); } } } @@ -549,4 +567,9 @@ public class EntitySpellProjectile extends Entity implements IProjectile { this.effectList = stringList; } + + public void setSpellEffectList(List list) + { + this.spellEffectList = list; + } } diff --git a/BM_src/WayofTime/alchemicalWizardry/common/spell/complex/SpellParadigm.java b/BM_src/WayofTime/alchemicalWizardry/common/spell/complex/SpellParadigm.java index 893d3ae7..025d188c 100644 --- a/BM_src/WayofTime/alchemicalWizardry/common/spell/complex/SpellParadigm.java +++ b/BM_src/WayofTime/alchemicalWizardry/common/spell/complex/SpellParadigm.java @@ -13,7 +13,7 @@ import WayofTime.alchemicalWizardry.common.spell.complex.enhancement.SpellEnhanc public abstract class SpellParadigm { protected List bufferedEffectList = new ArrayList(); - protected List effectList = new LinkedList(); + public List effectList = new LinkedList(); public void addBufferedEffect(SpellEffect effect) { diff --git a/BM_src/WayofTime/alchemicalWizardry/common/spell/complex/SpellParadigmProjectile.java b/BM_src/WayofTime/alchemicalWizardry/common/spell/complex/SpellParadigmProjectile.java index c0be55c6..d3f83d85 100644 --- a/BM_src/WayofTime/alchemicalWizardry/common/spell/complex/SpellParadigmProjectile.java +++ b/BM_src/WayofTime/alchemicalWizardry/common/spell/complex/SpellParadigmProjectile.java @@ -86,6 +86,18 @@ public class SpellParadigmProjectile extends SpellParadigm return parad; } + public static SpellParadigmProjectile getParadigmForEffectArray(List effectList) + { + SpellParadigmProjectile parad = new SpellParadigmProjectile(); + + for(SpellEffect eff : effectList) + { + parad.addBufferedEffect(eff); + } + + return parad; + } + public void prepareProjectile(EntitySpellProjectile proj) { proj.setDamage(damage); @@ -94,6 +106,7 @@ public class SpellParadigmProjectile extends SpellParadigm proj.setPenetration(penetration); proj.setEffectList(effectList); proj.setRicochetMax(ricochetMax); + proj.setSpellEffectList(bufferedEffectList); } public void addImpactEffect(IProjectileImpactEffect eff) diff --git a/BM_src/WayofTime/alchemicalWizardry/common/spell/complex/SpellParadigmSelf.java b/BM_src/WayofTime/alchemicalWizardry/common/spell/complex/SpellParadigmSelf.java index c246a94b..4726ddb3 100644 --- a/BM_src/WayofTime/alchemicalWizardry/common/spell/complex/SpellParadigmSelf.java +++ b/BM_src/WayofTime/alchemicalWizardry/common/spell/complex/SpellParadigmSelf.java @@ -4,6 +4,7 @@ import java.util.ArrayList; import java.util.List; import WayofTime.alchemicalWizardry.common.items.EnergyItems; +import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellEffect; import WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.ISelfSpellEffect; import WayofTime.alchemicalWizardry.common.spell.complex.enhancement.SpellEnhancement; import net.minecraft.entity.player.EntityPlayer; @@ -53,4 +54,49 @@ public class SpellParadigmSelf extends SpellParadigm { return 100; } + + public static SpellParadigmSelf getParadigmForStringArray(List stringList) + { + SpellParadigmSelf parad = new SpellParadigmSelf(); + + try + { + for(String str : stringList) + { + Class clazz = Class.forName(str); + if(clazz!=null) + { + Object obj = clazz.newInstance(); + + if(obj instanceof SpellEffect) + { + parad.addBufferedEffect((SpellEffect)obj); + continue; + } + if(obj instanceof SpellModifier) + { + parad.modifyBufferedEffect((SpellModifier)obj); + continue; + } + if(obj instanceof SpellEnhancement) + { + parad.applyEnhancement((SpellEnhancement)obj); + continue; + } + } + } + + } catch (InstantiationException e) { + + e.printStackTrace(); + } catch (IllegalAccessException e) { + + e.printStackTrace(); + } catch (ClassNotFoundException e) { + + e.printStackTrace(); + } + + return parad; + } } diff --git a/BM_src/WayofTime/alchemicalWizardry/common/spell/complex/effect/SpellEffect.java b/BM_src/WayofTime/alchemicalWizardry/common/spell/complex/effect/SpellEffect.java index 9ae235a4..3ecd7438 100644 --- a/BM_src/WayofTime/alchemicalWizardry/common/spell/complex/effect/SpellEffect.java +++ b/BM_src/WayofTime/alchemicalWizardry/common/spell/complex/effect/SpellEffect.java @@ -1,5 +1,6 @@ package WayofTime.alchemicalWizardry.common.spell.complex.effect; +import net.minecraft.nbt.NBTTagCompound; import WayofTime.alchemicalWizardry.common.spell.complex.SpellModifier; import WayofTime.alchemicalWizardry.common.spell.complex.SpellParadigm; import WayofTime.alchemicalWizardry.common.spell.complex.SpellParadigmMelee; @@ -169,4 +170,49 @@ public abstract class SpellEffect { return this.potencyEnhancement; } + + public NBTTagCompound getTag() + { + NBTTagCompound tag = new NBTTagCompound(); + + tag.setString("Class", this.getClass().getName()); + tag.setInteger("power", powerEnhancement); + tag.setInteger("cost", costEnhancement); + tag.setInteger("potency", potencyEnhancement); + + return tag; + } + + public static SpellEffect getEffectFromTag(NBTTagCompound tag) + { + try { + Class clazz = Class.forName(tag.getString("Class")); + if(clazz !=null) + { + try { + Object obj = clazz.newInstance(); + if(obj instanceof SpellEffect) + { + SpellEffect eff = (SpellEffect) obj; + + eff.powerEnhancement = tag.getInteger("power"); + eff.costEnhancement = tag.getInteger("cost"); + eff.potencyEnhancement = tag.getInteger("potency"); + + return eff; + } + } catch (InstantiationException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } catch (IllegalAccessException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + } catch (ClassNotFoundException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + return null; + } } diff --git a/BM_src/WayofTime/alchemicalWizardry/common/spell/complex/effect/SpellEffectFire.java b/BM_src/WayofTime/alchemicalWizardry/common/spell/complex/effect/SpellEffectFire.java index 4683aeb0..f4435fab 100644 --- a/BM_src/WayofTime/alchemicalWizardry/common/spell/complex/effect/SpellEffectFire.java +++ b/BM_src/WayofTime/alchemicalWizardry/common/spell/complex/effect/SpellEffectFire.java @@ -3,6 +3,7 @@ package WayofTime.alchemicalWizardry.common.spell.complex.effect; import WayofTime.alchemicalWizardry.common.spell.complex.SpellParadigmMelee; import WayofTime.alchemicalWizardry.common.spell.complex.SpellParadigmProjectile; import WayofTime.alchemicalWizardry.common.spell.complex.SpellParadigmSelf; +import WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.ProjectileDefaultFire; import WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.fire.SelfDefaultFire; import WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.fire.SelfDefensiveFire; import WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.fire.SelfEnvironmentalFire; @@ -13,7 +14,8 @@ public class SpellEffectFire extends SpellEffect @Override public void defaultModificationProjectile(SpellParadigmProjectile parad) { - + parad.addImpactEffect(new ProjectileDefaultFire(this.powerEnhancement,this.potencyEnhancement,this.costEnhancement)); + parad.damage+=this.potencyEnhancement; } @Override diff --git a/BM_src/WayofTime/alchemicalWizardry/common/spell/complex/effect/impactEffects/IProjectileImpactEffect.java b/BM_src/WayofTime/alchemicalWizardry/common/spell/complex/effect/impactEffects/IProjectileImpactEffect.java index d2b347ad..2f2cbf92 100644 --- a/BM_src/WayofTime/alchemicalWizardry/common/spell/complex/effect/impactEffects/IProjectileImpactEffect.java +++ b/BM_src/WayofTime/alchemicalWizardry/common/spell/complex/effect/impactEffects/IProjectileImpactEffect.java @@ -2,9 +2,10 @@ package WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects; import net.minecraft.entity.Entity; import net.minecraft.util.MovingObjectPosition; +import net.minecraft.world.World; public interface IProjectileImpactEffect { public void onEntityImpact(Entity mop); - public void onTileImpact(MovingObjectPosition mop); + public void onTileImpact(World world, MovingObjectPosition mop); } diff --git a/BM_src/WayofTime/alchemicalWizardry/common/spell/complex/effect/impactEffects/ProjectileDefaultFire.java b/BM_src/WayofTime/alchemicalWizardry/common/spell/complex/effect/impactEffects/ProjectileDefaultFire.java new file mode 100644 index 00000000..feedf4d6 --- /dev/null +++ b/BM_src/WayofTime/alchemicalWizardry/common/spell/complex/effect/impactEffects/ProjectileDefaultFire.java @@ -0,0 +1,33 @@ +package WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects; + +import net.minecraft.block.Block; +import net.minecraft.entity.Entity; +import net.minecraft.util.MovingObjectPosition; +import net.minecraft.world.World; + +public class ProjectileDefaultFire extends ProjectileImpactEffect +{ + public ProjectileDefaultFire(int power, int potency, int cost) + { + super(power, potency, cost); + } + + @Override + public void onEntityImpact(Entity mop) + { + mop.setFire((int)Math.pow(2,this.powerUpgrades)); + } + + @Override + public void onTileImpact(World world, MovingObjectPosition mop) + { + int x = mop.blockX; + int y = mop.blockY; + int z = mop.blockZ; + + if(world.isAirBlock(x, y+1, z)) + { + world.setBlock(x, y+1, z, Block.fire.blockID); + } + } +} diff --git a/BM_src/WayofTime/alchemicalWizardry/common/spell/complex/effect/impactEffects/ProjectileImpactEffect.java b/BM_src/WayofTime/alchemicalWizardry/common/spell/complex/effect/impactEffects/ProjectileImpactEffect.java new file mode 100644 index 00000000..7ffbe1d8 --- /dev/null +++ b/BM_src/WayofTime/alchemicalWizardry/common/spell/complex/effect/impactEffects/ProjectileImpactEffect.java @@ -0,0 +1,15 @@ +package WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects; + +public abstract class ProjectileImpactEffect implements IProjectileImpactEffect +{ + protected int powerUpgrades; + protected int potencyUpgrades; + protected int costUpgrades; + + public ProjectileImpactEffect(int power, int potency, int cost) + { + this.powerUpgrades = power; + this.potencyUpgrades = potency; + this.costUpgrades = cost; + } +} diff --git a/BM_src/WayofTime/alchemicalWizardry/common/tileEntity/TESpellParadigmBlock.java b/BM_src/WayofTime/alchemicalWizardry/common/tileEntity/TESpellParadigmBlock.java index 1486bf76..9599d01a 100644 --- a/BM_src/WayofTime/alchemicalWizardry/common/tileEntity/TESpellParadigmBlock.java +++ b/BM_src/WayofTime/alchemicalWizardry/common/tileEntity/TESpellParadigmBlock.java @@ -1,15 +1,27 @@ package WayofTime.alchemicalWizardry.common.tileEntity; +import java.util.List; + import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; +import net.minecraft.util.ChatMessageComponent; import net.minecraft.world.World; import WayofTime.alchemicalWizardry.common.spell.complex.SpellParadigm; +import WayofTime.alchemicalWizardry.common.spell.complex.SpellParadigmMelee; +import WayofTime.alchemicalWizardry.common.spell.complex.SpellParadigmProjectile; import WayofTime.alchemicalWizardry.common.spell.complex.SpellParadigmSelf; public class TESpellParadigmBlock extends TESpellBlock { public SpellParadigm getSpellParadigm() { + int meta = worldObj.getBlockMetadata(xCoord, yCoord, zCoord); + switch(meta) + { + case 0: return new SpellParadigmProjectile(); + case 1: return new SpellParadigmSelf(); + case 2: return new SpellParadigmMelee(); + } return new SpellParadigmSelf(); } @@ -28,6 +40,33 @@ public class TESpellParadigmBlock extends TESpellBlock { SpellParadigm parad = this.getSpellParadigm(); this.modifySpellParadigm(parad); - parad.castSpell(world, entity, spellCasterStack); +// if(parad instanceof SpellParadigmSelf) +// { +// List stringList = parad.effectList; +// SpellParadigmSelf spellParadSelf = SpellParadigmSelf.getParadigmForStringArray(stringList); +// for(String str : stringList) +// { +// ChatMessageComponent chat = new ChatMessageComponent(); +// chat.addText(str); +// entity.sendChatToPlayer(chat); +// } +// spellParadSelf.castSpell(world, entity, spellCasterStack); +// } +// else if(parad instanceof SpellParadigmProjectile) +// { +// List stringList = parad.effectList; +// SpellParadigmProjectile spellParadSelf = SpellParadigmProjectile.getParadigmForStringArray(stringList); +// for(String str : stringList) +// { +// ChatMessageComponent chat = new ChatMessageComponent(); +// chat.addText(str); +// entity.sendChatToPlayer(chat); +// } +// spellParadSelf.castSpell(world, entity, spellCasterStack); +// }else + { + parad.castSpell(world, entity, spellCasterStack); + } + } }