Adding gitignore

This commit is contained in:
WayofTime 2014-10-31 17:54:59 -04:00
parent a2b006105e
commit ecf0a7912e
1084 changed files with 90178 additions and 3 deletions

View file

@ -0,0 +1,143 @@
package WayofTime.alchemicalWizardry.common.spell.simple;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.world.World;
public abstract class HomSpell implements ISimpleSpell
{
private int offensiveRangedEnergy;
private int offensiveMeleeEnergy;
private int defensiveEnergy;
private int environmentalEnergy;
public HomSpell()
{
//super(id);
//this.setMaxStackSize(1);
// TODO Auto-generated constructor stub
}
@Override
public abstract ItemStack onOffensiveRangedRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer);
;
@Override
public abstract ItemStack onOffensiveMeleeRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer);
@Override
public abstract ItemStack onDefensiveRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer);
@Override
public abstract ItemStack onEnvironmentalRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer);
public int getOffensiveRangedEnergy()
{
return offensiveRangedEnergy;
}
public int getOffensiveMeleeEnergy()
{
return offensiveMeleeEnergy;
}
public int getDefensiveEnergy()
{
return defensiveEnergy;
}
public int getEnvironmentalEnergy()
{
return environmentalEnergy;
}
public void setEnergies(int offensiveRanged, int offensiveMelee, int defensive, int environmental)
{
this.offensiveRangedEnergy = offensiveRanged;
this.offensiveMeleeEnergy = offensiveMelee;
this.defensiveEnergy = defensive;
this.environmentalEnergy = environmental;
}
public void setSpellParadigm(ItemStack itemStack, int paradigm)
{
if (itemStack.stackTagCompound == null)
{
itemStack.setTagCompound(new NBTTagCompound());
}
itemStack.stackTagCompound.setInteger("paradigm", paradigm);
}
public int getSpellParadigm(ItemStack itemStack)
{
if (itemStack.stackTagCompound == null)
{
itemStack.setTagCompound(new NBTTagCompound());
}
return (itemStack.stackTagCompound.getInteger("paradigm"));
}
//@Override
public ItemStack useSpell(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer)
{
int paradigm = getSpellParadigm(par1ItemStack);
if (par3EntityPlayer.isSneaking())
{
if (paradigm < 3)
{
this.setSpellParadigm(par1ItemStack, paradigm + 1);
} else
{
this.setSpellParadigm(par1ItemStack, 0);
}
return par1ItemStack;
}
switch (paradigm)
{
case 0:
return this.onOffensiveRangedRightClick(par1ItemStack, par2World, par3EntityPlayer);
case 1:
return this.onOffensiveMeleeRightClick(par1ItemStack, par2World, par3EntityPlayer);
case 2:
return this.onDefensiveRightClick(par1ItemStack, par2World, par3EntityPlayer);
case 3:
return this.onEnvironmentalRightClick(par1ItemStack, par2World, par3EntityPlayer);
}
return par1ItemStack;
}
// @Override
// public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4)
// {
// if (!(par1ItemStack.stackTagCompound == null))
// {
// if (!par1ItemStack.stackTagCompound.getString("ownerName").equals(""))
// {
// par3List.add("Current owner: " + par1ItemStack.stackTagCompound.getString("ownerName"));
// }
//
// par3List.add("Current paradigm: " + this.getSpellParadigm(par1ItemStack));
// }
// }
public int getDimensionID(ItemStack itemStack)
{
if (itemStack.stackTagCompound == null)
{
itemStack.setTagCompound(new NBTTagCompound());
}
return itemStack.stackTagCompound.getInteger("dimensionId");
}
}

View file

@ -0,0 +1,26 @@
package WayofTime.alchemicalWizardry.common.spell.simple;
import net.minecraft.item.ItemStack;
public class HomSpellComponent
{
public HomSpell spell;
public ItemStack item;
public int blockID;
public HomSpellComponent(ItemStack item, HomSpell spell)
{
this.item = item;
this.spell = spell;
}
public HomSpell getSpell()
{
return spell;
}
public ItemStack getItemStack()
{
return this.item;
}
}

View file

@ -0,0 +1,55 @@
package WayofTime.alchemicalWizardry.common.spell.simple;
import java.util.ArrayList;
import java.util.List;
import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemStack;
public class HomSpellRegistry
{
public static List<HomSpellComponent> spellList = new ArrayList();
public static void registerBasicSpell(ItemStack item, HomSpell spell)
{
spellList.add(new HomSpellComponent(item, spell));
}
public static HomSpell getSpellForItemStack(ItemStack testItem)
{
if (testItem == null)
{
return null;
}
for (HomSpellComponent hsc : spellList)
{
ItemStack item = hsc.getItemStack();
if (item != null)
{
if (item.getItem() instanceof ItemBlock)
{
if (testItem.getItem() instanceof ItemBlock)
{
if (testItem.getItem() == item.getItem())
{
return hsc.getSpell();
}
}
} else
{
if (!(testItem.getItem() instanceof ItemBlock))
{
if (testItem.getItem() == item.getItem())
{
return hsc.getSpell();
}
}
}
}
}
return null;
}
}

View file

@ -0,0 +1,16 @@
package WayofTime.alchemicalWizardry.common.spell.simple;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
public interface ISimpleSpell
{
public abstract ItemStack onOffensiveRangedRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer);
public abstract ItemStack onOffensiveMeleeRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer);
public abstract ItemStack onDefensiveRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer);
public abstract ItemStack onEnvironmentalRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer);
}

View file

@ -0,0 +1,199 @@
package WayofTime.alchemicalWizardry.common.spell.simple;
import java.util.Random;
import net.minecraft.block.Block;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Blocks;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
import WayofTime.alchemicalWizardry.common.PacketHandler;
import WayofTime.alchemicalWizardry.common.entity.projectile.MudProjectile;
import WayofTime.alchemicalWizardry.common.items.EnergyItems;
import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper;
public class SpellEarthBender extends HomSpell
{
Random itemRand = new Random();
public SpellEarthBender()
{
super();
this.setEnergies(100, 150, 350, 200);
//this.setCreativeTab(CreativeTabs.tabMisc);
}
@Override
public ItemStack onOffensiveRangedRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer)
{
EnergyItems.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer);
if (par3EntityPlayer.isSneaking())
{
return par1ItemStack;
}
if (!par3EntityPlayer.capabilities.isCreativeMode)
{
EnergyItems.syphonAndDamageWhileInContainer(par1ItemStack, par3EntityPlayer, this.getOffensiveRangedEnergy());
}
par2World.spawnEntityInWorld(new MudProjectile(par2World, par3EntityPlayer, 8, false));
par2World.playSoundAtEntity(par3EntityPlayer, "random.fizz", 0.5F, 0.4F / (itemRand.nextFloat() * 0.4F + 0.8F));
return par1ItemStack;
}
@Override
public ItemStack onOffensiveMeleeRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer)
{
EnergyItems.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer);
if (par3EntityPlayer.isSneaking())
{
return par1ItemStack;
}
if (!par3EntityPlayer.capabilities.isCreativeMode)
{
EnergyItems.syphonAndDamageWhileInContainer(par1ItemStack, par3EntityPlayer, this.getOffensiveMeleeEnergy());
}
if (!par2World.isRemote)
{
for (int i = -1; i <= 1; i++)
{
for (int j = -1; j <= 1; j++)
{
par2World.spawnEntityInWorld(new MudProjectile(par2World, par3EntityPlayer, 3, 3, par3EntityPlayer.posX, par3EntityPlayer.posY + par3EntityPlayer.getEyeHeight(), par3EntityPlayer.posZ, par3EntityPlayer.rotationYaw + i * 10F, par3EntityPlayer.rotationPitch + j * 5F, true));
}
}
}
return par1ItemStack;
}
@Override
public ItemStack onDefensiveRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer)
{
EnergyItems.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer);
if (par3EntityPlayer.isSneaking())
{
return par1ItemStack;
}
if (!par3EntityPlayer.capabilities.isCreativeMode)
{
EnergyItems.syphonAndDamageWhileInContainer(par1ItemStack, par3EntityPlayer, this.getDefensiveEnergy());
}
double xCoord = par3EntityPlayer.posX;
double yCoord = par3EntityPlayer.posY;
double zCoord = par3EntityPlayer.posZ;
int posX = (int) xCoord;
int posY = (int) yCoord;
int posZ = (int) zCoord;
Block blockID = Blocks.stone;
if (par2World.isAirBlock(posX, posY + 3, posZ))
{
par2World.setBlock(posX, posY + 3, posZ, Blocks.glass);
}
for (int i = 0; i < 4; i++)
{
for (int j = 0; j < 4; j++)
{
if (par2World.isAirBlock(posX + i - 1, posY + j, posZ - 2))
{
par2World.setBlock(posX + i - 1, posY + j, posZ - 2, blockID);
}
if (par2World.isAirBlock(posX + 2, posY + j, posZ - 1 + i))
{
par2World.setBlock(posX + 2, posY + j, posZ - 1 + i, blockID);
}
if (par2World.isAirBlock(posX - i + 1, posY + j, posZ + 2))
{
par2World.setBlock(posX - i + 1, posY + j, posZ + 2, blockID);
}
if (par2World.isAirBlock(posX - 2, posY + j, posZ + 1 - i))
{
par2World.setBlock(posX - 2, posY + j, posZ + 1 - i, blockID);
}
{
if (par2World.isAirBlock(posX - 1 + i, posY + 3, posZ - 1 + j))
{
par2World.setBlock(posX - 1 + i, posY + 3, posZ - 1 + j, blockID);
}
}
}
}
for (int i = 0; i < 20; i++)
{
//PacketDispatcher.sendPacketToAllAround(xCoord, yCoord, zCoord, 30, par2World.provider.dimensionId, PacketHandler.getCustomParticlePacket("mobSpell", xCoord + (itemRand.nextFloat() - itemRand.nextFloat()) * 3, yCoord + (itemRand.nextFloat() - itemRand.nextFloat()) * 3, zCoord + (itemRand.nextFloat() - itemRand.nextFloat()) * 3, 0.0F, 0.410F, 1.0F));
SpellHelper.sendParticleToAllAround(par2World, xCoord, yCoord, zCoord, 30, par2World.provider.dimensionId, "mobSpell", xCoord + (itemRand.nextFloat() - itemRand.nextFloat()) * 3, yCoord + (itemRand.nextFloat() - itemRand.nextFloat()) * 3, zCoord + (itemRand.nextFloat() - itemRand.nextFloat()) * 3, 0.0F, 0.410F, 1.0F);
}
return par1ItemStack;
}
@Override
public ItemStack onEnvironmentalRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer)
{
EnergyItems.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer);
if (par3EntityPlayer.isSneaking())
{
return par1ItemStack;
}
if (!par3EntityPlayer.capabilities.isCreativeMode)
{
EnergyItems.syphonAndDamageWhileInContainer(par1ItemStack, par3EntityPlayer, this.getEnvironmentalEnergy());
}
int range = 3;
if (!par2World.isRemote)
{
for (int i = -range; i <= range; i++)
{
for (int j = -1; j <= 1; j++)
{
for (int k = -range; k <= range; k++)
{
if (par2World.getBlock((int) par3EntityPlayer.posX + i, (int) par3EntityPlayer.posY + j, (int) par3EntityPlayer.posZ + k) == Blocks.water || par2World.getBlock((int) par3EntityPlayer.posX + i, (int) par3EntityPlayer.posY + j, (int) par3EntityPlayer.posZ + k) == Blocks.flowing_water)
{
int x = par2World.rand.nextInt(2);
if (x == 0)
{
par2World.setBlock((int) par3EntityPlayer.posX + i, (int) par3EntityPlayer.posY + j, (int) par3EntityPlayer.posZ + k, Blocks.sand);
} else
{
par2World.setBlock((int) par3EntityPlayer.posX + i, (int) par3EntityPlayer.posY + j, (int) par3EntityPlayer.posZ + k, Blocks.dirt);
}
}
}
}
}
}
double xCoord = par3EntityPlayer.posX;
double yCoord = par3EntityPlayer.posY;
double zCoord = par3EntityPlayer.posZ;
for (int i = 0; i < 16; i++)
{
//PacketDispatcher.sendPacketToAllAround(xCoord, yCoord, zCoord, 30, par2World.provider.dimensionId, PacketHandler.getCustomParticlePacket("mobSpell", xCoord + (itemRand.nextFloat() - itemRand.nextFloat()) * 2, yCoord + (itemRand.nextFloat() - itemRand.nextFloat()) * 2, zCoord + (itemRand.nextFloat() - itemRand.nextFloat()) * 2, 0.0F, 0.410F, 1.0F));
SpellHelper.sendParticleToAllAround(par2World, xCoord, yCoord, zCoord, 30, par2World.provider.dimensionId, "mobSpell", xCoord + (itemRand.nextFloat() - itemRand.nextFloat()) * 3, yCoord + (itemRand.nextFloat() - itemRand.nextFloat()) * 3, zCoord + (itemRand.nextFloat() - itemRand.nextFloat()) * 3, 0.0F, 0.410F, 1.0F);
}
return par1ItemStack;
}
}

View file

@ -0,0 +1,116 @@
package WayofTime.alchemicalWizardry.common.spell.simple;
import WayofTime.alchemicalWizardry.common.entity.projectile.ExplosionProjectile;
import WayofTime.alchemicalWizardry.common.items.EnergyItems;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
import java.util.Random;
public class SpellExplosions extends HomSpell
{
Random itemRand = new Random();
public SpellExplosions()
{
super();
this.setEnergies(400, 500, 1900, 1500);
//this.setCreativeTab(CreativeTabs.tabMisc);
}
@Override
public ItemStack onOffensiveRangedRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer)
{
EnergyItems.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer);
if (par3EntityPlayer.isSneaking())
{
return par1ItemStack;
}
if (!par3EntityPlayer.capabilities.isCreativeMode)
{
EnergyItems.syphonAndDamageWhileInContainer(par1ItemStack, par3EntityPlayer, this.getOffensiveRangedEnergy());
}
par2World.playSoundAtEntity(par3EntityPlayer, "random.fizz", 0.5F, 0.4F / (itemRand.nextFloat() * 0.4F + 0.8F));
if (!par2World.isRemote)
{
//par2World.spawnEntityInWorld(new EnergyBlastProjectile(par2World, par3EntityPlayer, damage));
par2World.spawnEntityInWorld(new ExplosionProjectile(par2World, par3EntityPlayer, 6, true));
}
return par1ItemStack;
}
@Override
public ItemStack onOffensiveMeleeRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer)
{
EnergyItems.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer);
if (par3EntityPlayer.isSneaking())
{
return par1ItemStack;
}
if (!par3EntityPlayer.capabilities.isCreativeMode)
{
EnergyItems.syphonAndDamageWhileInContainer(par1ItemStack, par3EntityPlayer, this.getOffensiveMeleeEnergy());
}
int distance = 4;
double yaw = par3EntityPlayer.rotationYaw / 180 * Math.PI;
double pitch = par3EntityPlayer.rotationPitch / 180 * Math.PI;
par2World.createExplosion(par3EntityPlayer, par3EntityPlayer.posX + Math.sin(yaw) * Math.cos(pitch) * (-distance), par3EntityPlayer.posY + par3EntityPlayer.getEyeHeight() + Math.sin(-pitch) * distance, par3EntityPlayer.posZ + Math.cos(yaw) * Math.cos(pitch) * distance, (float) (3), true);
return par1ItemStack;
}
@Override
public ItemStack onDefensiveRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer)
{
EnergyItems.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer);
if (par3EntityPlayer.isSneaking())
{
return par1ItemStack;
}
if (!par3EntityPlayer.capabilities.isCreativeMode)
{
EnergyItems.syphonAndDamageWhileInContainer(par1ItemStack, par3EntityPlayer, this.getDefensiveEnergy());
}
int distance = 4;
// double yaw = par3EntityPlayer.rotationYaw/180*Math.PI;
// double pitch = par3EntityPlayer.rotationPitch/180*Math.PI;
par2World.createExplosion(par3EntityPlayer, par3EntityPlayer.posX, par3EntityPlayer.posY + par3EntityPlayer.getEyeHeight(), par3EntityPlayer.posZ, (float) (distance), false);
return par1ItemStack;
}
@Override
public ItemStack onEnvironmentalRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer)
{
EnergyItems.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer);
if (par3EntityPlayer.isSneaking())
{
return par1ItemStack;
}
if (!par3EntityPlayer.capabilities.isCreativeMode)
{
EnergyItems.syphonAndDamageWhileInContainer(par1ItemStack, par3EntityPlayer, this.getEnvironmentalEnergy());
}
int radius = 3;
for (int i = 0; i < 360; i += 36)
{
par2World.createExplosion(par3EntityPlayer, par3EntityPlayer.posX + Math.cos(i) * radius, par3EntityPlayer.posY, par3EntityPlayer.posZ + Math.sin(i) * radius, (float) (2), true);
}
return null;
}
}

View file

@ -0,0 +1,175 @@
package WayofTime.alchemicalWizardry.common.spell.simple;
import java.util.Iterator;
import java.util.List;
import java.util.Random;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Blocks;
import net.minecraft.item.ItemStack;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.DamageSource;
import net.minecraft.world.World;
import WayofTime.alchemicalWizardry.common.entity.projectile.FireProjectile;
import WayofTime.alchemicalWizardry.common.items.EnergyItems;
public class SpellFireBurst extends HomSpell
{
public Random itemRand = new Random();
public SpellFireBurst()
{
super();
this.setEnergies(100, 300, 400, 100);
//this.setCreativeTab(CreativeTabs.tabMisc);
}
@Override
public ItemStack onOffensiveRangedRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer)
{
EnergyItems.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer);
if (par3EntityPlayer.isSneaking())
{
return par1ItemStack;
}
if (!par3EntityPlayer.capabilities.isCreativeMode)
{
EnergyItems.syphonAndDamageWhileInContainer(par1ItemStack, par3EntityPlayer, this.getOffensiveRangedEnergy());
}
par2World.playSoundAtEntity(par3EntityPlayer, "random.fizz", 0.5F, 0.4F / (itemRand.nextFloat() * 0.4F + 0.8F));
if (!par2World.isRemote)
{
//par2World.spawnEntityInWorld(new EnergyBlastProjectile(par2World, par3EntityPlayer, damage));
FireProjectile proj = new FireProjectile(par2World, par3EntityPlayer, 7);
par2World.spawnEntityInWorld(proj);
}
return par1ItemStack;
}
@Override
public ItemStack onOffensiveMeleeRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer)
{
EnergyItems.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer);
if (par3EntityPlayer.isSneaking())
{
return par1ItemStack;
}
if (!par3EntityPlayer.capabilities.isCreativeMode)
{
EnergyItems.syphonAndDamageWhileInContainer(par1ItemStack, par3EntityPlayer, this.getOffensiveMeleeEnergy());
}
par2World.playSoundAtEntity(par3EntityPlayer, "random.fizz", 0.5F, 0.4F / (itemRand.nextFloat() * 0.4F + 0.8F));
if (!par2World.isRemote)
{
for (int i = -1; i <= 1; i++)
{
for (int j = -1; j <= 1; j++)
{
par2World.spawnEntityInWorld(new FireProjectile(par2World, par3EntityPlayer, 8, 2, par3EntityPlayer.posX, par3EntityPlayer.posY + par3EntityPlayer.getEyeHeight(), par3EntityPlayer.posZ, par3EntityPlayer.rotationYaw + i * 10F, par3EntityPlayer.rotationPitch + j * 10F));
}
}
}
return par1ItemStack;
}
@Override
public ItemStack onDefensiveRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer)
{
EnergyItems.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer);
if (par3EntityPlayer.isSneaking())
{
return par1ItemStack;
}
if (!par3EntityPlayer.capabilities.isCreativeMode)
{
EnergyItems.syphonAndDamageWhileInContainer(par1ItemStack, par3EntityPlayer, this.getDefensiveEnergy());
}
par2World.playSoundAtEntity(par3EntityPlayer, "random.fizz", 0.5F, 0.4F / (itemRand.nextFloat() * 0.4F + 0.8F));
int d0 = 2;
AxisAlignedBB axisalignedbb = AxisAlignedBB.getBoundingBox((double) par3EntityPlayer.posX, (double) par3EntityPlayer.posY, (double) par3EntityPlayer.posZ, (double) (par3EntityPlayer.posX + 1), (double) (par3EntityPlayer.posY + 2), (double) (par3EntityPlayer.posZ + 1)).expand(d0, d0, d0);
//axisalignedbb.maxY = (double)this.worldObj.getHeight();
List list = par3EntityPlayer.worldObj.getEntitiesWithinAABB(EntityLivingBase.class, axisalignedbb);
Iterator iterator = list.iterator();
while (iterator.hasNext())
{
EntityLivingBase entityLiving = (EntityLivingBase) iterator.next();
if (entityLiving instanceof EntityPlayer)
{
if (entityLiving.equals(par3EntityPlayer))
{
continue;
}
}
entityLiving.setFire(100);
entityLiving.attackEntityFrom(DamageSource.inFire, 2);
}
// if (!par2World.isRemote)
// {
//
// for(int i=0;i<10;i++)
// {
// for(int j=0;j<5;j++)
// {
// par2World.spawnEntityInWorld(new FireProjectile(par2World, par3EntityPlayer, 10,5,par3EntityPlayer.posX,par3EntityPlayer.posY+par3EntityPlayer.getEyeHeight(),par3EntityPlayer.posZ, par3EntityPlayer.rotationYaw+i*36F,par3EntityPlayer.rotationPitch+j*72F));
// }
// }
// }
return par1ItemStack;
}
@Override
public ItemStack onEnvironmentalRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer)
{
EnergyItems.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer);
if (par3EntityPlayer.isSneaking())
{
return par1ItemStack;
}
if (!par3EntityPlayer.capabilities.isCreativeMode)
{
EnergyItems.syphonAndDamageWhileInContainer(par1ItemStack, par3EntityPlayer, this.getEnvironmentalEnergy());
}
par2World.playSoundAtEntity(par3EntityPlayer, "random.fizz", 0.5F, 0.4F / (itemRand.nextFloat() * 0.4F + 0.8F));
World worldObj = par2World;
for (int i = -1; i <= 1; i++)
{
for (int j = -1; j <= 1; j++)
{
for (int k = -1; k <= 1; k++)
{
if (worldObj.isAirBlock((int) par3EntityPlayer.posX + i, (int) par3EntityPlayer.posY + j, (int) par3EntityPlayer.posZ + k))
{
if (worldObj.rand.nextFloat() < 0.8F)
{
worldObj.setBlock((int) par3EntityPlayer.posX + i, (int) par3EntityPlayer.posY + j, (int) par3EntityPlayer.posZ + k, Blocks.fire);
}
}
}
}
}
return par1ItemStack;
}
}

View file

@ -0,0 +1,208 @@
package WayofTime.alchemicalWizardry.common.spell.simple;
import java.util.Random;
import net.minecraft.block.Block;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Blocks;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
import WayofTime.alchemicalWizardry.common.entity.projectile.IceProjectile;
import WayofTime.alchemicalWizardry.common.items.EnergyItems;
public class SpellFrozenWater extends HomSpell
{
public Random itemRand = new Random();
public SpellFrozenWater()
{
super();
this.setEnergies(100, 200, 150, 100);
//this.setCreativeTab(CreativeTabs.tabMisc);
}
@Override
public ItemStack onOffensiveRangedRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer)
{
EnergyItems.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer);
if (par3EntityPlayer.isSneaking())
{
return par1ItemStack;
}
if (!par3EntityPlayer.capabilities.isCreativeMode)
{
EnergyItems.syphonAndDamageWhileInContainer(par1ItemStack, par3EntityPlayer, this.getOffensiveRangedEnergy());
}
par2World.playSoundAtEntity(par3EntityPlayer, "random.fizz", 0.5F, 0.4F / (itemRand.nextFloat() * 0.4F + 0.8F));
if (!par2World.isRemote)
{
//par2World.spawnEntityInWorld(new EnergyBlastProjectile(par2World, par3EntityPlayer, damage));
par2World.spawnEntityInWorld(new IceProjectile(par2World, par3EntityPlayer, 6));
}
return par1ItemStack;
}
@Override
public ItemStack onOffensiveMeleeRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer)
{
EnergyItems.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer);
if (par3EntityPlayer.isSneaking())
{
return par1ItemStack;
}
if (!par3EntityPlayer.capabilities.isCreativeMode)
{
EnergyItems.syphonAndDamageWhileInContainer(par1ItemStack, par3EntityPlayer, this.getOffensiveMeleeEnergy());
}
for (int i = -2; i <= 2; i++)
{
par2World.spawnEntityInWorld(new IceProjectile(par2World, par3EntityPlayer, 6, 2, par3EntityPlayer.posX, par3EntityPlayer.posY + par3EntityPlayer.getEyeHeight(), par3EntityPlayer.posZ, par3EntityPlayer.rotationYaw + i * 5F, par3EntityPlayer.rotationPitch));
}
return par1ItemStack;
}
@Override
public ItemStack onDefensiveRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer)
{
if (!par3EntityPlayer.capabilities.isCreativeMode)
{
EnergyItems.syphonAndDamageWhileInContainer(par1ItemStack, par3EntityPlayer, getDefensiveEnergy());
}
float yaw = par3EntityPlayer.rotationYaw;
float pitch = par3EntityPlayer.rotationPitch;
int range = 2;
if (pitch > 40F)
{
for (int i = -range; i <= range; i++)
{
for (int j = -range; j <= range; j++)
{
if (par2World.isAirBlock((int) par3EntityPlayer.posX + i, (int) par3EntityPlayer.posY - 1, (int) par3EntityPlayer.posZ + j))
{
par2World.setBlock((int) par3EntityPlayer.posX + i, (int) par3EntityPlayer.posY - 1, (int) par3EntityPlayer.posZ + j, Blocks.ice);
}
}
}
return par1ItemStack;
} else if (pitch < -40F)
{
for (int i = -range; i <= range; i++)
{
for (int j = -range; j <= range; j++)
{
if (par2World.isAirBlock((int) par3EntityPlayer.posX + i, (int) par3EntityPlayer.posY + 3, (int) par3EntityPlayer.posZ + j))
{
par2World.setBlock((int) par3EntityPlayer.posX + i, (int) par3EntityPlayer.posY + 3, (int) par3EntityPlayer.posZ + j, Blocks.ice);
}
}
}
return par1ItemStack;
}
if ((yaw >= 315 && yaw < 360) || (yaw >= 0 && yaw < 45))
{
for (int i = -range; i <= range; i++)
{
for (int j = 0; j < range * 2 + 1; j++)
{
if (par2World.isAirBlock((int) par3EntityPlayer.posX + i, (int) par3EntityPlayer.posY + j, (int) par3EntityPlayer.posZ + 2))
{
par2World.setBlock((int) par3EntityPlayer.posX + i, (int) par3EntityPlayer.posY + j, (int) par3EntityPlayer.posZ + 2, Blocks.ice);
}
}
}
} else if (yaw >= 45 && yaw < 135)
{
for (int i = -range; i <= range; i++)
{
for (int j = 0; j < range * 2 + 1; j++)
{
if (par2World.isAirBlock((int) par3EntityPlayer.posX - 2, (int) par3EntityPlayer.posY + j, (int) par3EntityPlayer.posZ + i))
{
par2World.setBlock((int) par3EntityPlayer.posX - 2, (int) par3EntityPlayer.posY + j, (int) par3EntityPlayer.posZ + i, Blocks.ice);
}
}
}
} else if (yaw >= 135 && yaw < 225)
{
for (int i = -range; i <= range; i++)
{
for (int j = 0; j < range * 2 + 1; j++)
{
if (par2World.isAirBlock((int) par3EntityPlayer.posX + i, (int) par3EntityPlayer.posY + j, (int) par3EntityPlayer.posZ - 2))
{
par2World.setBlock((int) par3EntityPlayer.posX + i, (int) par3EntityPlayer.posY + j, (int) par3EntityPlayer.posZ - 2, Blocks.ice);
}
}
}
} else
{
for (int i = -range; i <= range; i++)
{
for (int j = 0; j < range * 2 + 1; j++)
{
if (par2World.isAirBlock((int) par3EntityPlayer.posX + 2, (int) par3EntityPlayer.posY + j, (int) par3EntityPlayer.posZ + i))
{
par2World.setBlock((int) par3EntityPlayer.posX + 2, (int) par3EntityPlayer.posY + j, (int) par3EntityPlayer.posZ + i, Blocks.ice);
}
}
}
}
return par1ItemStack;
}
@Override
public ItemStack onEnvironmentalRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer)
{
EnergyItems.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer);
if (par3EntityPlayer.isSneaking())
{
return par1ItemStack;
}
int radius = 3;
int posX = (int) par3EntityPlayer.posX;
int posY = (int) par3EntityPlayer.posY;
int posZ = (int) par3EntityPlayer.posZ;
for (int i = -radius; i <= radius; i++)
{
for (int j = -radius; j <= radius; j++)
{
for (int k = -radius; k <= radius; k++)
{
Block block = par2World.getBlock((int) par3EntityPlayer.posX + i - 1, (int) par3EntityPlayer.posY + j, (int) par3EntityPlayer.posZ + k);
//Block block = Block.blocksList[blockID];
if (block == Blocks.water || block == Blocks.flowing_water)
{
par2World.setBlock((int) par3EntityPlayer.posX + i - 1, (int) par3EntityPlayer.posY + j, (int) par3EntityPlayer.posZ + k, Blocks.ice);
}
}
}
}
// int blockID = par2World.getBlockId((int)par3EntityPlayer.posX+i, (int)par3EntityPlayer.posY+j, (int)par3EntityPlayer.posZ+k);
// //Block block = Block.blocksList[blockID];
// if(blockID==Block.waterMoving.blockID||blockID==Block.waterStill.blockID)
// {
// par2World.setBlock((int)par3EntityPlayer.posX+i, (int)par3EntityPlayer.posY+j, (int)par3EntityPlayer.posZ+k, Blocks.ice);
// }
return par1ItemStack;
}
}

View file

@ -0,0 +1,200 @@
package WayofTime.alchemicalWizardry.common.spell.simple;
import java.util.Iterator;
import java.util.List;
import java.util.Random;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.DamageSource;
import net.minecraft.world.World;
import WayofTime.alchemicalWizardry.common.PacketHandler;
import WayofTime.alchemicalWizardry.common.entity.projectile.HolyProjectile;
import WayofTime.alchemicalWizardry.common.items.EnergyItems;
import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper;
public class SpellHolyBlast extends HomSpell
{
Random itemRand = new Random();
public SpellHolyBlast()
{
super();
this.setEnergies(100, 300, 500, 400);
//this.setCreativeTab(CreativeTabs.tabMisc);
}
@Override
public ItemStack onOffensiveRangedRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer)
{
EnergyItems.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer);
if (par3EntityPlayer.isSneaking())
{
return par1ItemStack;
}
if (!par3EntityPlayer.capabilities.isCreativeMode)
{
EnergyItems.syphonAndDamageWhileInContainer(par1ItemStack, par3EntityPlayer, this.getOffensiveRangedEnergy());
}
par2World.playSoundAtEntity(par3EntityPlayer, "random.fizz", 0.5F, 0.4F / (itemRand.nextFloat() * 0.4F + 0.8F));
if (!par2World.isRemote)
{
//par2World.spawnEntityInWorld(new EnergyBlastProjectile(par2World, par3EntityPlayer, damage));
par2World.spawnEntityInWorld(new HolyProjectile(par2World, par3EntityPlayer, 8));
}
return par1ItemStack;
}
@Override
public ItemStack onOffensiveMeleeRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer)
{
EnergyItems.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer);
if (par3EntityPlayer.isSneaking())
{
return par1ItemStack;
}
if (!par3EntityPlayer.capabilities.isCreativeMode)
{
EnergyItems.syphonAndDamageWhileInContainer(par1ItemStack, par3EntityPlayer, this.getOffensiveMeleeEnergy());
}
int distance = 2;
double yaw = par3EntityPlayer.rotationYaw / 180 * Math.PI;
double pitch = par3EntityPlayer.rotationPitch / 180 * Math.PI;
double xCoord = par3EntityPlayer.posX + Math.sin(yaw) * Math.cos(pitch) * (-distance);
double yCoord = par3EntityPlayer.posY + par3EntityPlayer.getEyeHeight() + Math.sin(-pitch) * distance;
double zCoord = par3EntityPlayer.posZ + Math.cos(yaw) * Math.cos(pitch) * distance;
float d0 = 0.5f;
AxisAlignedBB axisalignedbb = AxisAlignedBB.getBoundingBox(par3EntityPlayer.posX - 0.5 + Math.sin(yaw) * Math.cos(pitch) * (-distance), par3EntityPlayer.posY + par3EntityPlayer.getEyeHeight() + Math.sin(-pitch) * distance, par3EntityPlayer.posZ - 0.5 + Math.cos(yaw) * Math.cos(pitch) * distance, par3EntityPlayer.posX + Math.sin(yaw) * Math.cos(pitch) * (-distance) + 0.5, par3EntityPlayer.posY + par3EntityPlayer.getEyeHeight() + Math.sin(-pitch) * distance + 1, par3EntityPlayer.posZ + Math.cos(yaw) * Math.cos(pitch) * distance + 0.5).expand(d0, d0, d0);
//axisalignedbb.maxY = (double)this.worldObj.getHeight();
List list = par3EntityPlayer.worldObj.getEntitiesWithinAABB(EntityLivingBase.class, axisalignedbb);
Iterator iterator = list.iterator();
while (iterator.hasNext())
{
EntityLivingBase entityLiving = (EntityLivingBase) iterator.next();
if (entityLiving instanceof EntityPlayer)
{
if (entityLiving.equals(par3EntityPlayer))
{
continue;
}
}
int i = 1;
if (entityLiving.isEntityUndead())
{
i = 3;
}
//entityLiving.setFire(50);
entityLiving.attackEntityFrom(DamageSource.causePlayerDamage(par3EntityPlayer), 5 * i);
//par2World.createExplosion(par3EntityPlayer, par3EntityPlayer.posX, par3EntityPlayer.posY, par3EntityPlayer.posZ, (float)(2), false);
}
par2World.createExplosion(par3EntityPlayer, xCoord, yCoord, zCoord, (float) (1), false);
for (int i = 0; i < 5; i++)
{
//PacketDispatcher.sendPacketToAllAround(xCoord, yCoord, zCoord, 30, par2World.provider.dimensionId, PacketHandler.getCustomParticlePacket("mobSpell", xCoord + itemRand.nextFloat() - itemRand.nextFloat(), yCoord + itemRand.nextFloat() - itemRand.nextFloat(), zCoord + itemRand.nextFloat() - itemRand.nextFloat(), 1.0F, 1.0F, 1.0F));
SpellHelper.sendParticleToAllAround(par2World, xCoord, yCoord, zCoord, 30, par2World.provider.dimensionId, "mobSpell", xCoord + itemRand.nextFloat() - itemRand.nextFloat(), yCoord + itemRand.nextFloat() - itemRand.nextFloat(), zCoord + itemRand.nextFloat() - itemRand.nextFloat(), 1.0F, 1.0F, 1.0F);
}
return par1ItemStack;
}
@Override
public ItemStack onDefensiveRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer)
{
EnergyItems.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer);
if (par3EntityPlayer.isSneaking())
{
return par1ItemStack;
}
if (!par3EntityPlayer.capabilities.isCreativeMode)
{
EnergyItems.syphonAndDamageWhileInContainer(par1ItemStack, par3EntityPlayer, this.getDefensiveEnergy());
}
if (!par2World.isRemote)
{
for (int i = 0; i < 360; i += 18)
{
par2World.spawnEntityInWorld(new HolyProjectile(par2World, par3EntityPlayer, 8, 3, par3EntityPlayer.posX, par3EntityPlayer.posY + (par3EntityPlayer.height / 2), par3EntityPlayer.posZ, i, 0));
}
}
return par1ItemStack;
}
@Override
public ItemStack onEnvironmentalRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer)
{
EnergyItems.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer);
if (par3EntityPlayer.isSneaking())
{
return par1ItemStack;
}
if (!par3EntityPlayer.capabilities.isCreativeMode)
{
EnergyItems.syphonAndDamageWhileInContainer(par1ItemStack, par3EntityPlayer, this.getEnvironmentalEnergy());
}
int d0 = 3;
AxisAlignedBB axisalignedbb = AxisAlignedBB.getBoundingBox((double) par3EntityPlayer.posX, (double) par3EntityPlayer.posY, (double) par3EntityPlayer.posZ, (double) (par3EntityPlayer.posX + 1), (double) (par3EntityPlayer.posY + 2), (double) (par3EntityPlayer.posZ + 1)).expand(d0, d0, d0);
//axisalignedbb.maxY = (double)this.worldObj.getHeight();
List list = par3EntityPlayer.worldObj.getEntitiesWithinAABB(EntityLivingBase.class, axisalignedbb);
Iterator iterator = list.iterator();
while (iterator.hasNext())
{
EntityLivingBase entityLiving = (EntityLivingBase) iterator.next();
if (entityLiving instanceof EntityPlayer)
{
if (entityLiving.equals(par3EntityPlayer))
{
continue;
}
}
int i = 1;
if (entityLiving.isEntityUndead())
{
i = 3;
}
//entityLiving.setFire(50);
entityLiving.attackEntityFrom(DamageSource.causePlayerDamage(par3EntityPlayer), 5 * i);
//par2World.createExplosion(par3EntityPlayer, par3EntityPlayer.posX, par3EntityPlayer.posY, par3EntityPlayer.posZ, (float)(2), false);
}
par2World.createExplosion(par3EntityPlayer, par3EntityPlayer.posX, par3EntityPlayer.posY, par3EntityPlayer.posZ, (float) (2), false);
double xCoord = par3EntityPlayer.posX;
double yCoord = par3EntityPlayer.posY;
double zCoord = par3EntityPlayer.posZ;
for (int i = 0; i < 20; i++)
{
SpellHelper.sendParticleToAllAround(par2World, xCoord, yCoord, zCoord, 30, par2World.provider.dimensionId, "mobSpell", xCoord + itemRand.nextFloat() - itemRand.nextFloat(), yCoord + itemRand.nextFloat() - itemRand.nextFloat(), zCoord + itemRand.nextFloat() - itemRand.nextFloat(), 1.0F, 1.0F, 1.0F);
}
return par1ItemStack;
}
}

View file

@ -0,0 +1,141 @@
package WayofTime.alchemicalWizardry.common.spell.simple;
import java.util.Random;
import net.minecraft.entity.effect.EntityLightningBolt;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
import WayofTime.alchemicalWizardry.common.PacketHandler;
import WayofTime.alchemicalWizardry.common.entity.projectile.LightningBoltProjectile;
import WayofTime.alchemicalWizardry.common.items.EnergyItems;
import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper;
public class SpellLightningBolt extends HomSpell
{
Random itemRand = new Random();
public SpellLightningBolt()
{
super();
this.setEnergies(75, 200, 700, 700);
//this.setCreativeTab(CreativeTabs.tabMisc);
}
@Override
public ItemStack onOffensiveRangedRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer)
{
EnergyItems.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer);
if (par3EntityPlayer.isSneaking())
{
return par1ItemStack;
}
if (!par3EntityPlayer.capabilities.isCreativeMode)
{
EnergyItems.syphonAndDamageWhileInContainer(par1ItemStack, par3EntityPlayer, this.getOffensiveRangedEnergy());
}
par2World.playSoundAtEntity(par3EntityPlayer, "random.fizz", 0.5F, 0.4F / (itemRand.nextFloat() * 0.4F + 0.8F));
if (!par2World.isRemote)
{
//par2World.spawnEntityInWorld(new EnergyBlastProjectile(par2World, par3EntityPlayer, damage));
par2World.spawnEntityInWorld(new LightningBoltProjectile(par2World, par3EntityPlayer, 8, false));
}
return par1ItemStack;
}
@Override
public ItemStack onOffensiveMeleeRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer)
{
//TODO Make it work better...?
EnergyItems.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer);
if (par3EntityPlayer.isSneaking())
{
return par1ItemStack;
}
if (!par3EntityPlayer.capabilities.isCreativeMode)
{
EnergyItems.syphonAndDamageWhileInContainer(par1ItemStack, par3EntityPlayer, this.getOffensiveMeleeEnergy());
}
double xCoord = par3EntityPlayer.posX;
double yCoord = par3EntityPlayer.posY;
double zCoord = par3EntityPlayer.posZ;
par2World.getWorldInfo().setRaining(true);
//par2World.setRainStrength(1.0F);
par2World.setRainStrength(1.0f);
par2World.setThunderStrength(1.0f);
par2World.getWorldInfo().setThunderTime(0);
par2World.getWorldInfo().setThundering(true);
for (int i = 0; i < 5; i++)
{
//PacketDispatcher.sendPacketToAllAround(xCoord, yCoord, zCoord, 30, par2World.provider.dimensionId, PacketHandler.getCustomParticlePacket("mobSpell", xCoord + itemRand.nextFloat() - itemRand.nextFloat(), yCoord + itemRand.nextFloat() - itemRand.nextFloat(), zCoord + itemRand.nextFloat() - itemRand.nextFloat(), 1.0F, 1.0F, 1.0F));
SpellHelper.sendParticleToAllAround(par2World, xCoord, yCoord, zCoord, 30, par2World.provider.dimensionId, "mobSpell", xCoord + itemRand.nextFloat() - itemRand.nextFloat(), yCoord + itemRand.nextFloat() - itemRand.nextFloat(), zCoord + itemRand.nextFloat() - itemRand.nextFloat(), 1.0F, 1.0F, 1.0F);
}
return par1ItemStack;
}
@Override
public ItemStack onDefensiveRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer)
{
EnergyItems.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer);
if (par3EntityPlayer.isSneaking())
{
return par1ItemStack;
}
if (!par3EntityPlayer.capabilities.isCreativeMode)
{
EnergyItems.syphonAndDamageWhileInContainer(par1ItemStack, par3EntityPlayer, this.getDefensiveEnergy());
}
double xCoord = par3EntityPlayer.posX;
double yCoord = par3EntityPlayer.posY;
double zCoord = par3EntityPlayer.posZ;
for (int i = 0; i < 5; i++)
{
par2World.addWeatherEffect(new EntityLightningBolt(par2World, xCoord + itemRand.nextInt(64) - 32, yCoord + itemRand.nextInt(8) - 8, zCoord + itemRand.nextInt(64) - 32));
}
for (int i = 0; i < 8; i++)
{
SpellHelper.sendParticleToAllAround(par2World, xCoord, yCoord, zCoord, 30, par2World.provider.dimensionId, "mobSpell", xCoord + itemRand.nextFloat() - itemRand.nextFloat(), yCoord + itemRand.nextFloat() - itemRand.nextFloat(), zCoord + itemRand.nextFloat() - itemRand.nextFloat(), 1.0F, 1.0F, 1.0F);
}
return par1ItemStack;
}
@Override
public ItemStack onEnvironmentalRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer)
{
EnergyItems.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer);
if (par3EntityPlayer.isSneaking())
{
return par1ItemStack;
}
if (!par3EntityPlayer.capabilities.isCreativeMode)
{
EnergyItems.syphonAndDamageWhileInContainer(par1ItemStack, par3EntityPlayer, this.getEnvironmentalEnergy());
}
if (!par2World.isRemote)
{
//par2World.spawnEntityInWorld(new EnergyBlastProjectile(par2World, par3EntityPlayer, damage));
par2World.spawnEntityInWorld(new LightningBoltProjectile(par2World, par3EntityPlayer, 8, true));
}
return par1ItemStack;
}
}

View file

