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:
parent
5dcef131dc
commit
112b4e6b53
15 changed files with 314 additions and 92 deletions
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -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;
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue