1.7.2 commit

This commit is contained in:
WayofTime 2014-02-14 15:20:20 -05:00
parent 92e097eaa2
commit 9aaa65feb4
548 changed files with 46982 additions and 2 deletions

View file

@ -0,0 +1,611 @@
package WayofTime.alchemicalWizardry.common.spell.complex;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
import net.minecraft.block.Block;
import net.minecraft.entity.Entity;
import net.minecraft.entity.IProjectile;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.DamageSource;
import net.minecraft.util.MathHelper;
import net.minecraft.util.MovingObjectPosition;
import net.minecraft.util.Vec3;
import net.minecraft.world.World;
import net.minecraftforge.common.util.Constants;
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;
public class EntitySpellProjectile extends Entity implements IProjectile
{
private int xTile = -1;
private int yTile = -1;
private int zTile = -1;
private int inTile = 0;
private int inData = 0;
private boolean inGround = false;
/** The owner of this arrow. */
public EntityPlayer shootingEntity;
private int ticksInAir = 0;
private int ricochetCounter = 0;
private boolean scheduledForDeath = false;
//Custom variables
private int maxRicochet = 0;
private float damage = 1;
public List<IProjectileImpactEffect> impactList = new ArrayList();
private boolean penetration = false;
public List<IProjectileUpdateEffect> updateEffectList = new ArrayList();
public List<SpellEffect> spellEffectList = new LinkedList();
private int blocksBroken = 0;
public EntitySpellProjectile(World par1World)
{
super(par1World);
this.setSize(0.5F, 0.5F);
}
public EntitySpellProjectile(World par1World, double par2, double par4, double par6)
{
super(par1World);
this.setSize(0.5F, 0.5F);
this.setPosition(par2, par4, par6);
yOffset = 0.0F;
}
public EntitySpellProjectile(World par1World, EntityPlayer par2EntityPlayer)
{
super(par1World);
shootingEntity = par2EntityPlayer;
float par3 = 0.8F;
this.setSize(0.1F, 0.1F);
this.setLocationAndAngles(par2EntityPlayer.posX, par2EntityPlayer.posY + par2EntityPlayer.getEyeHeight(), par2EntityPlayer.posZ, par2EntityPlayer.rotationYaw, par2EntityPlayer.rotationPitch);
posX -= MathHelper.cos(rotationYaw / 180.0F * (float)Math.PI) * 0.16F;
posY -= 0.2D;
posZ -= MathHelper.sin(rotationYaw / 180.0F * (float)Math.PI) * 0.16F;
this.setPosition(posX, posY, posZ);
yOffset = 0.0F;
motionX = -MathHelper.sin(rotationYaw / 180.0F * (float)Math.PI) * MathHelper.cos(rotationPitch / 180.0F * (float)Math.PI);
motionZ = MathHelper.cos(rotationYaw / 180.0F * (float)Math.PI) * MathHelper.cos(rotationPitch / 180.0F * (float)Math.PI);
motionY = -MathHelper.sin(rotationPitch / 180.0F * (float)Math.PI);
this.setThrowableHeading(motionX, motionY, motionZ, par3 * 1.5F, 1.0F);
}
@Override
protected void entityInit() {
dataWatcher.addObject(16, Byte.valueOf((byte)0));
}
/**
* Similar to setArrowHeading, it's point the throwable entity to a x, y, z
* direction.
*/
@Override
public void setThrowableHeading(double var1, double var3, double var5, float var7, float var8) {
float var9 = MathHelper.sqrt_double(var1 * var1 + var3 * var3 + var5 * var5);
var1 /= var9;
var3 /= var9;
var5 /= var9;
var1 += rand.nextGaussian() * 0.007499999832361937D * var8;
var3 += rand.nextGaussian() * 0.007499999832361937D * var8;
var5 += rand.nextGaussian() * 0.007499999832361937D * var8;
var1 *= var7;
var3 *= var7;
var5 *= var7;
motionX = var1;
motionY = var3;
motionZ = var5;
float var10 = MathHelper.sqrt_double(var1 * var1 + var5 * var5);
prevRotationYaw = rotationYaw = (float)(Math.atan2(var1, var5) * 180.0D / Math.PI);
prevRotationPitch = rotationPitch = (float)(Math.atan2(var3, var10) * 180.0D / Math.PI);
}
@Override
@SideOnly(Side.CLIENT)
/**
* Sets the position and rotation. Only difference from the other one is no bounding on the rotation. Args: posX,
* posY, posZ, yaw, pitch
*/
public void setPositionAndRotation2(double par1, double par3, double par5, float par7, float par8, int par9) {
this.setPosition(par1, par3, par5);
this.setRotation(par7, par8);
}
@Override
@SideOnly(Side.CLIENT)
/**
* Sets the velocity to the args. Args: x, y, z
*/
public void setVelocity(double par1, double par3, double par5) {
motionX = par1;
motionY = par3;
motionZ = par5;
if (prevRotationPitch == 0.0F && prevRotationYaw == 0.0F) {
float var7 = MathHelper.sqrt_double(par1 * par1 + par5 * par5);
prevRotationYaw = rotationYaw = (float)(Math.atan2(par1, par5) * 180.0D / Math.PI);
prevRotationPitch = rotationPitch = (float)(Math.atan2(par3, var7) * 180.0D / Math.PI);
prevRotationPitch = rotationPitch;
prevRotationYaw = rotationYaw;
this.setLocationAndAngles(posX, posY, posZ, rotationYaw, rotationPitch);
}
}
/**
* Called to update the entity's position/logic.
*/
@Override
public void onUpdate()
{
super.onUpdate();
this.performUpdateEffects();
if (ticksInAir > 600) {
this.setDead();
}
if (shootingEntity == null) {
List players = worldObj.getEntitiesWithinAABB(EntityPlayer.class, AxisAlignedBB.getBoundingBox(posX - 1, posY - 1, posZ - 1, posX + 1, posY + 1, posZ + 1));
Iterator i = players.iterator();
double closestDistance = Double.MAX_VALUE;
EntityPlayer closestPlayer = null;
while (i.hasNext()) {
EntityPlayer e = (EntityPlayer)i.next();
double distance = e.getDistanceToEntity(this);
if (distance < closestDistance) {
closestPlayer = e;
}
}
if (closestPlayer != null) {
shootingEntity = closestPlayer;
}
}
if (prevRotationPitch == 0.0F && prevRotationYaw == 0.0F) {
float var1 = MathHelper.sqrt_double(motionX * motionX + motionZ * motionZ);
prevRotationYaw = rotationYaw = (float)(Math.atan2(motionX, motionZ) * 180.0D / Math.PI);
prevRotationPitch = rotationPitch = (float)(Math.atan2(motionY, var1) * 180.0D / Math.PI);
}
Block var16 = worldObj.getBlock(xTile, yTile, zTile);
if (var16 != null)
{
var16.setBlockBoundsBasedOnState(worldObj, xTile, yTile, zTile);
AxisAlignedBB var2 = var16.getCollisionBoundingBoxFromPool(worldObj, xTile, yTile, zTile);
if (var2 != null && var2.isVecInside(worldObj.getWorldVec3Pool().getVecFromPool(posX, posY, posZ)))
{
inGround = true;
}
}
if (inGround)
{
Block var18 = worldObj.getBlock(xTile, yTile, zTile);
int var19 = worldObj.getBlockMetadata(xTile, yTile, zTile);
if (var18.equals(Block.getBlockById(inTile)) && var19 == inData)
{
// this.groundImpact();
// this.setDead();
}
} else
{
++ticksInAir;
if (ticksInAir > 1 && ticksInAir < 3)
{
//worldObj.spawnParticle("flame", posX + smallGauss(0.1D), posY + smallGauss(0.1D), posZ + smallGauss(0.1D), 0D, 0D, 0D);
for (int particles = 0; particles < 3; particles++)
{
this.doFiringParticles();
}
}
Vec3 var17 = worldObj.getWorldVec3Pool().getVecFromPool(posX, posY, posZ);
Vec3 var3 = worldObj.getWorldVec3Pool().getVecFromPool(posX + motionX, posY + motionY, posZ + motionZ);
MovingObjectPosition var4 = worldObj.func_147447_a(var17, var3, true, false, true);
var17 = worldObj.getWorldVec3Pool().getVecFromPool(posX, posY, posZ);
var3 = worldObj.getWorldVec3Pool().getVecFromPool(posX + motionX, posY + motionY, posZ + motionZ);
if (var4 != null)
{
var3 = worldObj.getWorldVec3Pool().getVecFromPool(var4.hitVec.xCoord, var4.hitVec.yCoord, var4.hitVec.zCoord);
}
Entity var5 = null;
List var6 = worldObj.getEntitiesWithinAABBExcludingEntity(this, boundingBox.addCoord(motionX, motionY, motionZ).expand(1.0D, 1.0D, 1.0D));
double var7 = 0.0D;
Iterator var9 = var6.iterator();
float var11;
while (var9.hasNext())
{
Entity var10 = (Entity) var9.next();
if (var10.canBeCollidedWith() && (var10 != shootingEntity || ticksInAir >= 5))
{
var11 = 0.3F;
AxisAlignedBB var12 = var10.boundingBox.expand(var11, var11, var11);
MovingObjectPosition var13 = var12.calculateIntercept(var17, var3);
if (var13 != null)
{
double var14 = var17.distanceTo(var13.hitVec);
if (var14 < var7 || var7 == 0.0D)
{
var5 = var10;
var7 = var14;
}
}
}
}
if (var5 != null)
{
var4 = new MovingObjectPosition(var5);
}
if (var4 != null)
{
this.onImpact(var4);
if (scheduledForDeath)
{
this.setDead();
}
}
posX += motionX;
posY += motionY;
posZ += motionZ;
MathHelper.sqrt_double(motionX * motionX + motionZ * motionZ);
this.setPosition(posX, posY, posZ);
//this.doBlockCollisions();
}
}
private void doFlightParticles() {
if (ticksInAir % 3 == 0) {
double gauss = gaussian(1.0F);
worldObj.spawnParticle("mobSpell", posX, posY, posZ, gauss, gauss, 0.0F);
}
}
private void doFiringParticles() {
worldObj.spawnParticle("mobSpellAmbient", posX + smallGauss(0.1D), posY + smallGauss(0.1D), posZ + smallGauss(0.1D), 0.5D, 0.5D, 0.5D);
worldObj.spawnParticle("flame", posX, posY, posZ, gaussian(motionX), gaussian(motionY), gaussian(motionZ));
}
/**
* (abstract) Protected helper method to write subclass entity data to NBT.
*/
@Override
public void writeEntityToNBT(NBTTagCompound par1NBTTagCompound)
{
par1NBTTagCompound.setShort("xTile", (short)xTile);
par1NBTTagCompound.setShort("yTile", (short)yTile);
par1NBTTagCompound.setShort("zTile", (short)zTile);
par1NBTTagCompound.setByte("inTile", (byte)inTile);
par1NBTTagCompound.setByte("inData", (byte)inData);
par1NBTTagCompound.setByte("inGround", (byte)(inGround ? 1 : 0));
NBTTagList effectList = new NBTTagList();
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);
// }
// }
par1NBTTagCompound.setTag("Effects", effectList);
par1NBTTagCompound.setInteger("blocksBroken", blocksBroken);
}
/**
* (abstract) Protected helper method to read subclass entity data from NBT.
*/
@Override
public void readEntityFromNBT(NBTTagCompound par1NBTTagCompound)
{
xTile = par1NBTTagCompound.getShort("xTile");
yTile = par1NBTTagCompound.getShort("yTile");
zTile = par1NBTTagCompound.getShort("zTile");
inTile = par1NBTTagCompound.getByte("inTile") & 255;
inData = par1NBTTagCompound.getByte("inData") & 255;
inGround = par1NBTTagCompound.getByte("inGround") == 1;
blocksBroken = par1NBTTagCompound.getInteger("blocksBroken");
NBTTagList tagList = par1NBTTagCompound.getTagList("Effects",Constants.NBT.TAG_COMPOUND);
List<SpellEffect> spellEffectList = new LinkedList();
for (int i = 0; i < tagList.tagCount(); i++)
{
NBTTagCompound tag = (NBTTagCompound) tagList.getCompoundTagAt(i);
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.getParadigmForEffectArray(spellEffectList);
parad.applyAllSpellEffects();
parad.prepareProjectile(this);
}
/**
* returns if this entity triggers Block.onEntityWalking on the blocks they
* walk on. used for spiders and wolves to prevent them from trampling crops
*/
@Override
protected boolean canTriggerWalking() {
return false;
}
@Override
@SideOnly(Side.CLIENT)
public float getShadowSize() {
return 0.0F;
}
/**
* Sets the amount of knockback the arrow applies when it hits a mob.
*/
public void setKnockbackStrength(int par1) {
}
/**
* If returns false, the item will not inflict any damage against entities.
*/
@Override
public boolean canAttackWithItem() {
return false;
}
/**
* Whether the arrow has a stream of critical hit particles flying behind
* it.
*/
public void setIsCritical(boolean par1) {
byte var2 = dataWatcher.getWatchableObjectByte(16);
if (par1) {
dataWatcher.updateObject(16, Byte.valueOf((byte)(var2 | 1)));
} else {
dataWatcher.updateObject(16, Byte.valueOf((byte)(var2 & -2)));
}
}
/**
* Whether the arrow has a stream of critical hit particles flying behind
* it.
*/
public boolean getIsCritical() {
byte var1 = dataWatcher.getWatchableObjectByte(16);
return (var1 & 1) != 0;
}
private void onImpact(MovingObjectPosition mop)
{
if (mop.typeOfHit == MovingObjectPosition.MovingObjectType.ENTITY && mop.entityHit != null)
{
if (mop.entityHit == shootingEntity) return;
this.onImpact(mop.entityHit);
this.performEntityImpactEffects(mop.entityHit);
}
else if (mop.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK)
{
if(!this.penetration)
{
this.groundImpact(mop.sideHit);
this.performTileImpactEffects(mop);
}
}
}
private void onImpact(Entity mop) //TODO
{
if (mop == shootingEntity && ticksInAir > 3)
{
shootingEntity.attackEntityFrom(DamageSource.causePlayerDamage(shootingEntity), 1);
this.setDead();
}
else
{
doDamage(this.damage, mop);
}
spawnHitParticles("exorcism", 8);
this.setDead();
}
private void spawnHitParticles(String string, int i) {
for (int particles = 0; particles < i; particles++) {
worldObj.spawnParticle("mobSpellAmbient", posX + smallGauss(0.1D), posY + smallGauss(0.1D), posZ + smallGauss(0.1D), posGauss(1.0F), posGauss(1.0F), 0.0F);
}
}
private void doDamage(float f, Entity mop)
{
mop.attackEntityFrom(this.getDamageSource(), f);
}
private DamageSource getDamageSource()
{
return DamageSource.causePlayerDamage(shootingEntity);
}
private void groundImpact(int sideHit) {
this.ricochet(sideHit);
}
private double smallGauss(double d) {
return (worldObj.rand.nextFloat() - 0.5D) * d;
}
private double posGauss(double d) {
return rand.nextFloat() * 0.5D * d;
}
private double gaussian(double d) {
return d + d * ((rand.nextFloat() - 0.5D) / 4);
}
private void ricochet(int sideHit) {
switch (sideHit) {
case 0:
case 1:
// topHit, bottomHit, reflect Y
motionY = motionY * -1;
break;
case 2:
case 3:
// westHit, eastHit, reflect Z
motionZ = motionZ * -1;
break;
case 4:
case 5:
// southHit, northHit, reflect X
motionX = motionX * -1;
break;
}
ricochetCounter++;
if (ricochetCounter > this.getRicochetMax()) {
scheduledForDeath = true;
for (int particles = 0; particles < 4; particles++) {
switch (sideHit) {
case 0:
worldObj.spawnParticle("smoke", posX, posY, posZ, gaussian(0.1D), -gaussian(0.1D), gaussian(0.1D));
break;
case 1:
worldObj.spawnParticle("smoke", posX, posY, posZ, gaussian(0.1D), gaussian(0.1D), gaussian(0.1D));
break;
case 2:
worldObj.spawnParticle("smoke", posX, posY, posZ, gaussian(0.1D), gaussian(0.1D), -gaussian(0.1D));
break;
case 3:
worldObj.spawnParticle("smoke", posX, posY, posZ, gaussian(0.1D), gaussian(0.1D), gaussian(0.1D));
break;
case 4:
worldObj.spawnParticle("smoke", posX, posY, posZ, -gaussian(0.1D), gaussian(0.1D), gaussian(0.1D));
break;
case 5:
worldObj.spawnParticle("smoke", posX, posY, posZ, gaussian(0.1D), gaussian(0.1D), gaussian(0.1D));
break;
}
}
}
}
//Custom stuff
public int getRicochetMax()
{
return this.maxRicochet;
}
public void setRicochetMax(int ricochet)
{
this.maxRicochet = ricochet;
}
public void setImpactList(List<IProjectileImpactEffect> list)
{
this.impactList = list;
}
public void setUpdateEffectList(List<IProjectileUpdateEffect> list)
{
this.updateEffectList = list;
}
private void performEntityImpactEffects(Entity mop)
{
if(impactList!=null)
{
for(IProjectileImpactEffect impactEffect : impactList)
{
impactEffect.onEntityImpact(mop);
}
}
}
private void performTileImpactEffects(MovingObjectPosition mop)
{
if(impactList!=null)
{
for(IProjectileImpactEffect impactEffect : impactList)
{
impactEffect.onTileImpact(worldObj, mop);
}
}
}
private void performUpdateEffects()
{
if(updateEffectList!=null)
{
for(IProjectileUpdateEffect updateEffect : updateEffectList)
{
updateEffect.onUpdateEffect(this);
}
}
}
public void setPenetration(boolean penetration)
{
this.penetration = penetration;
}
public float getDamage()
{
return this.damage;
}
public void setDamage(float damage)
{
this.damage = damage;
}
public void setSpellEffectList(List<SpellEffect> list)
{
this.spellEffectList = list;
}
public int getBlocksBroken()
{
return this.blocksBroken;
}
public void setBlocksBroken(int blocksBroken)
{
this.blocksBroken = blocksBroken;
}
}

View file

@ -0,0 +1,21 @@
package WayofTime.alchemicalWizardry.common.spell.complex;
public class SpellModifier
{
public static final int DEFAULT = 0;
public static final int OFFENSIVE = 1;
public static final int DEFENSIVE = 2;
public static final int ENVIRONMENTAL = 3;
private int modifier;
protected SpellModifier(int modifier)
{
this.modifier = modifier;
}
public int getModifier()
{
return this.modifier;
}
}

View file

@ -0,0 +1,9 @@
package WayofTime.alchemicalWizardry.common.spell.complex;
public class SpellModifierDefault extends SpellModifier
{
public SpellModifierDefault()
{
super(SpellModifier.DEFAULT);
}
}

View file

@ -0,0 +1,9 @@
package WayofTime.alchemicalWizardry.common.spell.complex;
public class SpellModifierDefensive extends SpellModifier
{
public SpellModifierDefensive()
{
super(SpellModifier.DEFENSIVE);
}
}

View file

@ -0,0 +1,9 @@
package WayofTime.alchemicalWizardry.common.spell.complex;
public class SpellModifierEnvironmental extends SpellModifier
{
public SpellModifierEnvironmental()
{
super(SpellModifier.ENVIRONMENTAL);
}
}

View file

@ -0,0 +1,9 @@
package WayofTime.alchemicalWizardry.common.spell.complex;
public class SpellModifierOffensive extends SpellModifier
{
public SpellModifierOffensive()
{
super(SpellModifier.OFFENSIVE);
}
}

View file

@ -0,0 +1,157 @@
package WayofTime.alchemicalWizardry.common.spell.complex;
import java.util.ArrayList;
import java.util.LinkedList;
import java.util.List;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellEffect;
import WayofTime.alchemicalWizardry.common.spell.complex.enhancement.SpellEnhancement;
public abstract class SpellParadigm
{
protected List<SpellEffect> bufferedEffectList = new ArrayList();
public List<String> effectList = new LinkedList();
public void addBufferedEffect(SpellEffect effect)
{
if(effect!=null)
{
this.bufferedEffectList.add(effect);
effectList.add(effect.getClass().getName());
}
}
public void modifyBufferedEffect(SpellModifier modifier)
{
SpellEffect effect = this.getBufferedEffect();
if(effect!=null)
{
effect.modifyEffect(modifier);
effectList.add(modifier.getClass().getName());
}
}
public void applyEnhancement(SpellEnhancement enh)
{
if(enh!=null)
{
if(bufferedEffectList.isEmpty())
{
this.enhanceParadigm(enh);
}
else
{
SpellEffect effect = this.getBufferedEffect();
if(effect!=null)
{
effect.enhanceEffect(enh);
}
}
effectList.add(enh.getClass().getName());
}
}
public abstract void enhanceParadigm(SpellEnhancement enh);
public abstract void castSpell(World world, EntityPlayer entityPlayer, ItemStack itemStack);
public void applySpellEffect(SpellEffect effect)
{
effect.modifyParadigm(this);
}
public void applyAllSpellEffects()
{
for(SpellEffect effect : bufferedEffectList)
{
this.applySpellEffect(effect);
}
}
public SpellEffect getBufferedEffect()
{
if(bufferedEffectList.isEmpty())
{
return null;
}
else
{
return bufferedEffectList.get(bufferedEffectList.size()-1);
}
}
public int getTotalCost()
{
int cost = 0;
if(this.bufferedEffectList!=null && !this.bufferedEffectList.isEmpty())
{
if(this instanceof SpellParadigmProjectile)
{
for(SpellEffect effect : bufferedEffectList)
{
cost+=effect.getCostForProjectile();
}
}else if(this instanceof SpellParadigmSelf)
{
for(SpellEffect effect : bufferedEffectList)
{
cost+=effect.getCostForSelf();
}
}else if(this instanceof SpellParadigmMelee)
{
for(SpellEffect effect : bufferedEffectList)
{
cost+=effect.getCostForMelee();
}
}
return (int)(cost*Math.sqrt(this.bufferedEffectList.size()));
}
return getDefaultCost();
}
public abstract int getDefaultCost();
public int getBufferedEffectPower()
{
SpellEffect eff = this.getBufferedEffect();
if(eff!=null)
{
return eff.getPowerEnhancements();
}
return 0;
}
public int getBufferedEffectCost()
{
SpellEffect eff = this.getBufferedEffect();
if(eff!=null)
{
return eff.getCostEnhancements();
}
return 0;
}
public int getBufferedEffectPotency()
{
SpellEffect eff = this.getBufferedEffect();
if(eff!=null)
{
return eff.getPotencyEnhancements();
}
return 0;
}
}

View file

@ -0,0 +1,70 @@
package WayofTime.alchemicalWizardry.common.spell.complex;
import java.util.ArrayList;
import java.util.List;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
import WayofTime.alchemicalWizardry.common.items.EnergyItems;
import WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.IMeleeSpellEntityEffect;
import WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.IMeleeSpellWorldEffect;
import WayofTime.alchemicalWizardry.common.spell.complex.enhancement.SpellEnhancement;
public class SpellParadigmMelee extends SpellParadigm
{
private List<IMeleeSpellEntityEffect> entityEffectList;
private List<IMeleeSpellWorldEffect> worldEffectList;
public SpellParadigmMelee()
{
this.entityEffectList = new ArrayList();
this.worldEffectList = new ArrayList();
}
@Override
public void enhanceParadigm(SpellEnhancement enh)
{
}
@Override
public void castSpell(World world, EntityPlayer entityPlayer, ItemStack itemStack)
{
for(IMeleeSpellEntityEffect effect : entityEffectList)
{
effect.onEntityImpact(world, entityPlayer);
}
for(IMeleeSpellWorldEffect effect : worldEffectList)
{
effect.onWorldEffect(world, entityPlayer);
}
int cost = this.getTotalCost();
EnergyItems.syphonBatteries(itemStack, entityPlayer, cost);
}
public void addEntityEffect(IMeleeSpellEntityEffect eff)
{
if(eff!=null)
{
this.entityEffectList.add(eff);
}
}
public void addWorldEffect(IMeleeSpellWorldEffect eff)
{
if(eff!=null)
{
this.worldEffectList.add(eff);
}
}
@Override
public int getDefaultCost()
{
return 0;
}
}

View file

@ -0,0 +1,99 @@
package WayofTime.alchemicalWizardry.common.spell.complex;
import java.util.ArrayList;
import java.util.List;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.util.DamageSource;
import net.minecraft.world.World;
import WayofTime.alchemicalWizardry.common.items.EnergyItems;
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 WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.fire.ProjectileDefaultFire;
import WayofTime.alchemicalWizardry.common.spell.complex.enhancement.SpellEnhancement;
public class SpellParadigmProjectile extends SpellParadigm
{
public DamageSource damageSource;
public float damage;
public int cost;
public List<IProjectileImpactEffect> impactList;
public List<IProjectileUpdateEffect> updateEffectList;
public boolean penetration;
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
public void enhanceParadigm(SpellEnhancement enh)
{
}
@Override
public void castSpell(World world, EntityPlayer entityPlayer, ItemStack itemStack)
{
EntitySpellProjectile proj = new EntitySpellProjectile(world, entityPlayer);
this.prepareProjectile(proj);
world.spawnEntityInWorld(proj);
int cost = this.getTotalCost();
EnergyItems.syphonBatteries(itemStack, entityPlayer, cost);
}
public static SpellParadigmProjectile getParadigmForEffectArray(List<SpellEffect> effectList)
{
SpellParadigmProjectile parad = new SpellParadigmProjectile();
for(SpellEffect eff : effectList)
{
parad.addBufferedEffect(eff);
}
return parad;
}
public void prepareProjectile(EntitySpellProjectile proj)
{
proj.setDamage(damage);
proj.setImpactList(impactList);
proj.setUpdateEffectList(updateEffectList);
proj.setPenetration(penetration);
proj.setRicochetMax(ricochetMax);
proj.setSpellEffectList(bufferedEffectList);
}
public void addImpactEffect(IProjectileImpactEffect eff)
{
if(eff!=null)
{
this.impactList.add(eff);
}
}
public void addUpdateEffect(IProjectileUpdateEffect eff)
{
if(eff!=null)
{
this.updateEffectList.add(eff);
}
}
@Override
public int getDefaultCost()
{
return 50;
}
}

View file

@ -0,0 +1,58 @@
package WayofTime.alchemicalWizardry.common.spell.complex;
import java.util.ArrayList;
import java.util.List;
import WayofTime.alchemicalWizardry.common.items.EnergyItems;
import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellEffect;
import WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.ISelfSpellEffect;
import WayofTime.alchemicalWizardry.common.spell.complex.enhancement.SpellEnhancement;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
public class SpellParadigmSelf extends SpellParadigm
{
public List<ISelfSpellEffect> selfSpellEffectList;
public SpellParadigmSelf()
{
selfSpellEffectList = new ArrayList();
}
@Override
public void enhanceParadigm(SpellEnhancement enh)
{
}
@Override
public void castSpell(World world, EntityPlayer entityPlayer, ItemStack itemStack)
{
this.applyAllSpellEffects();
for(ISelfSpellEffect eff : selfSpellEffectList)
{
eff.onSelfUse(world, entityPlayer);
}
int cost = this.getTotalCost();
EnergyItems.syphonBatteries(itemStack, entityPlayer, cost);
}
public void addSelfSpellEffect(ISelfSpellEffect eff)
{
if(eff!=null)
{
this.selfSpellEffectList.add(eff);
}
}
@Override
public int getDefaultCost()
{
return 100;
}
}

View file

@ -0,0 +1,221 @@
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;
import WayofTime.alchemicalWizardry.common.spell.complex.SpellParadigmProjectile;
import WayofTime.alchemicalWizardry.common.spell.complex.SpellParadigmSelf;
import WayofTime.alchemicalWizardry.common.spell.complex.enhancement.SpellEnhancement;
public abstract class SpellEffect
{
protected int modifierState;
protected int powerEnhancement;
protected int costEnhancement;
protected int potencyEnhancement;
public SpellEffect()
{
this.modifierState = SpellModifier.DEFAULT;
this.powerEnhancement = 0;
this.costEnhancement = 0;
this.potencyEnhancement = 0;
}
public void enhanceEffect(SpellEnhancement enh)
{
if(enh!=null)
{
switch(enh.getState())
{
case SpellEnhancement.POWER: this.powerEnhancement++; break;
case SpellEnhancement.EFFICIENCY: this.costEnhancement++; break;
case SpellEnhancement.POTENCY: this.potencyEnhancement++; break;
}
}
}
public void modifyEffect(SpellModifier mod)
{
if(mod!=null)
modifierState = mod.getModifier();
}
public void modifyParadigm(SpellParadigm parad)
{
if(parad instanceof SpellParadigmProjectile)
{
this.modifyProjectileParadigm((SpellParadigmProjectile)parad);
}
if(parad instanceof SpellParadigmSelf)
{
this.modifySelfParadigm((SpellParadigmSelf)parad);
}
if(parad instanceof SpellParadigmMelee)
{
this.modifyMeleeParadigm((SpellParadigmMelee)parad);
}
}
public void modifyProjectileParadigm(SpellParadigmProjectile parad)
{
switch(modifierState)
{
case SpellModifier.DEFAULT: this.defaultModificationProjectile(parad); break;
case SpellModifier.OFFENSIVE: this.offensiveModificationProjectile(parad); break;
case SpellModifier.DEFENSIVE: this.defensiveModificationProjectile(parad); break;
case SpellModifier.ENVIRONMENTAL: this.environmentalModificationProjectile(parad); break;
}
}
public abstract void defaultModificationProjectile(SpellParadigmProjectile parad);
public abstract void offensiveModificationProjectile(SpellParadigmProjectile parad);
public abstract void defensiveModificationProjectile(SpellParadigmProjectile parad);
public abstract void environmentalModificationProjectile(SpellParadigmProjectile parad);
public void modifySelfParadigm(SpellParadigmSelf parad)
{
switch(modifierState)
{
case SpellModifier.DEFAULT: this.defaultModificationSelf(parad); break;
case SpellModifier.OFFENSIVE: this.offensiveModificationSelf(parad); break;
case SpellModifier.DEFENSIVE: this.defensiveModificationSelf(parad); break;
case SpellModifier.ENVIRONMENTAL: this.environmentalModificationSelf(parad); break;
}
}
public abstract void defaultModificationSelf(SpellParadigmSelf parad);
public abstract void offensiveModificationSelf(SpellParadigmSelf parad);
public abstract void defensiveModificationSelf(SpellParadigmSelf parad);
public abstract void environmentalModificationSelf(SpellParadigmSelf parad);
public void modifyMeleeParadigm(SpellParadigmMelee parad)
{
switch(modifierState)
{
case SpellModifier.DEFAULT: this.defaultModificationMelee(parad); break;
case SpellModifier.OFFENSIVE: this.offensiveModificationMelee(parad); break;
case SpellModifier.DEFENSIVE: this.defensiveModificationMelee(parad); break;
case SpellModifier.ENVIRONMENTAL: this.environmentalModificationMelee(parad); break;
}
}
public abstract void defaultModificationMelee(SpellParadigmMelee parad);
public abstract void offensiveModificationMelee(SpellParadigmMelee parad);
public abstract void defensiveModificationMelee(SpellParadigmMelee parad);
public abstract void environmentalModificationMelee(SpellParadigmMelee parad);
public int getCostForProjectile()
{
switch(this.modifierState)
{
case SpellModifier.DEFAULT: return this.getCostForDefaultProjectile();
case SpellModifier.OFFENSIVE: return this.getCostForOffenseProjectile();
case SpellModifier.DEFENSIVE: return this.getCostForDefenseProjectile();
case SpellModifier.ENVIRONMENTAL: return this.getCostForEnvironmentProjectile();
}
return 0;
}
protected abstract int getCostForDefaultProjectile();
protected abstract int getCostForOffenseProjectile();
protected abstract int getCostForDefenseProjectile();
protected abstract int getCostForEnvironmentProjectile();
public int getCostForSelf()
{
switch(this.modifierState)
{
case SpellModifier.DEFAULT: return this.getCostForDefaultSelf();
case SpellModifier.OFFENSIVE: return this.getCostForOffenseSelf();
case SpellModifier.DEFENSIVE: return this.getCostForDefenseSelf();
case SpellModifier.ENVIRONMENTAL: return this.getCostForEnvironmentSelf();
}
return 0;
}
protected abstract int getCostForDefaultSelf();
protected abstract int getCostForOffenseSelf();
protected abstract int getCostForDefenseSelf();
protected abstract int getCostForEnvironmentSelf();
public int getCostForMelee()
{
switch(this.modifierState)
{
case SpellModifier.DEFAULT: return this.getCostForDefaultMelee();
case SpellModifier.OFFENSIVE: return this.getCostForOffenseMelee();
case SpellModifier.DEFENSIVE: return this.getCostForDefenseMelee();
case SpellModifier.ENVIRONMENTAL: return this.getCostForEnvironmentMelee();
}
return 0;
}
protected abstract int getCostForDefaultMelee();
protected abstract int getCostForOffenseMelee();
protected abstract int getCostForDefenseMelee();
protected abstract int getCostForEnvironmentMelee();
public int getPowerEnhancements()
{
return this.powerEnhancement;
}
public int getCostEnhancements()
{
return this.costEnhancement;
}
public int getPotencyEnhancements()
{
return this.potencyEnhancement;
}
public NBTTagCompound getTag()
{
NBTTagCompound tag = new NBTTagCompound();
tag.setString("Class", this.getClass().getName());
tag.setInteger("modifier", modifierState);
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.modifierState = tag.getInteger("modifier");
eff.powerEnhancement = tag.getInteger("power");
eff.costEnhancement = tag.getInteger("cost");
eff.potencyEnhancement = tag.getInteger("potency");
return eff;
}
} catch (InstantiationException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IllegalAccessException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
} catch (ClassNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return null;
}
}

View file

@ -0,0 +1,176 @@
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;
public class SpellEffectEarth extends SpellEffect
{
@Override
public void defaultModificationProjectile(SpellParadigmProjectile parad)
{
// TODO Auto-generated method stub
}
@Override
public void offensiveModificationProjectile(SpellParadigmProjectile parad)
{
// TODO Auto-generated method stub
}
@Override
public void defensiveModificationProjectile(SpellParadigmProjectile parad)
{
// TODO Auto-generated method stub
}
@Override
public void environmentalModificationProjectile(SpellParadigmProjectile parad)
{
// TODO Auto-generated method stub
}
@Override
public void defaultModificationSelf(SpellParadigmSelf parad)
{
// TODO Auto-generated method stub
}
@Override
public void offensiveModificationSelf(SpellParadigmSelf parad)
{
// TODO Auto-generated method stub
}
@Override
public void defensiveModificationSelf(SpellParadigmSelf parad)
{
// TODO Auto-generated method stub
}
@Override
public void environmentalModificationSelf(SpellParadigmSelf parad)
{
// TODO Auto-generated method stub
}
@Override
public void defaultModificationMelee(SpellParadigmMelee parad)
{
// TODO Auto-generated method stub
}
@Override
public void offensiveModificationMelee(SpellParadigmMelee parad)
{
// TODO Auto-generated method stub
}
@Override
public void defensiveModificationMelee(SpellParadigmMelee parad)
{
// TODO Auto-generated method stub
}
@Override
public void environmentalModificationMelee(SpellParadigmMelee parad)
{
// TODO Auto-generated method stub
}
@Override
protected int getCostForDefaultProjectile()
{
// TODO Auto-generated method stub
return 0;
}
@Override
protected int getCostForOffenseProjectile()
{
// TODO Auto-generated method stub
return 0;
}
@Override
protected int getCostForDefenseProjectile()
{
// TODO Auto-generated method stub
return 0;
}
@Override
protected int getCostForEnvironmentProjectile()
{
// TODO Auto-generated method stub
return 0;
}
@Override
protected int getCostForDefaultSelf()
{
// TODO Auto-generated method stub
return 0;
}
@Override
protected int getCostForOffenseSelf()
{
// TODO Auto-generated method stub
return 0;
}
@Override
protected int getCostForDefenseSelf()
{
// TODO Auto-generated method stub
return 0;
}
@Override
protected int getCostForEnvironmentSelf()
{
// TODO Auto-generated method stub
return 0;
}
@Override
protected int getCostForDefaultMelee()
{
// TODO Auto-generated method stub
return 0;
}
@Override
protected int getCostForOffenseMelee()
{
// TODO Auto-generated method stub
return 0;
}
@Override
protected int getCostForDefenseMelee()
{
// TODO Auto-generated method stub
return 0;
}
@Override
protected int getCostForEnvironmentMelee()
{
// TODO Auto-generated method stub
return 0;
}
}

View file

@ -0,0 +1,178 @@
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.fire.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;
import WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.fire.SelfOffensiveFire;
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
public void offensiveModificationProjectile(SpellParadigmProjectile parad)
{
// TODO Auto-generated method stub
parad.addImpactEffect(new ProjectileDefaultFire(this.powerEnhancement,this.potencyEnhancement,this.costEnhancement));
parad.damage+=this.potencyEnhancement;
}
@Override
public void defensiveModificationProjectile(SpellParadigmProjectile parad)
{
// TODO Auto-generated method stub
parad.addImpactEffect(new ProjectileDefaultFire(this.powerEnhancement,this.potencyEnhancement,this.costEnhancement));
parad.damage+=this.potencyEnhancement;
}
@Override
public void environmentalModificationProjectile(SpellParadigmProjectile parad)
{
// TODO Auto-generated method stub
parad.addImpactEffect(new ProjectileDefaultFire(this.powerEnhancement,this.potencyEnhancement,this.costEnhancement));
parad.damage+=this.potencyEnhancement;
}
@Override
public void defaultModificationSelf(SpellParadigmSelf parad)
{
parad.addSelfSpellEffect(new SelfDefaultFire(powerEnhancement, potencyEnhancement, costEnhancement));
}
@Override
public void offensiveModificationSelf(SpellParadigmSelf parad)
{
parad.addSelfSpellEffect(new SelfOffensiveFire(powerEnhancement,potencyEnhancement,costEnhancement));
}
@Override
public void defensiveModificationSelf(SpellParadigmSelf parad)
{
parad.addSelfSpellEffect(new SelfDefensiveFire(powerEnhancement,potencyEnhancement,costEnhancement));
}
@Override
public void environmentalModificationSelf(SpellParadigmSelf parad)
{
parad.addSelfSpellEffect(new SelfEnvironmentalFire(powerEnhancement, potencyEnhancement, costEnhancement));
}
@Override
public void defaultModificationMelee(SpellParadigmMelee parad)
{
// TODO Auto-generated method stub
}
@Override
public void offensiveModificationMelee(SpellParadigmMelee parad)
{
// TODO Auto-generated method stub
}
@Override
public void defensiveModificationMelee(SpellParadigmMelee parad)
{
// TODO Auto-generated method stub
}
@Override
public void environmentalModificationMelee(SpellParadigmMelee parad)
{
// TODO Auto-generated method stub
}
@Override
protected int getCostForDefaultProjectile()
{
// TODO Auto-generated method stub
return 0;
}
@Override
protected int getCostForOffenseProjectile()
{
// TODO Auto-generated method stub
return 0;
}
@Override
protected int getCostForDefenseProjectile()
{
// TODO Auto-generated method stub
return 0;
}
@Override
protected int getCostForEnvironmentProjectile()
{
// TODO Auto-generated method stub
return 0;
}
@Override
protected int getCostForDefaultSelf()
{
return 10*(int)(10*Math.pow(1.5, this.powerEnhancement+1.5*this.potencyEnhancement));
}
@Override
protected int getCostForOffenseSelf()
{
return 500*(int)((this.powerEnhancement+1)*Math.pow(2, potencyEnhancement));
}
@Override
protected int getCostForDefenseSelf()
{
// TODO Auto-generated method stub
return 0;
}
@Override
protected int getCostForEnvironmentSelf()
{
return (int) ((15*Math.pow(1.7, powerEnhancement)+10*Math.pow(potencyEnhancement,1.8))*Math.pow(0.8, costEnhancement));
}
@Override
protected int getCostForDefaultMelee()
{
// TODO Auto-generated method stub
return 0;
}
@Override
protected int getCostForOffenseMelee()
{
// TODO Auto-generated method stub
return 0;
}
@Override
protected int getCostForDefenseMelee()
{
// TODO Auto-generated method stub
return 0;
}
@Override
protected int getCostForEnvironmentMelee()
{
// TODO Auto-generated method stub
return 0;
}
}

View file

@ -0,0 +1,167 @@
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.ice.MeleeDefaultIce;
import WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.ice.MeleeDefensiveIce;
import WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.ice.MeleeEnvironmentalIce;
import WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.ice.MeleeOffensiveIce;
import WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.ice.ProjectileDefaultIce;
import WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.ice.ProjectileDefensiveIce;
import WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.ice.ProjectileEnvironmentalIce;
import WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.ice.ProjectileOffensiveIce;
import WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.ice.SelfDefaultIce;
import WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.ice.SelfDefensiveIce;
import WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.ice.SelfEnvironmentalIce;
import WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.ice.SelfOffensiveIce;
public class SpellEffectIce extends SpellEffect
{
@Override
public void defaultModificationProjectile(SpellParadigmProjectile parad)
{
parad.damage+=this.potencyEnhancement;
parad.addImpactEffect(new ProjectileDefaultIce(this.powerEnhancement,this.potencyEnhancement,this.costEnhancement));
}
@Override
public void offensiveModificationProjectile(SpellParadigmProjectile parad)
{
parad.damage+=2;
parad.addImpactEffect(new ProjectileOffensiveIce(this.powerEnhancement,this.potencyEnhancement,this.costEnhancement));
}
@Override
public void defensiveModificationProjectile(SpellParadigmProjectile parad)
{
parad.addImpactEffect(new ProjectileDefensiveIce(this.powerEnhancement,this.potencyEnhancement,this.costEnhancement));
}
@Override
public void environmentalModificationProjectile(SpellParadigmProjectile parad)
{
parad.addUpdateEffect(new ProjectileEnvironmentalIce(this.powerEnhancement,this.potencyEnhancement,this.costEnhancement));
}
@Override
public void defaultModificationSelf(SpellParadigmSelf parad)
{
parad.addSelfSpellEffect(new SelfDefaultIce(this.powerEnhancement,this.potencyEnhancement, this.costEnhancement));
}
@Override
public void offensiveModificationSelf(SpellParadigmSelf parad)
{
parad.addSelfSpellEffect(new SelfOffensiveIce(this.powerEnhancement,this.potencyEnhancement,this.costEnhancement));
}
@Override
public void defensiveModificationSelf(SpellParadigmSelf parad)
{
parad.addSelfSpellEffect(new SelfDefensiveIce(this.powerEnhancement,this.potencyEnhancement,this.costEnhancement));
}
@Override
public void environmentalModificationSelf(SpellParadigmSelf parad)
{
parad.addSelfSpellEffect(new SelfEnvironmentalIce(this.powerEnhancement,this.potencyEnhancement,this.costEnhancement));
}
@Override
public void defaultModificationMelee(SpellParadigmMelee parad)
{
parad.addEntityEffect(new MeleeDefaultIce(this.powerEnhancement,this.potencyEnhancement,this.costEnhancement));
}
@Override
public void offensiveModificationMelee(SpellParadigmMelee parad)
{
parad.addEntityEffect(new MeleeOffensiveIce(this.powerEnhancement,this.potencyEnhancement,this.costEnhancement));
}
@Override
public void defensiveModificationMelee(SpellParadigmMelee parad)
{
parad.addWorldEffect(new MeleeDefensiveIce(this.powerEnhancement,this.potencyEnhancement,this.costEnhancement));
}
@Override
public void environmentalModificationMelee(SpellParadigmMelee parad)
{
parad.addEntityEffect(new MeleeEnvironmentalIce(this.powerEnhancement,this.potencyEnhancement,this.costEnhancement));
}
@Override
protected int getCostForDefaultProjectile()
{
return (int)((30)*(this.potencyEnhancement+1)*Math.pow(0.85, costEnhancement));
}
@Override
protected int getCostForOffenseProjectile()
{
return (int)((60)*(this.powerEnhancement+1)*(3*this.potencyEnhancement+1)*Math.pow(0.85, costEnhancement));
}
@Override
protected int getCostForDefenseProjectile()
{
return (int)(75*(2*this.powerEnhancement+1)*(this.potencyEnhancement+1)*Math.pow(0.85, costEnhancement));
}
@Override
protected int getCostForEnvironmentProjectile()
{
return (int)(200*(2*this.powerEnhancement+1)*(2*this.potencyEnhancement+1)*Math.pow(0.85, costEnhancement));
}
@Override
protected int getCostForDefaultSelf()
{
return (int)(20*(this.powerEnhancement+1)*Math.pow(0.85, costEnhancement));
}
@Override
protected int getCostForOffenseSelf()
{
return (int)(100*(2*this.powerEnhancement+1)*(2*this.potencyEnhancement+1)*Math.pow(0.85, costEnhancement));
}
@Override
protected int getCostForDefenseSelf()
{
return (int)(200*(3*powerEnhancement+1)*(2*potencyEnhancement + 1)*Math.pow(0.85, costEnhancement));
}
@Override
protected int getCostForEnvironmentSelf()
{
return (int)(10*(1.5*potencyEnhancement+1)*(3*powerEnhancement+1)*Math.pow(0.85, costEnhancement));
}
@Override
protected int getCostForDefaultMelee()
{
return (int)(250*(potencyEnhancement+1)*(1.5*powerEnhancement+1)*Math.pow(0.85, costEnhancement));
}
@Override
protected int getCostForOffenseMelee()
{
return (int)(40*(1.5*potencyEnhancement+1)*Math.pow(1.5, powerEnhancement)*Math.pow(0.85, costEnhancement));
}
@Override
protected int getCostForDefenseMelee()
{
return (int)(50*(0.5*potencyEnhancement+1)*(0.7*powerEnhancement+1)*(0.5*powerEnhancement+1)*Math.pow(0.85, costEnhancement));
}
@Override
protected int getCostForEnvironmentMelee()
{
return (int)(20*(0.5*potencyEnhancement+1)*(0*powerEnhancement+1)*Math.pow(0.85, costEnhancement));
}
}

View file

@ -0,0 +1,176 @@
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;
public class SpellEffectWind extends SpellEffect
{
@Override
public void defaultModificationProjectile(SpellParadigmProjectile parad)
{
// TODO Auto-generated method stub
}
@Override
public void offensiveModificationProjectile(SpellParadigmProjectile parad)
{
// TODO Auto-generated method stub
}
@Override
public void defensiveModificationProjectile(SpellParadigmProjectile parad)
{
// TODO Auto-generated method stub
}
@Override
public void environmentalModificationProjectile(SpellParadigmProjectile parad)
{
// TODO Auto-generated method stub
}
@Override
public void defaultModificationSelf(SpellParadigmSelf parad)
{
// TODO Auto-generated method stub
}
@Override
public void offensiveModificationSelf(SpellParadigmSelf parad)
{
// TODO Auto-generated method stub
}
@Override
public void defensiveModificationSelf(SpellParadigmSelf parad)
{
// TODO Auto-generated method stub
}
@Override
public void environmentalModificationSelf(SpellParadigmSelf parad)
{
// TODO Auto-generated method stub
}
@Override
public void defaultModificationMelee(SpellParadigmMelee parad)
{
// TODO Auto-generated method stub
}
@Override
public void offensiveModificationMelee(SpellParadigmMelee parad)
{
// TODO Auto-generated method stub
}
@Override
public void defensiveModificationMelee(SpellParadigmMelee parad)
{
// TODO Auto-generated method stub
}
@Override
public void environmentalModificationMelee(SpellParadigmMelee parad)
{
// TODO Auto-generated method stub
}
@Override
protected int getCostForDefaultProjectile()
{
// TODO Auto-generated method stub
return 0;
}
@Override
protected int getCostForOffenseProjectile()
{
// TODO Auto-generated method stub
return 0;
}
@Override
protected int getCostForDefenseProjectile()
{
// TODO Auto-generated method stub
return 0;
}
@Override
protected int getCostForEnvironmentProjectile()
{
// TODO Auto-generated method stub
return 0;
}
@Override
protected int getCostForDefaultSelf()
{
// TODO Auto-generated method stub
return 0;
}
@Override
protected int getCostForOffenseSelf()
{
// TODO Auto-generated method stub
return 0;
}
@Override
protected int getCostForDefenseSelf()
{
// TODO Auto-generated method stub
return 0;
}
@Override
protected int getCostForEnvironmentSelf()
{
// TODO Auto-generated method stub
return 0;
}
@Override
protected int getCostForDefaultMelee()
{
// TODO Auto-generated method stub
return 0;
}
@Override
protected int getCostForOffenseMelee()
{
// TODO Auto-generated method stub
return 0;
}
@Override
protected int getCostForDefenseMelee()
{
// TODO Auto-generated method stub
return 0;
}
@Override
protected int getCostForEnvironmentMelee()
{
// TODO Auto-generated method stub
return 0;
}
}

View file

@ -0,0 +1,184 @@
package WayofTime.alchemicalWizardry.common.spell.complex.effect;
import java.util.List;
import java.util.Random;
import net.minecraft.block.Block;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Blocks;
import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemStack;
import net.minecraft.item.crafting.FurnaceRecipes;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.Vec3;
import net.minecraft.world.World;
import net.minecraft.world.WorldProvider;
import net.minecraftforge.common.util.ForgeDirection;
public class SpellHelper
{
public static Random rand = new Random();
public static final double root2 = Math.sqrt(2);
public static void smeltBlockInWorld(World world, int posX, int posY, int posZ)
{
FurnaceRecipes recipes = FurnaceRecipes.smelting();
Block block = world.getBlock(posX, posY, posZ);
if(block==null)
{
return;
}
int meta = world.getBlockMetadata(posX, posY, posZ);
ItemStack smeltedStack = recipes.getSmeltingResult(new ItemStack(block,1,meta));
if(smeltedStack!=null && smeltedStack.getItem() instanceof ItemBlock)
{
world.setBlock(posX, posY, posZ, ((ItemBlock)(smeltedStack.getItem())).field_150939_a, smeltedStack.getItemDamage(), 3);
}
}
public static List<Entity> getEntitiesInRange(World world, double posX, double posY, double posZ, double horizontalRadius, double verticalRadius)
{
return world.getEntitiesWithinAABB(Entity.class, AxisAlignedBB.getBoundingBox(posX-0.5f, posY-0.5f, posZ-0.5f, posX + 0.5f, posY + 0.5f, posZ + 0.5f).expand(horizontalRadius, verticalRadius, horizontalRadius));
}
public static List<EntityPlayer> getPlayersInRange(World world, double posX, double posY, double posZ, double horizontalRadius, double verticalRadius)
{
return world.getEntitiesWithinAABB(EntityPlayer.class, AxisAlignedBB.getBoundingBox(posX-0.5f, posY-0.5f, posZ-0.5f, posX + 0.5f, posY + 0.5f, posZ + 0.5f).expand(horizontalRadius, verticalRadius, horizontalRadius));
}
public static double gaussian(double d)
{
return d * ((rand.nextFloat() - 0.5D));
}
public static Vec3 getEntityBlockVector(Entity entity)
{
int posX = (int) Math.round(entity.posX - 0.5f);
int posY = (int) entity.posY;
int posZ = (int) Math.round(entity.posZ - 0.5f);
return entity.getLookVec().createVectorHelper(posX, posY, posZ);
}
public static ForgeDirection getDirectionForLookVector(Vec3 lookVec)
{
double distance = lookVec.lengthVector();
if(lookVec.yCoord>distance*0.9)
{
return ForgeDirection.UP;
}
if(lookVec.yCoord<distance*-0.9)
{
return ForgeDirection.DOWN;
}
return getCompassDirectionForLookVector(lookVec);
}
public static ForgeDirection getCompassDirectionForLookVector(Vec3 lookVec)
{
double radius = Math.sqrt(Math.pow(lookVec.xCoord,2)+Math.pow(lookVec.zCoord,2));
if(lookVec.zCoord>radius*1/root2)
{
return ForgeDirection.SOUTH;
}
if(lookVec.zCoord<-radius*1/root2)
{
return ForgeDirection.NORTH;
}
if(lookVec.xCoord>radius*1/root2)
{
return ForgeDirection.EAST;
}
if(lookVec.xCoord<-radius*1/root2)
{
return ForgeDirection.WEST;
}
return ForgeDirection.EAST;
}
public static void freezeWaterBlock(World world, int posX, int posY, int posZ)
{
Block block = world.getBlock(posX, posY, posZ);
if(block == Blocks.water || block == Blocks.flowing_water)
{
world.setBlock(posX, posY, posZ, Blocks.ice);
}
}
public static String getUsername(EntityPlayer player)
{
return player.getDisplayName();
}
public static void sendParticleToPlayer(EntityPlayer player, String str, double xCoord, double yCoord, double zCoord, double xVel, double yVel, double zVel)
{
}
public static void sendIndexedParticleToPlayer(EntityPlayer player, int index, double xCoord, double yCoord, double zCoord)
{
switch(index)
{
case 1:
SpellHelper.sendParticleToPlayer(player, "mobSpell", xCoord + 0.5D + rand.nextGaussian() / 8, yCoord + 1.1D, zCoord + 0.5D + rand.nextGaussian() / 8, 0.5117D, 0.0117D, 0.0117D);
case 2:
SpellHelper.sendParticleToPlayer(player, "reddust", xCoord + 0.5D + rand.nextGaussian() / 8, yCoord + 1.1D, zCoord + 0.5D + rand.nextGaussian() / 8, 0.82D, 0.941D, 0.91D);
case 3:
SpellHelper.sendParticleToPlayer(player, "mobSpell", xCoord + 0.5D + rand.nextGaussian() / 8, yCoord + 1.1D, zCoord + 0.5D + rand.nextGaussian() / 8, 1.0D, 0.371D, 0.371D);
case 4:
float f = (float) 1.0F;
float f1 = f * 0.6F + 0.4F;
float f2 = f * f * 0.7F - 0.5F;
float f3 = f * f * 0.6F - 0.7F;
for (int l = 0; l < 8; ++l)
{
SpellHelper.sendParticleToPlayer(player,"reddust", xCoord + Math.random() - Math.random(), yCoord + Math.random() - Math.random(), zCoord + Math.random() - Math.random(), f1, f2, f3);
}
}
}
public static void sendParticleToAllAround(World world, double xPos, double yPos, double zPos, int radius, int dimension, String str, double xCoord, double yCoord, double zCoord, double xVel, double yVel, double zVel)
{
List<EntityPlayer> entities = SpellHelper.getPlayersInRange(world, xPos, yPos, zPos, radius, radius);
if(entities==null)
{
return;
}
for(EntityPlayer player : entities)
{
SpellHelper.sendParticleToPlayer(player, str, xCoord, yCoord, zCoord, xVel, yVel, zVel);
}
}
public static void sendIndexedParticleToAllAround(World world, double xPos, double yPos, double zPos, int radius, int dimension, int index, double xCoord, double yCoord, double zCoord)
{
List<EntityPlayer> entities = SpellHelper.getPlayersInRange(world, xPos, yPos, zPos, radius, radius);
if(entities==null)
{
return;
}
for(EntityPlayer player : entities)
{
SpellHelper.sendIndexedParticleToPlayer(player, index, xCoord, yCoord, zCoord);
}
}
public static void setPlayerSpeedFromServer(EntityPlayer player, double motionX, double motionY, double motionZ)
{
}
}

View file

@ -0,0 +1,74 @@
package WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects;
import java.util.List;
import net.minecraft.entity.Entity;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.Vec3;
import net.minecraft.world.World;
public abstract class ExtrapolatedMeleeEntityEffect implements IMeleeSpellEntityEffect
{
protected float range;
protected float radius;
protected int powerUpgrades;
protected int potencyUpgrades;
protected int costUpgrades;
protected int maxHit;
public ExtrapolatedMeleeEntityEffect(int power, int potency, int cost)
{
this.powerUpgrades = power;
this.potencyUpgrades = potency;
this.costUpgrades = cost;
this.range = 0;
this.radius = 0;
this.maxHit = 1;
}
@Override
public void onEntityImpact(World world, EntityPlayer entityPlayer)
{
Vec3 lookVec = entityPlayer.getLook(range);
double x = entityPlayer.posX + lookVec.xCoord;
double y = entityPlayer.posY + entityPlayer.getEyeHeight() + lookVec.yCoord;
double z = entityPlayer.posZ + lookVec.zCoord;
List<Entity> entities = world.getEntitiesWithinAABB(Entity.class, AxisAlignedBB.getBoundingBox(x-0.5f, y-0.5f, z-0.5f, x + 0.5f, y + 0.5f, z + 0.5f).expand(radius, radius, radius));
int hit = 0;
if(entities!=null)
{
for(Entity entity : entities)
{
if(hit<maxHit&&!entity.equals(entityPlayer))
{
if(this.entityEffect(world, entity))
{
hit++;
}
}
}
}
}
protected abstract boolean entityEffect(World world, Entity entity);
public void setRange(float range)
{
this.range = range;
}
public void setRadius(float radius)
{
this.radius = radius;
}
public void setMaxNumberHit(int maxHit)
{
this.maxHit = maxHit;
}
}

View file

@ -0,0 +1,9 @@
package WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.world.World;
public interface IMeleeSpellEntityEffect
{
public void onEntityImpact(World world, EntityPlayer entityPlayer);
}

View file

@ -0,0 +1,10 @@
package WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.util.Vec3;
import net.minecraft.world.World;
public interface IMeleeSpellWorldEffect
{
public void onWorldEffect(World world, EntityPlayer entityPlayer);
}

View file

@ -0,0 +1,11 @@
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(World world, MovingObjectPosition mop);
}

View file

@ -0,0 +1,8 @@
package WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects;
import net.minecraft.entity.Entity;
public interface IProjectileUpdateEffect
{
public void onUpdateEffect(Entity projectile);
}

View file

@ -0,0 +1,9 @@
package WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.world.World;
public interface ISelfSpellEffect
{
public void onSelfUse(World world, EntityPlayer player);
}

View file