@ -0,0 +1,289 @@
package WayofTime.alchemicalWizardry.common.spell.simple;
import java.util.Iterator;
import java.util.List;
import java.util.Random;
import net.minecraft.block.Block;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.monster.EntityEnderman;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.item.ItemStack;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.MathHelper;
import net.minecraft.world.World;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.event.entity.living.EnderTeleportEvent;
import WayofTime.alchemicalWizardry.common.PacketHandler;
import WayofTime.alchemicalWizardry.common.entity.projectile.TeleportProjectile;
import WayofTime.alchemicalWizardry.common.items.EnergyItems;
import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper;
public class SpellTeleport extends HomSpell
{
Random itemRand = new Random();
public SpellTeleport()
{
super();
this.setEnergies(500, 300, 500, 1000);
//this.setCreativeTab(CreativeTabs.tabMisc);
}
@Override
public ItemStack onOffensiveRangedRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer)
{
EnergyItems.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer);
if (par3EntityPlayer.isSneaking())
{
return par1ItemStack;
}
if (!par3EntityPlayer.capabilities.isCreativeMode)
{
EnergyItems.syphonAndDamageWhileInContainer(par1ItemStack, par3EntityPlayer, this.getOffensiveRangedEnergy());
}
par2World.spawnEntityInWorld(new TeleportProjectile(par2World, par3EntityPlayer, 8, true));
par2World.playSoundAtEntity(par3EntityPlayer, "random.fizz", 0.5F, 0.4F / (itemRand.nextFloat() * 0.4F + 0.8F));
EntityEnderman g;
return par1ItemStack;
}
@Override
public ItemStack onOffensiveMeleeRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer)
{
EnergyItems.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer);
if (par3EntityPlayer.isSneaking())
{
return par1ItemStack;
}
if (!par3EntityPlayer.capabilities.isCreativeMode)
{
EnergyItems.syphonAndDamageWhileInContainer(par1ItemStack, par3EntityPlayer, this.getOffensiveMeleeEnergy());
}
par2World.spawnEntityInWorld(new TeleportProjectile(par2World, par3EntityPlayer, 8, false));
return par1ItemStack;
}
@Override
public ItemStack onDefensiveRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer)
{
EnergyItems.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer);
if (par3EntityPlayer.isSneaking())
{
return par1ItemStack;
}
if (!par3EntityPlayer.capabilities.isCreativeMode)
{
EnergyItems.syphonAndDamageWhileInContainer(par1ItemStack, par3EntityPlayer, this.getDefensiveEnergy());
}
double xCoord = par3EntityPlayer.posX;
double yCoord = par3EntityPlayer.posY;
double zCoord = par3EntityPlayer.posZ;
SpellTeleport.teleportRandomly(par3EntityPlayer, 128);
for (int i = 0; i < 20; i++)
{
//PacketDispatcher.sendPacketToAllAround(xCoord, yCoord, zCoord, 30, par2World.provider.dimensionId, PacketHandler.getCustomParticlePacket("portal", xCoord + (itemRand.nextFloat() - itemRand.nextFloat()) * 2, yCoord + (itemRand.nextFloat() - itemRand.nextFloat()) * 2, zCoord + (itemRand.nextFloat() - itemRand.nextFloat()) * 2, itemRand.nextFloat(), itemRand.nextFloat(), itemRand.nextFloat()));
SpellHelper.sendParticleToAllAround(par2World, xCoord, yCoord, zCoord, 30, par2World.provider.dimensionId, "portal", xCoord + (itemRand.nextFloat() - itemRand.nextFloat()) * 2, yCoord + (itemRand.nextFloat() - itemRand.nextFloat()) * 2, zCoord + (itemRand.nextFloat() - itemRand.nextFloat()) * 2, itemRand.nextFloat(), itemRand.nextFloat(), itemRand.nextFloat());
}
return par1ItemStack;
}
@Override
public ItemStack onEnvironmentalRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer)
{
EnergyItems.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer);
if (par3EntityPlayer.isSneaking())
{
return par1ItemStack;
}
if (!par3EntityPlayer.capabilities.isCreativeMode)
{
EnergyItems.syphonAndDamageWhileInContainer(par1ItemStack, par3EntityPlayer, this.getEnvironmentalEnergy());
}
if (!par2World.isRemote)
{
int d0 = 3;
AxisAlignedBB axisalignedbb = AxisAlignedBB.getBoundingBox((double) par3EntityPlayer.posX, (double) par3EntityPlayer.posY, (double) par3EntityPlayer.posZ, (double) (par3EntityPlayer.posX + 1), (double) (par3EntityPlayer.posY + 2), (double) (par3EntityPlayer.posZ + 1)).expand(d0, d0, d0);
//axisalignedbb.maxY = (double)this.worldObj.getHeight();
List list = par3EntityPlayer.worldObj.getEntitiesWithinAABB(EntityLivingBase.class, axisalignedbb);
Iterator iterator = list.iterator();
while (iterator.hasNext())
{
EntityLivingBase entityLiving = (EntityLivingBase) iterator.next();
if (entityLiving instanceof EntityPlayer)
{
if (entityLiving.equals(par3EntityPlayer))
{
continue;
}
}
SpellTeleport.teleportRandomly(entityLiving, 128);
//entityLiving.attackEntityFrom(DamageSource.inFire, 5);
}
}
double xCoord = par3EntityPlayer.posX;
double yCoord = par3EntityPlayer.posY;
double zCoord = par3EntityPlayer.posZ;
for (int i = 0; i < 32; i++)
{
SpellHelper.sendParticleToAllAround(par2World, xCoord, yCoord, zCoord, 30, par2World.provider.dimensionId, "portal", xCoord + (itemRand.nextFloat() - itemRand.nextFloat()) * 2, yCoord + (itemRand.nextFloat() - itemRand.nextFloat()) * 2, zCoord + (itemRand.nextFloat() - itemRand.nextFloat()) * 2, itemRand.nextFloat(), itemRand.nextFloat(), itemRand.nextFloat());
}
return par1ItemStack;
}
public static boolean teleportRandomly(EntityLivingBase entityLiving, double distance)
{
double x = entityLiving.posX;
double y = entityLiving.posY;
double z = entityLiving.posZ;
Random rand = new Random();
double d0 = x + (rand.nextDouble() - 0.5D) * distance;
double d1 = y + (double) (rand.nextInt((int) distance) - (distance) / 2);
double d2 = z + (rand.nextDouble() - 0.5D) * distance;
int i = 0;
while (!SpellTeleport.teleportTo(entityLiving, d0, d1, d2, x, y, z) && i < 100)
{
d0 = x + (rand.nextDouble() - 0.5D) * distance;
d1 = y + (double) (rand.nextInt((int) distance) - (distance) / 2);
d2 = z + (rand.nextDouble() - 0.5D) * distance;
i++;
}
if (i >= 100)
{
return false;
}
return true;
//return SpellTeleport.teleportTo(entityLiving, d0, d1, d2,x,y,z);
}
private static boolean teleportTo(EntityLivingBase entityLiving, double par1, double par3, double par5, double lastX, double lastY, double lastZ)
{
EnderTeleportEvent event = new EnderTeleportEvent(entityLiving, par1, par3, par5, 0);
if (MinecraftForge.EVENT_BUS.post(event))
{
return false;
}
double d3 = lastX;
double d4 = lastY;
double d5 = lastZ;
SpellTeleport.moveEntityViaTeleport(entityLiving, event.targetX, event.targetY, event.targetZ);
boolean flag = false;
int i = MathHelper.floor_double(entityLiving.posX);
int j = MathHelper.floor_double(entityLiving.posY);
int k = MathHelper.floor_double(entityLiving.posZ);
Block l;
if (entityLiving.worldObj.blockExists(i, j, k))
{
boolean flag1 = false;
while (!flag1 && j > 0)
{
l = entityLiving.worldObj.getBlock(i, j - 1, k);
if (l != null && l.getMaterial().blocksMovement())
{
flag1 = true;
} else
{
--entityLiving.posY;
--j;
}
}
if (flag1)
{
SpellTeleport.moveEntityViaTeleport(entityLiving, entityLiving.posX, entityLiving.posY, entityLiving.posZ);
if (entityLiving.worldObj.getCollidingBoundingBoxes(entityLiving, entityLiving.boundingBox).isEmpty() && !entityLiving.worldObj.isAnyLiquid(entityLiving.boundingBox))
{
flag = true;
}
}
}
if (!flag)
{
SpellTeleport.moveEntityViaTeleport(entityLiving, d3, d4, d5);
return false;
} else
{
short short1 = 128;
for (j = 0; j < short1; ++j)
{
double d6 = (double) j / ((double) short1 - 1.0D);
float f = (entityLiving.worldObj.rand.nextFloat() - 0.5F) * 0.2F;
float f1 = (entityLiving.worldObj.rand.nextFloat() - 0.5F) * 0.2F;
float f2 = (entityLiving.worldObj.rand.nextFloat() - 0.5F) * 0.2F;
double d7 = d3 + (entityLiving.posX - d3) * d6 + (entityLiving.worldObj.rand.nextDouble() - 0.5D) * (double) entityLiving.width * 2.0D;
double d8 = d4 + (entityLiving.posY - d4) * d6 + entityLiving.worldObj.rand.nextDouble() * (double) entityLiving.height;
double d9 = d5 + (entityLiving.posZ - d5) * d6 + (entityLiving.worldObj.rand.nextDouble() - 0.5D) * (double) entityLiving.width * 2.0D;
entityLiving.worldObj.spawnParticle("portal", d7, d8, d9, (double) f, (double) f1, (double) f2);
}
// this.worldObj.playSoundEffect(d3, d4, d5, "mob.endermen.portal", 1.0F, 1.0F);
// this.playSound("mob.endermen.portal", 1.0F, 1.0F);
return true;
}
}
public static void moveEntityViaTeleport(EntityLivingBase entityLiving, double x, double y, double z)
{
if (entityLiving instanceof EntityPlayer)
{
if (entityLiving != null && entityLiving instanceof EntityPlayerMP)
{
EntityPlayerMP entityplayermp = (EntityPlayerMP) entityLiving;
//if (!entityplayermp.playerNetServerHandler.connectionClosed && entityplayermp.worldObj == entityLiving.worldObj)
if (entityplayermp.worldObj == entityLiving.worldObj)
{
EnderTeleportEvent event = new EnderTeleportEvent(entityplayermp, x, y, z, 5.0F);
if (!MinecraftForge.EVENT_BUS.post(event))
{
if (entityLiving.isRiding())
{
entityLiving.mountEntity((Entity) null);
}
entityLiving.setPositionAndUpdate(event.targetX, event.targetY, event.targetZ);
// this.getThrower().fallDistance = 0.0F;
// this.getThrower().attackEntityFrom(DamageSource.fall, event.attackDamage);
}
}
}
} else if (entityLiving != null)
{
entityLiving.setPosition(x, y, z);
}
}
}

View file

@ -0,0 +1,180 @@
package WayofTime.alchemicalWizardry.common.spell.simple;
import java.util.Iterator;
import java.util.List;
import java.util.Random;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Blocks;
import net.minecraft.item.ItemStack;
import net.minecraft.potion.PotionEffect;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.DamageSource;
import net.minecraft.world.World;
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
import WayofTime.alchemicalWizardry.common.PacketHandler;
import WayofTime.alchemicalWizardry.common.entity.projectile.WaterProjectile;
import WayofTime.alchemicalWizardry.common.items.EnergyItems;
import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper;
public class SpellWateryGrave extends HomSpell
{
Random itemRand = new Random();
public SpellWateryGrave()
{
super();
this.setEnergies(250, 350, 500, 750);
//this.setCreativeTab(CreativeTabs.tabMisc);
}
@Override
public ItemStack onOffensiveRangedRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer)
{
EnergyItems.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer);
if (par3EntityPlayer.isSneaking())
{
return par1ItemStack;
}
if (!par3EntityPlayer.capabilities.isCreativeMode)
{
EnergyItems.syphonAndDamageWhileInContainer(par1ItemStack, par3EntityPlayer, this.getOffensiveRangedEnergy());
}
par2World.spawnEntityInWorld(new WaterProjectile(par2World, par3EntityPlayer, 8));
par2World.playSoundAtEntity(par3EntityPlayer, "random.fizz", 0.5F, 0.4F / (itemRand.nextFloat() * 0.4F + 0.8F));
return par1ItemStack;
}
@Override
public ItemStack onOffensiveMeleeRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer)
{
EnergyItems.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer);
if (par3EntityPlayer.isSneaking())
{
return par1ItemStack;
}
if (!par3EntityPlayer.capabilities.isCreativeMode)
{
EnergyItems.syphonAndDamageWhileInContainer(par1ItemStack, par3EntityPlayer, this.getOffensiveMeleeEnergy());
}
if (!par2World.isRemote)
{
for (int i = -1; i <= 1; i++)
{
for (int j = -1; j <= 1; j++)
{
par2World.spawnEntityInWorld(new WaterProjectile(par2World, par3EntityPlayer, 3, 3, par3EntityPlayer.posX, par3EntityPlayer.posY + par3EntityPlayer.getEyeHeight(), par3EntityPlayer.posZ, par3EntityPlayer.rotationYaw + i * 10F, par3EntityPlayer.rotationPitch + j * 5F));
}
}
}
return par1ItemStack;
}
@Override
public ItemStack onDefensiveRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer)
{
EnergyItems.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer);
if (par3EntityPlayer.isSneaking())
{
return par1ItemStack;
}
if (!par3EntityPlayer.capabilities.isCreativeMode)
{
EnergyItems.syphonAndDamageWhileInContainer(par1ItemStack, par3EntityPlayer, this.getDefensiveEnergy());
}
int d0 = 3;
AxisAlignedBB axisalignedbb = AxisAlignedBB.getBoundingBox((double) par3EntityPlayer.posX, (double) par3EntityPlayer.posY, (double) par3EntityPlayer.posZ, (double) (par3EntityPlayer.posX + 1), (double) (par3EntityPlayer.posY + 2), (double) (par3EntityPlayer.posZ + 1)).expand(d0, d0, d0);
//axisalignedbb.maxY = (double)this.worldObj.getHeight();
List list = par3EntityPlayer.worldObj.getEntitiesWithinAABB(EntityLivingBase.class, axisalignedbb);
Iterator iterator = list.iterator();
while (iterator.hasNext())
{
EntityLivingBase entityLiving = (EntityLivingBase) iterator.next();
if (entityLiving instanceof EntityPlayer)
{
if (entityLiving.equals(par3EntityPlayer))
{
continue;
}
}
int x = 1;
if (entityLiving.isImmuneToFire())
{
x = 2;
}
entityLiving.attackEntityFrom(DamageSource.drown, 2 * x);
entityLiving.addPotionEffect(new PotionEffect(AlchemicalWizardry.customPotionDrowning.id, 100, x - 1));
}
double xCoord = par3EntityPlayer.posX;
double yCoord = par3EntityPlayer.posY;
double zCoord = par3EntityPlayer.posZ;
for (int i = 0; i < 20; i++)
{
//PacketDispatcher.sendPacketToAllAround(xCoord, yCoord, zCoord, 30, par2World.provider.dimensionId, PacketHandler.getCustomParticlePacket("mobSpell", xCoord + (itemRand.nextFloat() - itemRand.nextFloat()) * 3, yCoord + (itemRand.nextFloat() - itemRand.nextFloat()) * 3, zCoord + (itemRand.nextFloat() - itemRand.nextFloat()) * 3, 0.0F, 0.410F, 1.0F));
SpellHelper.sendParticleToAllAround(par2World, xCoord, yCoord, zCoord, 30, par2World.provider.dimensionId, "mobSpell", xCoord + (itemRand.nextFloat() - itemRand.nextFloat()) * 3, yCoord + (itemRand.nextFloat() - itemRand.nextFloat()) * 3, zCoord + (itemRand.nextFloat() - itemRand.nextFloat()) * 3, 0.0F, 0.410F, 1.0F);
}
return par1ItemStack;
}
@Override
public ItemStack onEnvironmentalRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer)
{
EnergyItems.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer);
if (par3EntityPlayer.isSneaking())
{
return par1ItemStack;
}
if (!par3EntityPlayer.capabilities.isCreativeMode)
{
EnergyItems.syphonAndDamageWhileInContainer(par1ItemStack, par3EntityPlayer, this.getEnvironmentalEnergy());
}
int range = 2;
if (!par2World.isRemote)
{
for (int i = -range; i <= range; i++)
{
for (int j = -range; j <= range; j++)
{
if (par2World.isAirBlock((int) par3EntityPlayer.posX + i, (int) par3EntityPlayer.posY, (int) par3EntityPlayer.posZ + j))
{
par2World.setBlock((int) par3EntityPlayer.posX + i, (int) par3EntityPlayer.posY, (int) par3EntityPlayer.posZ + j, Blocks.water);
}
}
}
}
double xCoord = par3EntityPlayer.posX;
double yCoord = par3EntityPlayer.posY;
double zCoord = par3EntityPlayer.posZ;
for (int i = 0; i < 16; i++)
{
SpellHelper.sendParticleToAllAround(par2World, xCoord, yCoord, zCoord, 30, par2World.provider.dimensionId, "mobSpell", xCoord + (itemRand.nextFloat() - itemRand.nextFloat()) * 3, yCoord + (itemRand.nextFloat() - itemRand.nextFloat()) * 3, zCoord + (itemRand.nextFloat() - itemRand.nextFloat()) * 3, 0.0F, 0.410F, 1.0F);
}
return par1ItemStack;
}
}

View file

@ -0,0 +1,219 @@
package WayofTime.alchemicalWizardry.common.spell.simple;
import ibxm.Player;
import java.util.Iterator;
import java.util.List;
import java.util.Random;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.Vec3;
import net.minecraft.world.World;
import WayofTime.alchemicalWizardry.common.PacketHandler;
import WayofTime.alchemicalWizardry.common.entity.projectile.WindGustProjectile;
import WayofTime.alchemicalWizardry.common.items.EnergyItems;
import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper;
public class SpellWindGust extends HomSpell
{
Random itemRand = new Random();
public SpellWindGust()
{
super();
this.setEnergies(300, 400, 300, 500);
//this.setCreativeTab(CreativeTabs.tabMisc);
}
@Override
public ItemStack onOffensiveRangedRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer)
{
EnergyItems.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer);
if (par3EntityPlayer.isSneaking())
{
return par1ItemStack;
}
if (!par3EntityPlayer.capabilities.isCreativeMode)
{
EnergyItems.syphonAndDamageWhileInContainer(par1ItemStack, par3EntityPlayer, this.getOffensiveRangedEnergy());
}
par2World.playSoundAtEntity(par3EntityPlayer, "random.fizz", 0.5F, 0.4F / (itemRand.nextFloat() * 0.4F + 0.8F));
if (!par2World.isRemote)
{
//par2World.spawnEntityInWorld(new EnergyBlastProjectile(par2World, par3EntityPlayer, damage));
par2World.spawnEntityInWorld(new WindGustProjectile(par2World, par3EntityPlayer, 8));
}
return par1ItemStack;
}
@Override
public ItemStack onOffensiveMeleeRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer)
{
EnergyItems.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer);
if (par3EntityPlayer.isSneaking())
{
return par1ItemStack;
}
if (!par3EntityPlayer.capabilities.isCreativeMode)
{
EnergyItems.syphonAndDamageWhileInContainer(par1ItemStack, par3EntityPlayer, this.getOffensiveMeleeEnergy());
}
int distance = 3;
double yaw = par3EntityPlayer.rotationYaw / 180 * Math.PI;
double pitch = par3EntityPlayer.rotationPitch / 180 * Math.PI;
double xCoord = par3EntityPlayer.posX + Math.sin(yaw) * Math.cos(pitch) * (-distance);
double yCoord = par3EntityPlayer.posY + par3EntityPlayer.getEyeHeight() + Math.sin(-pitch) * distance;
double zCoord = par3EntityPlayer.posZ + Math.cos(yaw) * Math.cos(pitch) * distance;
float d0 = 0.5f;
AxisAlignedBB axisalignedbb = AxisAlignedBB.getBoundingBox(par3EntityPlayer.posX - 0.5 + Math.sin(yaw) * Math.cos(pitch) * (-distance), par3EntityPlayer.posY + par3EntityPlayer.getEyeHeight() + Math.sin(-pitch) * distance, par3EntityPlayer.posZ - 0.5 + Math.cos(yaw) * Math.cos(pitch) * distance, par3EntityPlayer.posX + Math.sin(yaw) * Math.cos(pitch) * (-distance) + 0.5, par3EntityPlayer.posY + par3EntityPlayer.getEyeHeight() + Math.sin(-pitch) * distance + 1, par3EntityPlayer.posZ + Math.cos(yaw) * Math.cos(pitch) * distance + 0.5).expand(d0, d0, d0);
//axisalignedbb.maxY = (double)this.worldObj.getHeight();
List list = par3EntityPlayer.worldObj.getEntitiesWithinAABB(EntityLivingBase.class, axisalignedbb);
Iterator iterator = list.iterator();
while (iterator.hasNext())
{
EntityLivingBase entityLiving = (EntityLivingBase) iterator.next();
if (entityLiving instanceof EntityPlayer)
{
if (entityLiving.equals(par3EntityPlayer))
{
continue;
}
}
//entityLiving.setFire(50);
//entityLiving.attackEntityFrom(DamageSource.causePlayerDamage(par3EntityPlayer), 5*i);
//entityLiving.setVelocity(Math.sin(-yaw)*2, 2, Math.cos(yaw)*2);
entityLiving.motionX = Math.sin(-yaw) * 2;
entityLiving.motionY = 2;
entityLiving.motionZ = Math.cos(yaw) * 2;
//par2World.createExplosion(par3EntityPlayer, par3EntityPlayer.posX, par3EntityPlayer.posY, par3EntityPlayer.posZ, (float)(2), false);
}
//par2World.createExplosion(par3EntityPlayer, xCoord, yCoord, zCoord, (float)(1), false);
for (int i = 0; i < 5; i++)
{
SpellHelper.sendParticleToAllAround(par2World, xCoord, yCoord, zCoord, 30, par2World.provider.dimensionId, "mobSpell", xCoord + (itemRand.nextFloat() - itemRand.nextFloat()) * 3, yCoord + (itemRand.nextFloat() - itemRand.nextFloat()) * 3, zCoord + (itemRand.nextFloat() - itemRand.nextFloat()) * 3, 0.0F, 0.410F, 1.0F);
}
return par1ItemStack;
}
@Override
public ItemStack onDefensiveRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer)
{
EnergyItems.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer);
if (par3EntityPlayer.isSneaking())
{
return par1ItemStack;
}
if (!par3EntityPlayer.capabilities.isCreativeMode)
{
EnergyItems.syphonAndDamageWhileInContainer(par1ItemStack, par3EntityPlayer, this.getDefensiveEnergy());
}
int distance = 3;
double yaw = par3EntityPlayer.rotationYaw / 180 * Math.PI;
double pitch = par3EntityPlayer.rotationPitch / 180 * Math.PI;
double wantedVelocity = 5;
double xVel = Math.sin(yaw) * Math.cos(pitch) * (-wantedVelocity);
double yVel = Math.sin(-pitch) * wantedVelocity;
double zVel = Math.cos(yaw) * Math.cos(pitch) * wantedVelocity;
Vec3 vec = par3EntityPlayer.getLookVec();
par3EntityPlayer.motionX = vec.xCoord * wantedVelocity;
par3EntityPlayer.motionY = vec.yCoord * wantedVelocity;
par3EntityPlayer.motionZ = vec.zCoord * wantedVelocity;
//PacketDispatcher.sendPacketToPlayer(PacketHandler.getPlayerVelocitySettingPacket(xVel, yVel, zVel), (Player) par3EntityPlayer);
SpellHelper.setPlayerSpeedFromServer(par3EntityPlayer, xVel, yVel, zVel);
par2World.playSoundEffect((double) ((float) par3EntityPlayer.posX + 0.5F), (double) ((float) par3EntityPlayer.posY + 0.5F), (double) ((float) par3EntityPlayer.posZ + 0.5F), "random.fizz", 0.5F, 2.6F + (par2World.rand.nextFloat() - par2World.rand.nextFloat()) * 0.8F);
par3EntityPlayer.fallDistance = 0;
//par2World.createExplosion(par3EntityPlayer, par3EntityPlayer.posX, par3EntityPlayer.posY, par3EntityPlayer.posZ, (float)(2), false);
double xCoord = par3EntityPlayer.posX;
double yCoord = par3EntityPlayer.posY;
double zCoord = par3EntityPlayer.posZ;
for (int i = 0; i < 8; i++)
{
SpellHelper.sendParticleToAllAround(par2World, xCoord, yCoord, zCoord, 30, par2World.provider.dimensionId, "mobSpell", xCoord + (itemRand.nextFloat() - itemRand.nextFloat()) * 3, yCoord + (itemRand.nextFloat() - itemRand.nextFloat()) * 3, zCoord + (itemRand.nextFloat() - itemRand.nextFloat()) * 3, 0.0F, 0.410F, 1.0F);
}
return par1ItemStack;
}
@Override
public ItemStack onEnvironmentalRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer)
{
EnergyItems.checkAndSetItemOwner(par1ItemStack, par3EntityPlayer);
if (par3EntityPlayer.isSneaking())
{
return par1ItemStack;
}
if (!par3EntityPlayer.capabilities.isCreativeMode)
{
EnergyItems.syphonAndDamageWhileInContainer(par1ItemStack, par3EntityPlayer, this.getEnvironmentalEnergy());
}
int d0 = 3;
AxisAlignedBB axisalignedbb = AxisAlignedBB.getBoundingBox((double) par3EntityPlayer.posX, (double) par3EntityPlayer.posY, (double) par3EntityPlayer.posZ, (double) (par3EntityPlayer.posX + 1), (double) (par3EntityPlayer.posY + 2), (double) (par3EntityPlayer.posZ + 1)).expand(d0, d0, d0);
//axisalignedbb.maxY = (double)this.worldObj.getHeight();
List list = par3EntityPlayer.worldObj.getEntitiesWithinAABB(EntityLivingBase.class, axisalignedbb);
Iterator iterator = list.iterator();
double xCoord = par3EntityPlayer.posX;
double yCoord = par3EntityPlayer.posY;
double zCoord = par3EntityPlayer.posZ;
double wantedVel = 2;
while (iterator.hasNext())
{
EntityLivingBase entityLiving = (EntityLivingBase) iterator.next();
if (entityLiving instanceof EntityPlayer)
{
if (entityLiving.equals(par3EntityPlayer))
{
continue;
}
}
double posXDif = entityLiving.posX - par3EntityPlayer.posX;
double posYDif = entityLiving.posY - par3EntityPlayer.posY + 1;
double posZDif = entityLiving.posZ - par3EntityPlayer.posZ;
double distance2 = Math.pow(posXDif, 2) + Math.pow(posYDif, 2) + Math.pow(posZDif, 2);
double distance = Math.sqrt(distance2);
//entityLiving.setVelocity(posXDif*wantedVel/distance, posYDif*wantedVel/distance, posZDif*wantedVel/distance);
entityLiving.motionX = posXDif * wantedVel / distance;
entityLiving.motionY = posYDif * wantedVel / distance;
entityLiving.motionZ = posZDif * wantedVel / distance;
//entityLiving.setFire(50);
//entityLiving.attackEntityFrom(DamageSource.causePlayerDamage(par3EntityPlayer), 5*i);
//par2World.createExplosion(par3EntityPlayer, par3EntityPlayer.posX, par3EntityPlayer.posY, par3EntityPlayer.posZ, (float)(2), false);
}
//par2World.createExplosion(par3EntityPlayer, par3EntityPlayer.posX, par3EntityPlayer.posY, par3EntityPlayer.posZ, (float)(2), false);
for (int i = 0; i < 20; i++)
{
SpellHelper.sendParticleToAllAround(par2World, xCoord, yCoord, zCoord, 30, par2World.provider.dimensionId, "mobSpell", xCoord + (itemRand.nextFloat() - itemRand.nextFloat()) * 3, yCoord + (itemRand.nextFloat() - itemRand.nextFloat()) * 3, zCoord + (itemRand.nextFloat() - itemRand.nextFloat()) * 3, 0.0F, 0.410F, 1.0F);
}
return par1ItemStack;
}
}