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
|
@ -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<IProjectileUpdateEffect> updateEffectList = new ArrayList();
|
||||
public List<String> effectList = new LinkedList();
|
||||
public List<SpellEffect> 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<SpellEffect> 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<SpellEffect> list)
|
||||
{
|
||||
this.spellEffectList = list;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue