Fixed the projectile so that it actually work
Amazing, eh?
This commit is contained in:
parent
112b4e6b53
commit
eb46185dc8
|
@ -12,6 +12,7 @@ import net.minecraft.entity.player.EntityPlayer;
|
||||||
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;
|
||||||
|
import net.minecraft.util.ChatMessageComponent;
|
||||||
import net.minecraft.util.DamageSource;
|
import net.minecraft.util.DamageSource;
|
||||||
import net.minecraft.util.EnumMovingObjectType;
|
import net.minecraft.util.EnumMovingObjectType;
|
||||||
import net.minecraft.util.MathHelper;
|
import net.minecraft.util.MathHelper;
|
||||||
|
@ -44,7 +45,6 @@ public class EntitySpellProjectile extends Entity implements IProjectile
|
||||||
public List<IProjectileImpactEffect> impactList = new ArrayList();
|
public List<IProjectileImpactEffect> impactList = new ArrayList();
|
||||||
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<SpellEffect> spellEffectList = new LinkedList();
|
public List<SpellEffect> spellEffectList = new LinkedList();
|
||||||
|
|
||||||
public EntitySpellProjectile(World par1World)
|
public EntitySpellProjectile(World par1World)
|
||||||
|
@ -563,11 +563,6 @@ public class EntitySpellProjectile extends Entity implements IProjectile
|
||||||
this.damage = damage;
|
this.damage = damage;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setEffectList(List<String> stringList)
|
|
||||||
{
|
|
||||||
this.effectList = stringList;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setSpellEffectList(List<SpellEffect> list)
|
public void setSpellEffectList(List<SpellEffect> list)
|
||||||
{
|
{
|
||||||
this.spellEffectList = list;
|
this.spellEffectList = list;
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
package WayofTime.alchemicalWizardry.common.spell.complex;
|
package WayofTime.alchemicalWizardry.common.spell.complex;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.LinkedList;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
|
@ -12,17 +11,29 @@ import WayofTime.alchemicalWizardry.common.items.EnergyItems;
|
||||||
import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellEffect;
|
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.IProjectileImpactEffect;
|
||||||
import WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.IProjectileUpdateEffect;
|
import WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.IProjectileUpdateEffect;
|
||||||
|
import WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.fire.ProjectileDefaultFire;
|
||||||
import WayofTime.alchemicalWizardry.common.spell.complex.enhancement.SpellEnhancement;
|
import WayofTime.alchemicalWizardry.common.spell.complex.enhancement.SpellEnhancement;
|
||||||
|
|
||||||
public class SpellParadigmProjectile extends SpellParadigm
|
public class SpellParadigmProjectile extends SpellParadigm
|
||||||
{
|
{
|
||||||
public DamageSource damageSource = DamageSource.generic;
|
public DamageSource damageSource;
|
||||||
public float damage = 1;
|
public float damage;
|
||||||
public int cost = 0;
|
public int cost;
|
||||||
public List<IProjectileImpactEffect> impactList = new ArrayList();
|
public List<IProjectileImpactEffect> impactList;
|
||||||
public List<IProjectileUpdateEffect> updateEffectList = new ArrayList();
|
public List<IProjectileUpdateEffect> updateEffectList;
|
||||||
public boolean penetration = false;
|
public boolean penetration;
|
||||||
public int ricochetMax = 0;
|
public int ricochetMax;
|
||||||
|
|
||||||
|
public SpellParadigmProjectile()
|
||||||
|
{
|
||||||
|
this.damageSource = DamageSource.generic;
|
||||||
|
this.damage = 1;
|
||||||
|
this.cost = 0;
|
||||||
|
this.impactList = new ArrayList();
|
||||||
|
this.updateEffectList = new ArrayList();
|
||||||
|
this.penetration = false;
|
||||||
|
this.ricochetMax = 0;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void enhanceParadigm(SpellEnhancement enh)
|
public void enhanceParadigm(SpellEnhancement enh)
|
||||||
|
@ -41,51 +52,6 @@ public class SpellParadigmProjectile extends SpellParadigm
|
||||||
EnergyItems.syphonBatteries(itemStack, entityPlayer, cost);
|
EnergyItems.syphonBatteries(itemStack, entityPlayer, cost);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static SpellParadigmProjectile getParadigmForStringArray(List<String> stringList)
|
|
||||||
{
|
|
||||||
SpellParadigmProjectile parad = new SpellParadigmProjectile();
|
|
||||||
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static SpellParadigmProjectile getParadigmForEffectArray(List<SpellEffect> effectList)
|
public static SpellParadigmProjectile getParadigmForEffectArray(List<SpellEffect> effectList)
|
||||||
{
|
{
|
||||||
SpellParadigmProjectile parad = new SpellParadigmProjectile();
|
SpellParadigmProjectile parad = new SpellParadigmProjectile();
|
||||||
|
@ -104,7 +70,6 @@ public class SpellParadigmProjectile extends SpellParadigm
|
||||||
proj.setImpactList(impactList);
|
proj.setImpactList(impactList);
|
||||||
proj.setUpdateEffectList(updateEffectList);
|
proj.setUpdateEffectList(updateEffectList);
|
||||||
proj.setPenetration(penetration);
|
proj.setPenetration(penetration);
|
||||||
proj.setEffectList(effectList);
|
|
||||||
proj.setRicochetMax(ricochetMax);
|
proj.setRicochetMax(ricochetMax);
|
||||||
proj.setSpellEffectList(bufferedEffectList);
|
proj.setSpellEffectList(bufferedEffectList);
|
||||||
}
|
}
|
||||||
|
|
|
@ -55,48 +55,4 @@ 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;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,6 +20,7 @@ public abstract class SpellEffect
|
||||||
this.modifierState = SpellModifier.DEFAULT;
|
this.modifierState = SpellModifier.DEFAULT;
|
||||||
this.powerEnhancement = 0;
|
this.powerEnhancement = 0;
|
||||||
this.costEnhancement = 0;
|
this.costEnhancement = 0;
|
||||||
|
this.potencyEnhancement = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void enhanceEffect(SpellEnhancement enh)
|
public void enhanceEffect(SpellEnhancement enh)
|
||||||
|
@ -176,6 +177,7 @@ public abstract class SpellEffect
|
||||||
NBTTagCompound tag = new NBTTagCompound();
|
NBTTagCompound tag = new NBTTagCompound();
|
||||||
|
|
||||||
tag.setString("Class", this.getClass().getName());
|
tag.setString("Class", this.getClass().getName());
|
||||||
|
tag.setInteger("modifier", modifierState);
|
||||||
tag.setInteger("power", powerEnhancement);
|
tag.setInteger("power", powerEnhancement);
|
||||||
tag.setInteger("cost", costEnhancement);
|
tag.setInteger("cost", costEnhancement);
|
||||||
tag.setInteger("potency", potencyEnhancement);
|
tag.setInteger("potency", potencyEnhancement);
|
||||||
|
@ -195,6 +197,7 @@ public abstract class SpellEffect
|
||||||
{
|
{
|
||||||
SpellEffect eff = (SpellEffect) obj;
|
SpellEffect eff = (SpellEffect) obj;
|
||||||
|
|
||||||
|
eff.modifierState = tag.getInteger("modifier");
|
||||||
eff.powerEnhancement = tag.getInteger("power");
|
eff.powerEnhancement = tag.getInteger("power");
|
||||||
eff.costEnhancement = tag.getInteger("cost");
|
eff.costEnhancement = tag.getInteger("cost");
|
||||||
eff.potencyEnhancement = tag.getInteger("potency");
|
eff.potencyEnhancement = tag.getInteger("potency");
|
||||||
|
|
|
@ -3,7 +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.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;
|
||||||
|
@ -22,21 +22,24 @@ public class SpellEffectFire extends SpellEffect
|
||||||
public void offensiveModificationProjectile(SpellParadigmProjectile parad)
|
public void offensiveModificationProjectile(SpellParadigmProjectile parad)
|
||||||
{
|
{
|
||||||
// TODO Auto-generated method stub
|
// TODO Auto-generated method stub
|
||||||
|
parad.addImpactEffect(new ProjectileDefaultFire(this.powerEnhancement,this.potencyEnhancement,this.costEnhancement));
|
||||||
|
parad.damage+=this.potencyEnhancement;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void defensiveModificationProjectile(SpellParadigmProjectile parad)
|
public void defensiveModificationProjectile(SpellParadigmProjectile parad)
|
||||||
{
|
{
|
||||||
// TODO Auto-generated method stub
|
// TODO Auto-generated method stub
|
||||||
|
parad.addImpactEffect(new ProjectileDefaultFire(this.powerEnhancement,this.potencyEnhancement,this.costEnhancement));
|
||||||
|
parad.damage+=this.potencyEnhancement;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void environmentalModificationProjectile(SpellParadigmProjectile parad)
|
public void environmentalModificationProjectile(SpellParadigmProjectile parad)
|
||||||
{
|
{
|
||||||
// TODO Auto-generated method stub
|
// TODO Auto-generated method stub
|
||||||
|
parad.addImpactEffect(new ProjectileDefaultFire(this.powerEnhancement,this.potencyEnhancement,this.costEnhancement));
|
||||||
|
parad.damage+=this.potencyEnhancement;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
package WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects;
|
package WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.fire;
|
||||||
|
|
||||||
|
import WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.ProjectileImpactEffect;
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
import net.minecraft.entity.Entity;
|
import net.minecraft.entity.Entity;
|
||||||
import net.minecraft.util.MovingObjectPosition;
|
import net.minecraft.util.MovingObjectPosition;
|
||||||
|
@ -24,10 +25,20 @@ public class ProjectileDefaultFire extends ProjectileImpactEffect
|
||||||
int x = mop.blockX;
|
int x = mop.blockX;
|
||||||
int y = mop.blockY;
|
int y = mop.blockY;
|
||||||
int z = mop.blockZ;
|
int z = mop.blockZ;
|
||||||
|
int range = 0;
|
||||||
if(world.isAirBlock(x, y+1, z))
|
for(int i=-range; i<=range;i++)
|
||||||
{
|
{
|
||||||
world.setBlock(x, y+1, z, Block.fire.blockID);
|
for(int j=-range; j<=range;j++)
|
||||||
|
{
|
||||||
|
for(int k=-range; k<=range; k++)
|
||||||
|
{
|
||||||
|
if(world.isAirBlock(x+i, y+j, z+k))
|
||||||
|
{
|
||||||
|
world.setBlock(x+i, y+j, z+k, Block.fire.blockID);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
|
@ -3,6 +3,8 @@ package WayofTime.alchemicalWizardry.common.tileEntity;
|
||||||
import WayofTime.alchemicalWizardry.common.spell.complex.SpellParadigm;
|
import WayofTime.alchemicalWizardry.common.spell.complex.SpellParadigm;
|
||||||
import WayofTime.alchemicalWizardry.common.spell.complex.enhancement.SpellEnhancement;
|
import WayofTime.alchemicalWizardry.common.spell.complex.enhancement.SpellEnhancement;
|
||||||
import WayofTime.alchemicalWizardry.common.spell.complex.enhancement.SpellEnhancementCost;
|
import WayofTime.alchemicalWizardry.common.spell.complex.enhancement.SpellEnhancementCost;
|
||||||
|
import WayofTime.alchemicalWizardry.common.spell.complex.enhancement.SpellEnhancementPotency;
|
||||||
|
import WayofTime.alchemicalWizardry.common.spell.complex.enhancement.SpellEnhancementPower;
|
||||||
|
|
||||||
public class TESpellEnhancementBlock extends TESpellBlock
|
public class TESpellEnhancementBlock extends TESpellBlock
|
||||||
{
|
{
|
||||||
|
@ -36,6 +38,28 @@ public class TESpellEnhancementBlock extends TESpellBlock
|
||||||
|
|
||||||
public SpellEnhancement getSpellEnhancement()
|
public SpellEnhancement getSpellEnhancement()
|
||||||
{
|
{
|
||||||
|
int meta = worldObj.getBlockMetadata(xCoord, yCoord, zCoord);
|
||||||
|
switch(meta)
|
||||||
|
{
|
||||||
|
case 0:
|
||||||
|
case 1:
|
||||||
|
case 2:
|
||||||
|
case 3:
|
||||||
|
case 4:
|
||||||
|
return new SpellEnhancementPower();
|
||||||
|
case 5:
|
||||||
|
case 6:
|
||||||
|
case 7:
|
||||||
|
case 8:
|
||||||
|
case 9:
|
||||||
|
return new SpellEnhancementCost();
|
||||||
|
case 10:
|
||||||
|
case 11:
|
||||||
|
case 12:
|
||||||
|
case 13:
|
||||||
|
case 14:
|
||||||
|
return new SpellEnhancementPotency();
|
||||||
|
}
|
||||||
return new SpellEnhancementCost();
|
return new SpellEnhancementCost();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -46,7 +70,29 @@ public class TESpellEnhancementBlock extends TESpellBlock
|
||||||
|
|
||||||
public int enhancementType() //0 is power, 1 is cost, 2 is potency
|
public int enhancementType() //0 is power, 1 is cost, 2 is potency
|
||||||
{
|
{
|
||||||
|
int meta = worldObj.getBlockMetadata(xCoord, yCoord, zCoord);
|
||||||
|
switch(meta)
|
||||||
|
{
|
||||||
|
case 0:
|
||||||
|
case 1:
|
||||||
|
case 2:
|
||||||
|
case 3:
|
||||||
|
case 4:
|
||||||
return 0;
|
return 0;
|
||||||
|
case 5:
|
||||||
|
case 6:
|
||||||
|
case 7:
|
||||||
|
case 8:
|
||||||
|
case 9:
|
||||||
|
return 1;
|
||||||
|
case 10:
|
||||||
|
case 11:
|
||||||
|
case 12:
|
||||||
|
case 13:
|
||||||
|
case 14:
|
||||||
|
return 2;
|
||||||
|
}
|
||||||
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void doBadStuff()
|
public void doBadStuff()
|
||||||
|
|
|
@ -65,6 +65,7 @@ public class TESpellParadigmBlock extends TESpellBlock
|
||||||
// spellParadSelf.castSpell(world, entity, spellCasterStack);
|
// spellParadSelf.castSpell(world, entity, spellCasterStack);
|
||||||
// }else
|
// }else
|
||||||
{
|
{
|
||||||
|
parad.applyAllSpellEffects();
|
||||||
parad.castSpell(world, entity, spellCasterStack);
|
parad.castSpell(world, entity, spellCasterStack);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue