Spell Work

Need to work on how the EntitySpellProjectile saves its data. Does not
work properly. Perhaps it was not registered?
This commit is contained in:
WayofTime 2014-01-25 09:22:59 -05:00
parent 5dcef131dc
commit 112b4e6b53
15 changed files with 314 additions and 92 deletions

View file

@ -175,7 +175,6 @@ public class BloodMagicConfiguration
AlchemicalWizardry.sigilOfMagnetismItemID = config.getItem("SigilOfMagnetism", 17080).getInt(); AlchemicalWizardry.sigilOfMagnetismItemID = config.getItem("SigilOfMagnetism", 17080).getInt();
AlchemicalWizardry.itemComplexSpellCrystalItemID = config.getItem("ComplexSpellCrystal",17081).getInt(); AlchemicalWizardry.itemComplexSpellCrystalItemID = config.getItem("ComplexSpellCrystal",17081).getInt();
} catch (Exception e) } catch (Exception e)
{ {

View file

@ -14,6 +14,7 @@ import WayofTime.alchemicalWizardry.common.renderer.model.*;
import WayofTime.alchemicalWizardry.common.renderer.projectile.RenderEnergyBazookaMainProjectile; import WayofTime.alchemicalWizardry.common.renderer.projectile.RenderEnergyBazookaMainProjectile;
import WayofTime.alchemicalWizardry.common.renderer.projectile.RenderEnergyBlastProjectile; import WayofTime.alchemicalWizardry.common.renderer.projectile.RenderEnergyBlastProjectile;
import WayofTime.alchemicalWizardry.common.renderer.projectile.RenderMeteor; import WayofTime.alchemicalWizardry.common.renderer.projectile.RenderMeteor;
import WayofTime.alchemicalWizardry.common.spell.complex.EntitySpellProjectile;
import WayofTime.alchemicalWizardry.common.tileEntity.*; import WayofTime.alchemicalWizardry.common.tileEntity.*;
import cpw.mods.fml.client.FMLClientHandler; import cpw.mods.fml.client.FMLClientHandler;
import cpw.mods.fml.client.registry.ClientRegistry; import cpw.mods.fml.client.registry.ClientRegistry;
@ -32,6 +33,7 @@ public class ClientProxy extends CommonProxy
//altarRenderType = RenderingRegistry.getNextAvailableRenderId(); //altarRenderType = RenderingRegistry.getNextAvailableRenderId();
RenderingRegistry.registerEntityRenderingHandler(EnergyBlastProjectile.class, new RenderEnergyBlastProjectile()); RenderingRegistry.registerEntityRenderingHandler(EnergyBlastProjectile.class, new RenderEnergyBlastProjectile());
RenderingRegistry.registerEntityRenderingHandler(EntityEnergyBazookaMainProjectile.class, new RenderEnergyBazookaMainProjectile()); RenderingRegistry.registerEntityRenderingHandler(EntityEnergyBazookaMainProjectile.class, new RenderEnergyBazookaMainProjectile());
RenderingRegistry.registerEntityRenderingHandler(EntitySpellProjectile.class, new RenderEnergyBlastProjectile());
RenderingRegistry.registerEntityRenderingHandler(EntityMeteor.class, new RenderMeteor()); RenderingRegistry.registerEntityRenderingHandler(EntityMeteor.class, new RenderMeteor());
//EntityRegistry.registerGlobalEntityID(EntityFallenAngel.class, "AlchemicalWizardry.FallenAngel", EntityRegistry.findGlobalUniqueEntityId(),0x40FF00, 0x0B610B); //EntityRegistry.registerGlobalEntityID(EntityFallenAngel.class, "AlchemicalWizardry.FallenAngel", EntityRegistry.findGlobalUniqueEntityId(),0x40FF00, 0x0B610B);
RenderingRegistry.registerEntityRenderingHandler(EntityFallenAngel.class, new RenderFallenAngel(new ModelFallenAngel(), 0.5F)); RenderingRegistry.registerEntityRenderingHandler(EntityFallenAngel.class, new RenderFallenAngel(new ModelFallenAngel(), 0.5F));

View file

@ -1,12 +1,26 @@
package WayofTime.alchemicalWizardry.common; package WayofTime.alchemicalWizardry.common;
import net.minecraft.world.World;
import WayofTime.alchemicalWizardry.AlchemicalWizardry; 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.TEAltar;
import WayofTime.alchemicalWizardry.common.tileEntity.TEMasterStone; import WayofTime.alchemicalWizardry.common.tileEntity.TEMasterStone;
import cpw.mods.fml.common.registry.EntityRegistry; import cpw.mods.fml.common.registry.EntityRegistry;
import cpw.mods.fml.common.registry.GameRegistry; import cpw.mods.fml.common.registry.GameRegistry;
import net.minecraft.world.World;
public class CommonProxy public class CommonProxy
{ {
@ -63,6 +77,7 @@ public class CommonProxy
EntityRegistry.registerModEntity(EntityEnergyBazookaSecondaryProjectile.class, "energyBazookaSecondary", 11, AlchemicalWizardry.instance, 128, 3, true); EntityRegistry.registerModEntity(EntityEnergyBazookaSecondaryProjectile.class, "energyBazookaSecondary", 11, AlchemicalWizardry.instance, 128, 3, true);
EntityRegistry.registerModEntity(EntityBloodLightProjectile.class, "bloodLightProjectile", 12, 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(EntityMeteor.class, "Meteor", 13, AlchemicalWizardry.instance, 128, 3, true);
EntityRegistry.registerModEntity(EntitySpellProjectile.class, "spellProjectile", 14, AlchemicalWizardry.instance, 128, 3, true);
} }
public void registerTickHandlers() public void registerTickHandlers()

View file

@ -14,7 +14,7 @@ import WayofTime.alchemicalWizardry.common.tileEntity.TEOrientable;
import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly; import cpw.mods.fml.relauncher.SideOnly;
public class BlockConduit extends BlockContainer public class BlockConduit extends BlockOrientable
{ {
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
private static Icon topIcon; private static Icon topIcon;
@ -27,7 +27,7 @@ public class BlockConduit extends BlockContainer
public BlockConduit(int id) public BlockConduit(int id)
{ {
super(id, Material.rock); super(id);
setHardness(2.0F); setHardness(2.0F);
setResistance(5.0F); setResistance(5.0F);
setCreativeTab(AlchemicalWizardry.tabBloodMagic); 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 @Override
public void breakBlock(World world, int x, int y, int z, int par5, int par6) public void breakBlock(World world, int x, int y, int z, int par5, int par6)
{ {

View file

@ -105,6 +105,7 @@ public class BlockOrientable extends BlockContainer
@Override @Override
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float what, float these, float are) 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) if (world.isRemote)
{ {
return false; return false;
@ -115,25 +116,44 @@ public class BlockOrientable extends BlockContainer
if (tile instanceof TEOrientable) if (tile instanceof TEOrientable)
{ {
//TODO NEEDS WORK TEOrientable newTile = (TEOrientable)tile;
if (((TEOrientable) tile).getInputDirection().equals(sideClicked)) if(player.isSneaking())
{ {
((TEOrientable) tile).setInputDirection(((TEOrientable) tile).getOutputDirection()); int nextSide = TEOrientable.getIntForForgeDirection(newTile.getInputDirection())+1;
((TEOrientable) tile).setOutputDirection(sideClicked);
} else if (((TEOrientable) tile).getOutputDirection().equals(sideClicked)) if(nextSide>5)
{ {
((TEOrientable) tile).setOutputDirection(((TEOrientable) tile).getInputDirection()); nextSide = 0;
((TEOrientable) tile).setInputDirection(sideClicked); }
} else if(ForgeDirection.getOrientation(nextSide)==newTile.getOutputDirection())
{ {
if (!player.isSneaking()) nextSide++;
{ if(nextSide>5)
((TEOrientable) tile).setOutputDirection(sideClicked); {
} else nextSide = 0;
{ }
((TEOrientable) tile).setOutputDirection(sideClicked.getOpposite()); }
}
} 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); world.markBlockForUpdate(x, y, z);
@ -221,4 +241,10 @@ public class BlockOrientable extends BlockContainer
return 0; return 0;
} }
@Override
public int damageDropped(int metadata)
{
return metadata;
}
} }

View file

@ -5,18 +5,10 @@ import java.util.Iterator;
import java.util.LinkedList; import java.util.LinkedList;
import java.util.List; 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.block.Block;
import net.minecraft.entity.Entity; import net.minecraft.entity.Entity;
import net.minecraft.entity.IProjectile; 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.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList; import net.minecraft.nbt.NBTTagList;
import net.minecraft.util.AxisAlignedBB; import net.minecraft.util.AxisAlignedBB;
@ -26,6 +18,9 @@ import net.minecraft.util.MathHelper;
import net.minecraft.util.MovingObjectPosition; import net.minecraft.util.MovingObjectPosition;
import net.minecraft.util.Vec3; import net.minecraft.util.Vec3;
import net.minecraft.world.World; 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.Side;
import cpw.mods.fml.relauncher.SideOnly; import cpw.mods.fml.relauncher.SideOnly;
@ -50,6 +45,7 @@ public class EntitySpellProjectile extends Entity implements IProjectile
private boolean penetration = false; private boolean penetration = false;
public List<IProjectileUpdateEffect> updateEffectList = new ArrayList(); public List<IProjectileUpdateEffect> updateEffectList = new ArrayList();
public List<String> effectList = new LinkedList(); public List<String> effectList = new LinkedList();
public List<SpellEffect> spellEffectList = new LinkedList();
public EntitySpellProjectile(World par1World) 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); 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); motionY = -MathHelper.sin(rotationPitch / 180.0F * (float)Math.PI);
this.setThrowableHeading(motionX, motionY, motionZ, par3 * 1.5F, 1.0F); this.setThrowableHeading(motionX, motionY, motionZ, par3 * 1.5F, 1.0F);
} }
@Override @Override
@ -272,19 +269,23 @@ public class EntitySpellProjectile extends Entity implements IProjectile
NBTTagList effectList = new NBTTagList(); NBTTagList effectList = new NBTTagList();
for (String str : this.effectList) for(SpellEffect eff : spellEffectList)
{ {
if (str != null) effectList.appendTag(eff.getTag());
{ }
NBTTagCompound tag = new NBTTagCompound();
tag.setString("Class", str); // for (String str : this.effectList)
effectList.appendTag(tag); // {
} // if (str != null)
} // {
// NBTTagCompound tag = new NBTTagCompound();
//
// 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; inGround = par1NBTTagCompound.getByte("inGround") == 1;
NBTTagList tagList = par1NBTTagCompound.getTagList("Effects"); NBTTagList tagList = par1NBTTagCompound.getTagList("Effects");
this.effectList = new LinkedList();
for (int i = 0; i < tagList.tagCount(); i++) List<SpellEffect> spellEffectList = new LinkedList();
for (int i = 0; i < tagList.tagCount(); i++)
{ {
NBTTagCompound tag = (NBTTagCompound) tagList.tagAt(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;
SpellParadigmProjectile parad = SpellParadigmProjectile.getParadigmForStringArray(effectList);
// 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.getParadigmForEffectArray(spellEffectList);
parad.applyAllSpellEffects();
parad.prepareProjectile(this); parad.prepareProjectile(this);
} }
@ -514,7 +532,7 @@ public class EntitySpellProjectile extends Entity implements IProjectile
{ {
for(IProjectileImpactEffect impactEffect : impactList) 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; this.effectList = stringList;
} }
public void setSpellEffectList(List<SpellEffect> list)
{
this.spellEffectList = list;
}
} }

View file

@ -13,7 +13,7 @@ import WayofTime.alchemicalWizardry.common.spell.complex.enhancement.SpellEnhanc
public abstract class SpellParadigm public abstract class SpellParadigm
{ {
protected List<SpellEffect> bufferedEffectList = new ArrayList(); protected List<SpellEffect> bufferedEffectList = new ArrayList();
protected List<String> effectList = new LinkedList(); public List<String> effectList = new LinkedList();
public void addBufferedEffect(SpellEffect effect) public void addBufferedEffect(SpellEffect effect)
{ {

View file

@ -86,6 +86,18 @@ public class SpellParadigmProjectile extends SpellParadigm
return parad; return parad;
} }
public static SpellParadigmProjectile getParadigmForEffectArray(List<SpellEffect> effectList)
{
SpellParadigmProjectile parad = new SpellParadigmProjectile();
for(SpellEffect eff : effectList)
{
parad.addBufferedEffect(eff);
}
return parad;
}
public void prepareProjectile(EntitySpellProjectile proj) public void prepareProjectile(EntitySpellProjectile proj)
{ {
proj.setDamage(damage); proj.setDamage(damage);
@ -94,6 +106,7 @@ public class SpellParadigmProjectile extends SpellParadigm
proj.setPenetration(penetration); proj.setPenetration(penetration);
proj.setEffectList(effectList); proj.setEffectList(effectList);
proj.setRicochetMax(ricochetMax); proj.setRicochetMax(ricochetMax);
proj.setSpellEffectList(bufferedEffectList);
} }
public void addImpactEffect(IProjectileImpactEffect eff) public void addImpactEffect(IProjectileImpactEffect eff)

View file

@ -4,6 +4,7 @@ import java.util.ArrayList;
import java.util.List; import java.util.List;
import WayofTime.alchemicalWizardry.common.items.EnergyItems; 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.effect.impactEffects.ISelfSpellEffect;
import WayofTime.alchemicalWizardry.common.spell.complex.enhancement.SpellEnhancement; import WayofTime.alchemicalWizardry.common.spell.complex.enhancement.SpellEnhancement;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
@ -53,4 +54,49 @@ public class SpellParadigmSelf extends SpellParadigm
{ {
return 100; return 100;
} }
public static SpellParadigmSelf getParadigmForStringArray(List<String> 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;
}
} }

View file

@ -1,5 +1,6 @@
package WayofTime.alchemicalWizardry.common.spell.complex.effect; 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.SpellModifier;
import WayofTime.alchemicalWizardry.common.spell.complex.SpellParadigm; import WayofTime.alchemicalWizardry.common.spell.complex.SpellParadigm;
import WayofTime.alchemicalWizardry.common.spell.complex.SpellParadigmMelee; import WayofTime.alchemicalWizardry.common.spell.complex.SpellParadigmMelee;
@ -169,4 +170,49 @@ public abstract class SpellEffect
{ {
return this.potencyEnhancement; 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;
}
} }

View file

@ -3,6 +3,7 @@ package WayofTime.alchemicalWizardry.common.spell.complex.effect;
import WayofTime.alchemicalWizardry.common.spell.complex.SpellParadigmMelee; import WayofTime.alchemicalWizardry.common.spell.complex.SpellParadigmMelee;
import WayofTime.alchemicalWizardry.common.spell.complex.SpellParadigmProjectile; import WayofTime.alchemicalWizardry.common.spell.complex.SpellParadigmProjectile;
import WayofTime.alchemicalWizardry.common.spell.complex.SpellParadigmSelf; 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.SelfDefaultFire;
import WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.fire.SelfDefensiveFire; import WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.fire.SelfDefensiveFire;
import WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.fire.SelfEnvironmentalFire; import WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.fire.SelfEnvironmentalFire;
@ -13,7 +14,8 @@ public class SpellEffectFire extends SpellEffect
@Override @Override
public void defaultModificationProjectile(SpellParadigmProjectile parad) public void defaultModificationProjectile(SpellParadigmProjectile parad)
{ {
parad.addImpactEffect(new ProjectileDefaultFire(this.powerEnhancement,this.potencyEnhancement,this.costEnhancement));
parad.damage+=this.potencyEnhancement;
} }
@Override @Override

View file

@ -2,9 +2,10 @@ package WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects;
import net.minecraft.entity.Entity; import net.minecraft.entity.Entity;
import net.minecraft.util.MovingObjectPosition; import net.minecraft.util.MovingObjectPosition;
import net.minecraft.world.World;
public interface IProjectileImpactEffect public interface IProjectileImpactEffect
{ {
public void onEntityImpact(Entity mop); public void onEntityImpact(Entity mop);
public void onTileImpact(MovingObjectPosition mop); public void onTileImpact(World world, MovingObjectPosition mop);
} }

View file

@ -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);
}
}
}

View file

@ -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;
}
}

View file

@ -1,15 +1,27 @@
package WayofTime.alchemicalWizardry.common.tileEntity; package WayofTime.alchemicalWizardry.common.tileEntity;
import java.util.List;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.util.ChatMessageComponent;
import net.minecraft.world.World; import net.minecraft.world.World;
import WayofTime.alchemicalWizardry.common.spell.complex.SpellParadigm; 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; import WayofTime.alchemicalWizardry.common.spell.complex.SpellParadigmSelf;
public class TESpellParadigmBlock extends TESpellBlock public class TESpellParadigmBlock extends TESpellBlock
{ {
public SpellParadigm getSpellParadigm() 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(); return new SpellParadigmSelf();
} }
@ -28,6 +40,33 @@ public class TESpellParadigmBlock extends TESpellBlock
{ {
SpellParadigm parad = this.getSpellParadigm(); SpellParadigm parad = this.getSpellParadigm();
this.modifySpellParadigm(parad); this.modifySpellParadigm(parad);
parad.castSpell(world, entity, spellCasterStack); // if(parad instanceof SpellParadigmSelf)
// {
// List<String> 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<String> 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);
}
} }
} }