@ -0,0 +1,21 @@
package WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.world.World;
public abstract class MeleeSpellWorldEffect implements IMeleeSpellWorldEffect
{
protected int powerUpgrades;
protected int potencyUpgrades;
protected int costUpgrades;
public MeleeSpellWorldEffect(int power, int potency, int cost)
{
this.powerUpgrades = power;
this.potencyUpgrades = potency;
this.costUpgrades = cost;
}
@Override
public abstract void onWorldEffect(World world, EntityPlayer entityPlayer);
}

View file

@ -0,0 +1,15 @@
package WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects;
public abstract class ProjectileImpactEffect implements IProjectileImpactEffect
{
protected int powerUpgrades;
protected int potencyUpgrades;
protected int costUpgrades;
public ProjectileImpactEffect(int power, int potency, int cost)
{
this.powerUpgrades = power;
this.potencyUpgrades = potency;
this.costUpgrades = cost;
}
}

View file

@ -0,0 +1,15 @@
package WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects;
public abstract class ProjectileUpdateEffect implements IProjectileUpdateEffect
{
protected int powerUpgrades;
protected int potencyUpgrades;
protected int costUpgrades;
public ProjectileUpdateEffect(int power, int potency, int cost)
{
this.powerUpgrades = power;
this.potencyUpgrades = potency;
this.costUpgrades = cost;
}
}

View file

@ -0,0 +1,18 @@
package WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.world.World;
public abstract class SelfSpellEffect implements ISelfSpellEffect
{
protected int powerUpgrades;
protected int potencyUpgrades;
protected int costUpgrades;
public SelfSpellEffect(int power, int potency, int cost)
{
this.powerUpgrades = power;
this.potencyUpgrades = potency;
this.costUpgrades = cost;
}
}

View file

@ -0,0 +1,44 @@
package WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.fire;
import net.minecraft.entity.Entity;
import net.minecraft.init.Blocks;
import net.minecraft.util.MovingObjectPosition;
import net.minecraft.world.World;
import WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.ProjectileImpactEffect;
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;
int range = 0;
for(int i=-range; i<=range;i++)
{
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, Blocks.fire);
}
}
}
}
}
}

View file

@ -0,0 +1,22 @@
package WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.fire;
import WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.ISelfSpellEffect;
import WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.SelfSpellEffect;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.potion.Potion;
import net.minecraft.potion.PotionEffect;
import net.minecraft.world.World;
public class SelfDefaultFire extends SelfSpellEffect
{
public SelfDefaultFire(int power, int potency, int cost)
{
super(power, potency, cost);
}
@Override
public void onSelfUse(World world, EntityPlayer player)
{
player.setFire((int)(10*Math.pow(1.5, powerUpgrades+1.5*potencyUpgrades)));
}
}

View file

@ -0,0 +1,24 @@
package WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.fire;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.world.World;
import WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.SelfSpellEffect;
public class SelfDefensiveFire extends SelfSpellEffect {
public SelfDefensiveFire(int power, int potency, int cost)
{
super(power, potency, cost);
}
@Override
public void onSelfUse(World world, EntityPlayer player)
{
// TODO Auto-generated method stub
world.playAuxSFXAtEntity(player, 1008, (int)player.posX, (int)player.posY, (int)player.posZ, 0);
}
}

View file

@ -0,0 +1,56 @@
package WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.fire;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Blocks;
import net.minecraft.world.World;
import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper;
import WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.SelfSpellEffect;
public class SelfEnvironmentalFire extends SelfSpellEffect
{
public SelfEnvironmentalFire(int power, int potency, int cost)
{
super(power, potency, cost);
}
@Override
public void onSelfUse(World world, EntityPlayer player)
{
int posX = (int) Math.round(player.posX - 0.5f);
int posY = (int) player.posY;
int posZ = (int) Math.round(player.posZ - 0.5f);
int powRadius = this.powerUpgrades;
int potRadius = this.potencyUpgrades-1;
for(int i=-powRadius;i<=powRadius;i++)
{
for(int j=-powRadius;j<=powRadius;j++)
{
for(int k=-powRadius;k<=powRadius;k++)
{
if(world.isAirBlock(posX+i, posY+j, posZ+k))
{
world.setBlock(posX+i, posY+j, posZ+k, Blocks.fire);
}
}
}
}
for(int i=-potRadius;i<=potRadius;i++)
{
for(int j=-potRadius;j<=potRadius;j++)
{
for(int k=-potRadius;k<=potRadius;k++)
{
if(!world.isAirBlock(posX+i, posY+j, posZ+k))
{
SpellHelper.smeltBlockInWorld(world, posX+i, posY+j, posZ+k);
}
}
}
}
}
}

View file

@ -0,0 +1,21 @@
package WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.fire;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.potion.PotionEffect;
import net.minecraft.world.World;
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
import WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.SelfSpellEffect;
public class SelfOffensiveFire extends SelfSpellEffect
{
public SelfOffensiveFire(int power, int potency, int cost)
{
super(power, potency, cost);
}
@Override
public void onSelfUse(World world, EntityPlayer player)
{
player.addPotionEffect(new PotionEffect(AlchemicalWizardry.customPotionFlameCloak.id,(this.powerUpgrades+1)*this.powerUpgrades,this.potencyUpgrades));
}
}

View file

@ -0,0 +1,27 @@
package WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.ice;
import net.minecraft.entity.Entity;
import net.minecraft.world.World;
import WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.ExtrapolatedMeleeEntityEffect;
public class MeleeDefaultIce extends ExtrapolatedMeleeEntityEffect {
public MeleeDefaultIce(int power, int potency, int cost)
{
super(power, potency, cost);
this.setRange(3+0.3f*potency);
this.setRadius(2+0.3f*potency);
this.setMaxNumberHit(potency+1);
}
@Override
protected boolean entityEffect(World world, Entity entity)
{
if(entity.hurtResistantTime>0)
{
entity.hurtResistantTime = Math.max(0, -(potencyUpgrades+1)+entity.hurtResistantTime);
}
return true;
}
}

View file

@ -0,0 +1,48 @@
package WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.ice;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Blocks;
import net.minecraft.util.Vec3;
import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper;
import WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.MeleeSpellWorldEffect;
public class MeleeDefensiveIce extends MeleeSpellWorldEffect
{
public MeleeDefensiveIce(int power, int potency, int cost)
{
super(power, potency, cost);
}
@Override
public void onWorldEffect(World world, EntityPlayer entityPlayer)
{
ForgeDirection look = SpellHelper.getCompassDirectionForLookVector(entityPlayer.getLookVec());
int width = this.powerUpgrades;
int height = this.powerUpgrades + 2;
int xOffset = look.offsetX;
int zOffset = look.offsetZ;
int range = this.potencyUpgrades + 1;
Vec3 lookVec = SpellHelper.getEntityBlockVector(entityPlayer);
int xStart = (int)(lookVec.xCoord) + range * xOffset;
int zStart = (int)(lookVec.zCoord) + range * zOffset;
int yStart = (int)(lookVec.yCoord);
for(int i=-width; i<=width; i++)
{
for(int j=0; j<height;j++)
{
if(world.isAirBlock(xStart + i*(zOffset), yStart + j, zStart + i*(xOffset)))
{
world.setBlock(xStart + i*(zOffset), yStart + j, zStart + i*(xOffset), Blocks.ice);
}
}
}
}
}

View file

@ -0,0 +1,38 @@
package WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.ice;
import net.minecraft.entity.Entity;
import net.minecraft.entity.projectile.EntitySnowball;
import net.minecraft.world.World;
import WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.ExtrapolatedMeleeEntityEffect;
public class MeleeEnvironmentalIce extends ExtrapolatedMeleeEntityEffect
{
public MeleeEnvironmentalIce(int power, int potency, int cost)
{
super(power, potency, cost);
this.setMaxNumberHit(1+potency);
this.setRadius(2);
this.setRange(3);
}
@Override
protected boolean entityEffect(World world, Entity entity)
{
for(int i=0;i<=this.powerUpgrades;i++)
{
double randX = (world.rand.nextDouble()-world.rand.nextDouble())*3;
double randY = -world.rand.nextDouble()*3;
double randZ = (world.rand.nextDouble()-world.rand.nextDouble())*3;
EntitySnowball snowball = new EntitySnowball(world, entity.posX-3*randX, entity.posY-3*randY, entity.posZ-3*randZ);
snowball.motionX = randX;
snowball.motionY = randY;
snowball.motionZ = randZ;
world.spawnEntityInWorld(snowball);
}
return true;
}
}

View file

@ -0,0 +1,45 @@
package WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.ice;
import net.minecraft.entity.Entity;
import net.minecraft.init.Blocks;
import net.minecraft.util.Vec3;
import net.minecraft.world.World;
import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper;
import WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.ExtrapolatedMeleeEntityEffect;
public class MeleeOffensiveIce extends ExtrapolatedMeleeEntityEffect
{
public MeleeOffensiveIce(int power, int potency, int cost)
{
super(power, potency, cost);
this.setMaxNumberHit(1+potency);
this.setRadius(2);
this.setRange(3);
}
@Override
protected boolean entityEffect(World world, Entity entity)
{
Vec3 blockVector = SpellHelper.getEntityBlockVector(entity);
int posX = (int)(blockVector.xCoord);
int posY = (int)(blockVector.yCoord);
int posZ = (int)(blockVector.zCoord);
double yVel = 1*(0.3*this.powerUpgrades+0.90);
entity.motionY = yVel;
for(int i=0;i<2;i++)
{
if(world.isAirBlock(posX,posY+i,posZ))
{
world.setBlock(posX, posY+i, posZ, Blocks.ice);
}
}
entity.fallDistance = 0.0f;
return true;
}
}

View file

@ -0,0 +1,40 @@
package WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.ice;
import net.minecraft.entity.Entity;
import net.minecraft.init.Blocks;
import net.minecraft.util.MovingObjectPosition;
import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
import WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.ProjectileImpactEffect;
public class ProjectileDefaultIce extends ProjectileImpactEffect
{
public ProjectileDefaultIce(int power, int potency, int cost)
{
super(power, potency, cost);
}
@Override
public void onEntityImpact(Entity mop)
{
return;
}
@Override
public void onTileImpact(World world, MovingObjectPosition mop)
{
int horizRadius = this.powerUpgrades+1;
int vertRadius = this.potencyUpgrades;
ForgeDirection sideHit = ForgeDirection.getOrientation(mop.sideHit);
int posX = mop.blockX + sideHit.offsetX;
int posY = mop.blockY + sideHit.offsetY;
int posZ = mop.blockZ + sideHit.offsetZ;
if(world.isAirBlock(posX, posY, posZ))
{
world.setBlock(posX, posY, posZ, Blocks.ice);
}
}
}

View file

@ -0,0 +1,50 @@
package WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.ice;
import net.minecraft.block.Block;
import net.minecraft.entity.Entity;
import net.minecraft.init.Blocks;
import net.minecraft.util.MovingObjectPosition;
import net.minecraft.world.World;
import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper;
import WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.ProjectileImpactEffect;
public class ProjectileDefensiveIce extends ProjectileImpactEffect
{
public ProjectileDefensiveIce(int power, int potency, int cost)
{
super(power, potency, cost);
}
@Override
public void onEntityImpact(Entity mop)
{
return;
}
@Override
public void onTileImpact(World world, MovingObjectPosition mop)
{
int horizRadius = this.powerUpgrades+1;
int vertRadius = this.potencyUpgrades;
int posX = mop.blockX;
int posY = mop.blockY;
int posZ = mop.blockZ;
for(int i=-horizRadius; i<=horizRadius; i++)
{
for(int k=-horizRadius; k<=horizRadius; k++)
{
for(int j=-vertRadius; j<=vertRadius; j++)
{
SpellHelper.freezeWaterBlock(world, posX+i, posY+j, posZ+k);
if(world.isAirBlock(posX+i, posY+j, posZ+k)&&!world.isAirBlock(posX+i, posY+j-1, posZ+k))
{
world.setBlock(posX+i, posY+j, posZ+k, Blocks.snow);
}
}
}
}
}
}

View file

@ -0,0 +1,39 @@
package WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.ice;
import net.minecraft.entity.Entity;
import net.minecraft.util.Vec3;
import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper;
import WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.ProjectileUpdateEffect;
public class ProjectileEnvironmentalIce extends ProjectileUpdateEffect
{
public ProjectileEnvironmentalIce(int power, int potency, int cost)
{
super(power, potency, cost);
}
@Override
public void onUpdateEffect(Entity projectile)
{
Vec3 posVec = SpellHelper.getEntityBlockVector(projectile);
int horizRange = this.powerUpgrades+1;
int vertRange = this.potencyUpgrades+1;
int posX = (int)(posVec.xCoord);
int posY = (int)(posVec.yCoord);
int posZ = (int)(posVec.zCoord);
for(int i=-horizRange; i<=horizRange; i++)
{
for(int j=-vertRange; j<=vertRange; j++)
{
for(int k=-horizRange; k<=horizRange; k++)
{
SpellHelper.freezeWaterBlock(projectile.worldObj, posX+i, posY+j, posZ+k);
}
}
}
}
}

View file

@ -0,0 +1,32 @@
package WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.ice;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.potion.Potion;
import net.minecraft.potion.PotionEffect;
import net.minecraft.util.MovingObjectPosition;
import net.minecraft.world.World;
import WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.ProjectileImpactEffect;
public class ProjectileOffensiveIce extends ProjectileImpactEffect
{
public ProjectileOffensiveIce(int power, int potency, int cost)
{
super(power, potency, cost);
}
@Override
public void onEntityImpact(Entity mop)
{
if(mop instanceof EntityLivingBase)
{
((EntityLivingBase) mop).addPotionEffect(new PotionEffect(Potion.moveSlowdown.id,60*(this.powerUpgrades+1),this.potencyUpgrades));
}
}
@Override
public void onTileImpact(World world, MovingObjectPosition mop)
{
return;
}
}

View file

@ -0,0 +1,43 @@
package WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.ice;
import ibxm.Player;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Blocks;
import net.minecraft.util.Vec3;
import net.minecraft.world.World;
import WayofTime.alchemicalWizardry.common.PacketHandler;
import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper;
import WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.SelfSpellEffect;
public class SelfDefaultIce extends SelfSpellEffect
{
public SelfDefaultIce(int power, int potency, int cost)
{
super(power, potency, cost);
}
@Override
public void onSelfUse(World world, EntityPlayer player)
{
Vec3 blockVector = SpellHelper.getEntityBlockVector(player);
int posX = (int)(blockVector.xCoord);
int posY = (int)(blockVector.yCoord);
int posZ = (int)(blockVector.zCoord);
double yVel = 1*(0.4*this.powerUpgrades+0.75);
//PacketDispatcher.sendPacketToPlayer(PacketHandler.getPlayerVelocitySettingPacket(player.motionX, yVel, player.motionZ),(Player)player);
SpellHelper.setPlayerSpeedFromServer(player, player.motionX, yVel, player.motionZ);
for(int i=0;i<2;i++)
{
if(world.isAirBlock(posX,posY+i,posZ))
{
world.setBlock(posX, posY+i, posZ, Blocks.ice);
}
}
player.fallDistance = 0.0f;
}
}

View file

@ -0,0 +1,21 @@
package WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.ice;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.potion.PotionEffect;
import net.minecraft.world.World;
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
import WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.SelfSpellEffect;
public class SelfDefensiveIce extends SelfSpellEffect
{
public SelfDefensiveIce(int power, int potency, int cost)
{
super(power, potency, cost);
}
@Override
public void onSelfUse(World world, EntityPlayer player)
{
player.addPotionEffect(new PotionEffect(AlchemicalWizardry.customPotionIceCloak.id,300*(2*this.powerUpgrades+1),this.potencyUpgrades));
}
}

View file

@ -0,0 +1,46 @@
package WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.ice;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Blocks;
import net.minecraft.util.Vec3;
import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper;
import WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.SelfSpellEffect;
public class SelfEnvironmentalIce extends SelfSpellEffect
{
public SelfEnvironmentalIce(int power, int potency, int cost)
{
super(power, potency, cost);
}
@Override
public void onSelfUse(World world, EntityPlayer player)
{
ForgeDirection look = SpellHelper.getCompassDirectionForLookVector(player.getLookVec());
int width = this.potencyUpgrades + 1;
int length = 5*this.powerUpgrades + 3;
int xOffset = look.offsetX;
int zOffset = look.offsetZ;
Vec3 lookVec = SpellHelper.getEntityBlockVector(player);
int xStart = (int)(lookVec.xCoord);
int zStart = (int)(lookVec.zCoord);
int yStart = (int)(lookVec.yCoord)-1;
for(int i=-width; i<=width; i++)
{
for(int j=0; j<length;j++)
{
if(world.isAirBlock(xStart + i*(zOffset) + j*(xOffset), yStart, zStart + i*(xOffset) + j*(zOffset)))
{
world.setBlock(xStart + i*(zOffset) + j*(xOffset), yStart, zStart + i*(xOffset) + j*(zOffset), Blocks.ice);
}
}
}
}
}

View file

@ -0,0 +1,52 @@
package WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.ice;
import java.util.List;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.potion.Potion;
import net.minecraft.potion.PotionEffect;
import net.minecraft.world.World;
import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper;
import WayofTime.alchemicalWizardry.common.spell.complex.effect.impactEffects.SelfSpellEffect;
public class SelfOffensiveIce extends SelfSpellEffect
{
public SelfOffensiveIce(int power, int potency, int cost)
{
super(power, potency, cost);
}
@Override
public void onSelfUse(World world, EntityPlayer player)
{
double horizRadius = this.powerUpgrades+1;
double vertRadius = 0.5*this.powerUpgrades+1;
List<Entity> entities = SpellHelper.getEntitiesInRange(world, player.posX, player.posY, player.posZ,horizRadius, vertRadius);
if(entities==null)
{
return;
}
int i=0;
int number = this.powerUpgrades+1;
for(Entity entity : entities)
{
if(i>=number)
{
continue;
}
if(entity instanceof EntityLivingBase && !entity.equals(player))
{
((EntityLivingBase) entity).addPotionEffect(new PotionEffect(Potion.moveSlowdown.id,60*(1+this.powerUpgrades),this.potencyUpgrades));
i++;
}
}
}
}

View file

@ -0,0 +1,20 @@
package WayofTime.alchemicalWizardry.common.spell.complex.enhancement;
public class SpellEnhancement
{
public static final int POWER = 0;
public static final int EFFICIENCY = 1;
public static final int POTENCY = 2;
private int state = this.POWER;
protected SpellEnhancement(int state)
{
this.state = state;
}
public int getState()
{
return this.state;
}
}

View file

@ -0,0 +1,10 @@
package WayofTime.alchemicalWizardry.common.spell.complex.enhancement;
public class SpellEnhancementCost extends SpellEnhancement
{
public SpellEnhancementCost()
{
super(SpellEnhancement.EFFICIENCY);
}
}

View file

@ -0,0 +1,10 @@
package WayofTime.alchemicalWizardry.common.spell.complex.enhancement;
public class SpellEnhancementPotency extends SpellEnhancement
{
public SpellEnhancementPotency()
{
super(SpellEnhancement.POTENCY);
}
}

View file

@ -0,0 +1,10 @@
package WayofTime.alchemicalWizardry.common.spell.complex.enhancement;
public class SpellEnhancementPower extends SpellEnhancement
{
public SpellEnhancementPower()
{
super(SpellEnhancement.POWER);
}
}

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,174 @@
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));
par2World.spawnEntityInWorld(new FireProjectile(par2World, par3EntityPlayer, 7));
}
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.getAABBPool().getAABB((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.getAABBPool().getAABB(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.getAABBPool().getAABB((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.getAABBPool().getAABB((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.getAABBPool().getAABB((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.getAABBPool().getAABB(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.getAABBPool().getAABB((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;
}
}