Testing the creation of hell

This commit is contained in:
WayofTime 2014-10-31 17:35:30 -04:00
parent 796e75b1f9
commit a2b006105e
2587 changed files with 0 additions and 129617 deletions

View file

@ -0,0 +1,516 @@
package WayofTime.alchemicalWizardry.common.entity.projectile;
import cpw.mods.fml.common.registry.IThrowableEntity;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.block.Block;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.IProjectile;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.potion.Potion;
import net.minecraft.potion.PotionEffect;
import net.minecraft.util.*;
import net.minecraft.world.World;
import java.util.Iterator;
import java.util.List;
//Shamelessly ripped off from x3n0ph0b3
public class EnergyBlastProjectile extends Entity implements IProjectile, IThrowableEntity
{
protected int xTile = -1;
protected int yTile = -1;
protected int zTile = -1;
protected int inTile = 0;
protected int inData = 0;
protected boolean inGround = false;
/**
* The owner of this arrow.
*/
public EntityLivingBase shootingEntity;
protected int ticksInAir = 0;
protected int maxTicksInAir = 600;
private int ricochetCounter = 0;
private boolean scheduledForDeath = false;
protected int projectileDamage;
public EnergyBlastProjectile(World par1World)
{
super(par1World);
this.setSize(0.5F, 0.5F);
this.maxTicksInAir = 600;
}
public EnergyBlastProjectile(World par1World, double par2, double par4, double par6)
{
super(par1World);
this.setSize(0.5F, 0.5F);
this.setPosition(par2, par4, par6);
yOffset = 0.0F;
this.maxTicksInAir = 600;
}
public EnergyBlastProjectile(World par1World, EntityLivingBase par2EntityPlayer, int damage)
{
super(par1World);
shootingEntity = par2EntityPlayer;
float par3 = 0.8F;
this.setSize(0.5F, 0.5F);
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);
this.projectileDamage = damage;
this.maxTicksInAir = 600;
}
public EnergyBlastProjectile(World par1World, EntityLivingBase par2EntityPlayer, int damage, int maxTicksInAir, double posX, double posY, double posZ, float rotationYaw, float rotationPitch)
{
super(par1World);
shootingEntity = par2EntityPlayer;
float par3 = 0.8F;
this.setSize(0.5F, 0.5F);
this.setLocationAndAngles(posX, posY, posZ, rotationYaw, 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);
this.projectileDamage = damage;
this.maxTicksInAir = maxTicksInAir;
}
public EnergyBlastProjectile(World par1World, EntityLivingBase par2EntityLivingBase, EntityLivingBase par3EntityLivingBase, float par4, float par5, int damage, int maxTicksInAir)
{
super(par1World);
this.renderDistanceWeight = 10.0D;
this.shootingEntity = par2EntityLivingBase;
this.posY = par2EntityLivingBase.posY + (double) par2EntityLivingBase.getEyeHeight() - 0.10000000149011612D;
double d0 = par3EntityLivingBase.posX - par2EntityLivingBase.posX;
double d1 = par3EntityLivingBase.boundingBox.minY + (double) (par3EntityLivingBase.height / 1.5F) - this.posY;
double d2 = par3EntityLivingBase.posZ - par2EntityLivingBase.posZ;
double d3 = (double) MathHelper.sqrt_double(d0 * d0 + d2 * d2);
if (d3 >= 1.0E-7D)
{
float f2 = (float) (Math.atan2(d2, d0) * 180.0D / Math.PI) - 90.0F;
float f3 = (float) (-(Math.atan2(d1, d3) * 180.0D / Math.PI));
double d4 = d0 / d3;
double d5 = d2 / d3;
this.setLocationAndAngles(par2EntityLivingBase.posX + d4, this.posY, par2EntityLivingBase.posZ + d5, f2, f3);
this.yOffset = 0.0F;
float f4 = (float) d3 * 0.2F;
this.setThrowableHeading(d0, d1, d2, par4, par5);
}
this.projectileDamage = damage;
this.maxTicksInAir = maxTicksInAir;
}
@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();
if (ticksInAir > maxTicksInAir)
{
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(Vec3.createVectorHelper(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)
{
}
} else
{
++ticksInAir;
if (ticksInAir > 1 && ticksInAir < 3)
{
for (int particles = 0; particles < 3; particles++)
{
this.doFiringParticles();
}
}
Vec3 var17 = Vec3.createVectorHelper(posX, posY, posZ);
Vec3 var3 = Vec3.createVectorHelper(posX + motionX, posY + motionY, posZ + motionZ);
MovingObjectPosition var4 = worldObj.func_147447_a(var17, var3, true, false, false);
var17 = Vec3.createVectorHelper(posX, posY, posZ);
var3 = Vec3.createVectorHelper(posX + motionX, posY + motionY, posZ + motionZ);
if (var4 != null)
{
var3 = Vec3.createVectorHelper(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);
}
}
public 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));
par1NBTTagCompound.setInteger("ticksInAir", ticksInAir);
par1NBTTagCompound.setInteger("maxTicksInAir", maxTicksInAir);
par1NBTTagCompound.setInteger("projectileDamage", this.projectileDamage);
}
/**
* (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;
ticksInAir = par1NBTTagCompound.getInteger("ticksInAir");
maxTicksInAir = par1NBTTagCompound.getInteger("maxTicksInAir");
projectileDamage = par1NBTTagCompound.getInteger("projectileDamage");
}
/**
* 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;
}
public void onImpact(MovingObjectPosition mop)
{
if (mop.typeOfHit == MovingObjectPosition.MovingObjectType.ENTITY && mop.entityHit != null)
{
if (mop.entityHit == shootingEntity)
{
return;
}
this.onImpact(mop.entityHit);
} else if (mop.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK)
{
worldObj.createExplosion(shootingEntity, this.posX, this.posY, this.posZ, (float) (0.1), true);
this.setDead();
}
}
public void onImpact(Entity mop)
{
if (mop == shootingEntity && ticksInAir > 3)
{
shootingEntity.attackEntityFrom(DamageSource.causeMobDamage(shootingEntity), 1);
this.setDead();
} else
{
if (mop instanceof EntityLivingBase)
{
((EntityLivingBase) mop).addPotionEffect(new PotionEffect(Potion.weakness.id, 60, 2));
}
doDamage(projectileDamage, mop);
worldObj.createExplosion(shootingEntity, this.posX, this.posY, this.posZ, (float) (0.1), true);
}
spawnHitParticles("magicCrit", 8);
this.setDead();
}
private int d6()
{
return rand.nextInt(6) + 1;
}
protected void spawnHitParticles(String string, int i)
{
for (int particles = 0; particles < i; particles++)
{
worldObj.spawnParticle(string, posX, posY - (string == "portal" ? 1 : 0), posZ, gaussian(motionX), gaussian(motionY), gaussian(motionZ));
}
}
protected void doDamage(int i, Entity mop)
{
mop.attackEntityFrom(this.getDamageSource(), i);
}
public DamageSource getDamageSource()
{
return DamageSource.causeMobDamage(shootingEntity);
}
public double smallGauss(double d)
{
return (worldObj.rand.nextFloat() - 0.5D) * d;
}
public double gaussian(double d)
{
return d + d * ((rand.nextFloat() - 0.5D) / 4);
}
private int getRicochetMax()
{
return 0;
}
@Override
public Entity getThrower()
{
// TODO Auto-generated method stub
return this.shootingEntity;
}
@Override
public void setThrower(Entity entity)
{
if (entity instanceof EntityLivingBase)
this.shootingEntity = (EntityLivingBase) entity;
}
}

View file

@ -0,0 +1,16 @@
package WayofTime.alchemicalWizardry.common.entity.projectile;
import net.minecraft.client.particle.EntityFX;
import net.minecraft.world.World;
public class EntityBeamParticle extends EntityFX
{
protected EntityBeamParticle(World p_i1218_1_, double p_i1218_2_,
double p_i1218_4_, double p_i1218_6_)
{
super(p_i1218_1_, p_i1218_2_, p_i1218_4_, p_i1218_6_);
// TODO Auto-generated constructor stub
}
}

View file

@ -0,0 +1,121 @@
package WayofTime.alchemicalWizardry.common.entity.projectile;
import WayofTime.alchemicalWizardry.ModBlocks;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.init.Blocks;
import net.minecraft.util.DamageSource;
import net.minecraft.util.MovingObjectPosition;
import net.minecraft.world.World;
public class EntityBloodLightProjectile extends EnergyBlastProjectile
{
public EntityBloodLightProjectile(World par1World)
{
super(par1World);
}
public EntityBloodLightProjectile(World par1World, double par2, double par4, double par6)
{
super(par1World, par2, par4, par6);
}
public EntityBloodLightProjectile(World par1World, EntityLivingBase par2EntityPlayer, int damage)
{
super(par1World, par2EntityPlayer, damage);
}
public EntityBloodLightProjectile(World par1World, EntityLivingBase par2EntityPlayer, int damage, int maxTicksInAir, double posX, double posY, double posZ, float rotationYaw, float rotationPitch)
{
super(par1World, par2EntityPlayer, damage, maxTicksInAir, posX, posY, posZ, rotationYaw, rotationPitch);
}
public EntityBloodLightProjectile(World par1World, EntityLivingBase par2EntityLivingBase, EntityLivingBase par3EntityLivingBase, float par4, float par5, int damage, int maxTicksInAir)
{
super(par1World, par2EntityLivingBase, par3EntityLivingBase, par4, par5, damage, maxTicksInAir);
}
@Override
public DamageSource getDamageSource()
{
return DamageSource.causeMobDamage(shootingEntity);
}
@Override
public void onImpact(MovingObjectPosition mop)
{
if (mop.typeOfHit == MovingObjectPosition.MovingObjectType.ENTITY && mop.entityHit != null)
{
if (mop.entityHit == shootingEntity)
{
return;
}
this.onImpact(mop.entityHit);
} else if (mop.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK)
{
int sideHit = mop.sideHit;
int blockX = mop.blockX;
int blockY = mop.blockY;
int blockZ = mop.blockZ;
if (sideHit == 0 && this.worldObj.isAirBlock(blockX, blockY - 1, blockZ))
{
this.worldObj.setBlock(blockX, blockY - 1, blockZ, ModBlocks.blockBloodLight);
}
if (sideHit == 1 && this.worldObj.isAirBlock(blockX, blockY + 1, blockZ))
{
this.worldObj.setBlock(blockX, blockY + 1, blockZ, ModBlocks.blockBloodLight);
}
if (sideHit == 2 && this.worldObj.isAirBlock(blockX, blockY, blockZ - 1))
{
this.worldObj.setBlock(blockX, blockY, blockZ - 1, ModBlocks.blockBloodLight);
}
if (sideHit == 3 && this.worldObj.isAirBlock(blockX, blockY, blockZ + 1))
{
this.worldObj.setBlock(blockX, blockY, blockZ + 1, ModBlocks.blockBloodLight);
}
if (sideHit == 4 && this.worldObj.isAirBlock(blockX - 1, blockY, blockZ))
{
this.worldObj.setBlock(blockX - 1, blockY, blockZ, ModBlocks.blockBloodLight);
}
if (sideHit == 5 && this.worldObj.isAirBlock(blockX + 1, blockY, blockZ))
{
this.worldObj.setBlock(blockX + 1, blockY, blockZ, ModBlocks.blockBloodLight);
}
}
this.setDead();
}
@Override
public void onImpact(Entity mop)
{
if (mop == shootingEntity && ticksInAir > 3)
{
shootingEntity.attackEntityFrom(DamageSource.causeMobDamage(shootingEntity), 1);
this.setDead();
} else
{
if (mop instanceof EntityLivingBase)
{
((EntityLivingBase) mop).setRevengeTarget(shootingEntity);
doDamage(1, mop);
}
}
if (worldObj.isAirBlock((int) this.posX, (int) this.posY, (int) this.posZ))
{
worldObj.setBlock((int) this.posX, (int) this.posY, (int) this.posZ, Blocks.fire);
}
spawnHitParticles("magicCrit", 8);
this.setDead();
}
}

View file

@ -0,0 +1,99 @@
package WayofTime.alchemicalWizardry.common.entity.projectile;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.util.DamageSource;
import net.minecraft.util.MovingObjectPosition;
import net.minecraft.world.World;
public class EntityEnergyBazookaMainProjectile extends EnergyBlastProjectile
{
public EntityEnergyBazookaMainProjectile(World par1World)
{
super(par1World);
}
public EntityEnergyBazookaMainProjectile(World par1World, double par2, double par4, double par6)
{
super(par1World, par2, par4, par6);
}
public EntityEnergyBazookaMainProjectile(World par1World, EntityLivingBase par2EntityPlayer, int damage)
{
super(par1World, par2EntityPlayer, damage);
}
public EntityEnergyBazookaMainProjectile(World par1World, EntityLivingBase par2EntityPlayer, int damage, int maxTicksInAir, double posX, double posY, double posZ, float rotationYaw, float rotationPitch)
{
super(par1World, par2EntityPlayer, damage, maxTicksInAir, posX, posY, posZ, rotationYaw, rotationPitch);
}
public EntityEnergyBazookaMainProjectile(World par1World, EntityLivingBase par2EntityLivingBase, EntityLivingBase par3EntityLivingBase, float par4, float par5, int damage, int maxTicksInAir)
{
super(par1World, par2EntityLivingBase, par3EntityLivingBase, par4, par5, damage, maxTicksInAir);
}
@Override
public DamageSource getDamageSource()
{
return DamageSource.causeMobDamage(shootingEntity);
}
@Override
public void onImpact(MovingObjectPosition mop)
{
if (mop.typeOfHit == MovingObjectPosition.MovingObjectType.ENTITY && mop.entityHit != null)
{
if (mop.entityHit == shootingEntity)
{
return;
}
this.onImpact(mop.entityHit);
} else if (mop.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK)
{
worldObj.createExplosion(this.shootingEntity, this.posX, this.posY, this.posZ, (float) (5.0f), false);
this.spawnSecondaryProjectiles();
}
this.setDead();
}
@Override
public void onImpact(Entity mop)
{
if (mop == shootingEntity && ticksInAir > 3)
{
shootingEntity.attackEntityFrom(DamageSource.causeMobDamage(shootingEntity), 1);
this.setDead();
} else
{
if (mop instanceof EntityLivingBase)
{
spawnSecondaryProjectiles();
}
worldObj.createExplosion(this.shootingEntity, this.posX, this.posY, this.posZ, (float) (5.0f), false);
}
spawnHitParticles("magicCrit", 8);
this.setDead();
}
public void spawnSecondaryProjectiles()
{
for (int i = 0; i < 20; i++)
{
EntityEnergyBazookaSecondaryProjectile secProj = new EntityEnergyBazookaSecondaryProjectile(worldObj, this.posX, this.posY, this.posZ, 15);
secProj.shootingEntity = this.shootingEntity;
float xVel = rand.nextFloat() - rand.nextFloat();
float yVel = rand.nextFloat() - rand.nextFloat();
float zVel = rand.nextFloat() - rand.nextFloat();
float wantedVel = 0.5f;
secProj.motionX = xVel * wantedVel;
secProj.motionY = yVel * wantedVel;
secProj.motionZ = zVel * wantedVel;
worldObj.spawnEntityInWorld(secProj);
}
}
}

View file

@ -0,0 +1,504 @@
package WayofTime.alchemicalWizardry.common.entity.projectile;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.block.Block;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.IProjectile;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.*;
import net.minecraft.world.World;
import java.util.Iterator;
import java.util.List;
public class EntityEnergyBazookaSecondaryProjectile extends EnergyBlastProjectile 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 EntityLivingBase shootingEntity;
private int ticksInAir = 0;
private int ricochetCounter = 0;
private boolean scheduledForDeath = false;
public int damage;
public EntityEnergyBazookaSecondaryProjectile(World par1World)
{
super(par1World);
this.setSize(0.5F, 0.5F);
damage = 5;
}
public EntityEnergyBazookaSecondaryProjectile(World par1World, double par2, double par4, double par6, int damage)
{
super(par1World);
this.setSize(0.5F, 0.5F);
this.setPosition(par2, par4, par6);
yOffset = 0.0F;
this.damage = damage;
}
public EntityEnergyBazookaSecondaryProjectile(World par1World, EntityPlayer par2EntityPlayer, int damage)
{
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);
this.damage = damage;
}
@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();
if (ticksInAir > maxTicksInAir)
{
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(Vec3.createVectorHelper(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)
{
}
} else
{
++ticksInAir;
if (ticksInAir > 1 && ticksInAir < 3)
{
for (int particles = 0; particles < 3; particles++)
{
this.doFiringParticles();
}
}
Vec3 var17 = Vec3.createVectorHelper(posX, posY, posZ);
Vec3 var3 = Vec3.createVectorHelper(posX + motionX, posY + motionY, posZ + motionZ);
MovingObjectPosition var4 = worldObj.func_147447_a(var17, var3, true, false, false);
var17 = Vec3.createVectorHelper(posX, posY, posZ);
var3 = Vec3.createVectorHelper(posX + motionX, posY + motionY, posZ + motionZ);
if (var4 != null)
{
var3 = Vec3.createVectorHelper(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);
}
}
public 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));
}
/**
* (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;
}
/**
* 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;
}
public void onImpact(MovingObjectPosition mop)
{
if (mop.typeOfHit == MovingObjectPosition.MovingObjectType.ENTITY && mop.entityHit != null)
{
if (mop.entityHit == shootingEntity)
{
return;
}
this.onImpact(mop.entityHit);
} else if (mop.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK)
{
this.groundImpact(mop.sideHit);
worldObj.createExplosion(shootingEntity, posX, posY, posZ, 2, false);
}
}
public void onImpact(Entity mop)
{
if (mop == shootingEntity && ticksInAir > 3)
{
shootingEntity.attackEntityFrom(DamageSource.causeMobDamage(shootingEntity), 1);
this.setDead();
} else
{
doDamage(this.damage + d6(), mop);
worldObj.createExplosion(shootingEntity, posX, posY, posZ, 2, false);
}
spawnHitParticles("magicCrit", 8);
this.setDead();
}
private int d6()
{
return rand.nextInt(6) + 1;
}
public void spawnHitParticles(String string, int i)
{
for (int particles = 0; particles < i; particles++)
{
worldObj.spawnParticle(string, posX, posY - (string == "portal" ? 1 : 0), posZ, gaussian(motionX), gaussian(motionY), gaussian(motionZ));
}
}
public void doDamage(int i, Entity mop)
{
mop.attackEntityFrom(this.getDamageSource(), i);
}
public DamageSource getDamageSource()
{
return DamageSource.causeMobDamage(shootingEntity);
}
public void groundImpact(int sideHit)
{
this.ricochet(sideHit);
}
public double smallGauss(double d)
{
return (worldObj.rand.nextFloat() - 0.5D) * d;
}
public 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;
}
}
}
}
private int getRicochetMax()
{
return 3;
}
}

View file

@ -0,0 +1,90 @@
package WayofTime.alchemicalWizardry.common.entity.projectile;
import WayofTime.alchemicalWizardry.common.summoning.meteor.MeteorRegistry;
import net.minecraft.entity.Entity;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.DamageSource;
import net.minecraft.util.MovingObjectPosition;
import net.minecraft.world.World;
public class EntityMeteor extends EnergyBlastProjectile
{
private int meteorID;
public boolean hasTerrae;
public boolean hasOrbisTerrae;
public boolean hasCrystallos;
public boolean hasIncendium;
public boolean hasTennebrae;
public EntityMeteor(World par1World)
{
super(par1World);
this.meteorID = 0;
}
public EntityMeteor(World par1World, double par2, double par4, double par6, int meteorID)
{
super(par1World, par2, par4, par6);
this.meteorID = meteorID;
}
@Override
public void writeEntityToNBT(NBTTagCompound par1NBTTagCompound)
{
super.writeEntityToNBT(par1NBTTagCompound);
par1NBTTagCompound.setInteger("meteorID", meteorID);
par1NBTTagCompound.setBoolean("hasTerrae", hasTerrae);
par1NBTTagCompound.setBoolean("hasOrbisTerrae", hasOrbisTerrae);
par1NBTTagCompound.setBoolean("hasCrystallos", hasCrystallos);
par1NBTTagCompound.setBoolean("hasIncendium", hasIncendium);
par1NBTTagCompound.setBoolean("hasTennebrae", hasTennebrae);
}
@Override
public void readEntityFromNBT(NBTTagCompound par1NBTTagCompound)
{
super.readEntityFromNBT(par1NBTTagCompound);
meteorID = par1NBTTagCompound.getInteger("meteorID");
hasTerrae = par1NBTTagCompound.getBoolean("hasTerrae");
hasOrbisTerrae = par1NBTTagCompound.getBoolean("hasOrbisTerrae");
hasIncendium = par1NBTTagCompound.getBoolean("hasIncendium");
hasCrystallos = par1NBTTagCompound.getBoolean("hasCrystallos");
hasTennebrae = par1NBTTagCompound.getBoolean("hasTennebrae");
}
@Override
public DamageSource getDamageSource()
{
return DamageSource.fallingBlock;
}
@Override
public void onImpact(MovingObjectPosition mop)
{
if (worldObj.isRemote)
{
return;
}
if (mop.typeOfHit == MovingObjectPosition.MovingObjectType.ENTITY && mop.entityHit != null)
{
this.onImpact(mop.entityHit);
} else if (mop.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK)
{
MeteorRegistry.createMeteorImpact(worldObj, mop.blockX, mop.blockY, mop.blockZ, this.meteorID, new boolean[]{hasTerrae, hasOrbisTerrae, hasCrystallos, hasIncendium, hasTennebrae});
}
this.setDead();
}
@Override
public void onImpact(Entity mop)
{
MeteorRegistry.createMeteorImpact(worldObj, (int) this.posX, (int) this.posY, (int) this.posZ, meteorID, new boolean[]{hasTerrae, hasOrbisTerrae, hasCrystallos, hasIncendium, hasTennebrae});
this.setDead();
}
}

View file

@ -0,0 +1,348 @@
package WayofTime.alchemicalWizardry.common.entity.projectile;
import cpw.mods.fml.client.FMLClientHandler;
import cpw.mods.fml.common.registry.IThrowableEntity;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.client.particle.EntityCloudFX;
import net.minecraft.client.particle.EntityFX;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.IProjectile;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.DamageSource;
import net.minecraft.util.MathHelper;
import net.minecraft.world.World;
//Shamelessly ripped off from x3n0ph0b3
public class EntityParticleBeam extends Entity implements IProjectile, IThrowableEntity
{
protected int xTile = -1;
protected int yTile = -1;
protected int zTile = -1;
protected int inTile = 0;
protected int inData = 0;
protected float colourRed = 0f;
protected float colourGreen = 0f;
protected float colourBlue = 0f;
protected int xDest = 0;
protected int yDest = 0;
protected int zDest = 0;
protected boolean inGround = false;
/**
* The owner of this arrow.
*/
public EntityLivingBase shootingEntity;
protected int ticksInAir = 0;
protected int maxTicksInAir = 600;
private int ricochetCounter = 0;
private boolean scheduledForDeath = false;
protected int projectileDamage;
public EntityParticleBeam(World par1World)
{
super(par1World);
this.setSize(0.5F, 0.5F);
this.maxTicksInAir = 600;
}
public EntityParticleBeam(World par1World, double par2, double par4, double par6)
{
super(par1World);
this.setSize(0.5F, 0.5F);
this.setPosition(par2, par4, par6);
yOffset = 0.0F;
this.maxTicksInAir = 600;
}
public EntityParticleBeam(World par1World, EntityLivingBase par2EntityPlayer, int damage)
{
super(par1World);
shootingEntity = par2EntityPlayer;
float par3 = 0.8F;
this.setSize(0.5F, 0.5F);
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);
this.projectileDamage = damage;
this.maxTicksInAir = 600;
}
public EntityParticleBeam(World par1World, EntityLivingBase par2EntityPlayer, int damage, int maxTicksInAir, double posX, double posY, double posZ, float rotationYaw, float rotationPitch)
{
super(par1World);
shootingEntity = par2EntityPlayer;
float par3 = 0.8F;
this.setSize(0.5F, 0.5F);
this.setLocationAndAngles(posX, posY, posZ, rotationYaw, 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);
this.projectileDamage = damage;
this.maxTicksInAir = maxTicksInAir;
}
public EntityParticleBeam(World par1World, EntityLivingBase par2EntityLivingBase, EntityLivingBase par3EntityLivingBase, float par4, float par5, int damage, int maxTicksInAir)
{
super(par1World);
this.renderDistanceWeight = 10.0D;
this.shootingEntity = par2EntityLivingBase;
this.posY = par2EntityLivingBase.posY + (double) par2EntityLivingBase.getEyeHeight() - 0.10000000149011612D;
double d0 = par3EntityLivingBase.posX - par2EntityLivingBase.posX;
double d1 = par3EntityLivingBase.boundingBox.minY + (double) (par3EntityLivingBase.height / 1.5F) - this.posY;
double d2 = par3EntityLivingBase.posZ - par2EntityLivingBase.posZ;
double d3 = (double) MathHelper.sqrt_double(d0 * d0 + d2 * d2);
if (d3 >= 1.0E-7D)
{
float f2 = (float) (Math.atan2(d2, d0) * 180.0D / Math.PI) - 90.0F;
float f3 = (float) (-(Math.atan2(d1, d3) * 180.0D / Math.PI));
double d4 = d0 / d3;
double d5 = d2 / d3;
this.setLocationAndAngles(par2EntityLivingBase.posX + d4, this.posY, par2EntityLivingBase.posZ + d5, f2, f3);
this.yOffset = 0.0F;
float f4 = (float) d3 * 0.2F;
this.setThrowableHeading(d0, d1, d2, par4, par5);
}
this.projectileDamage = damage;
this.maxTicksInAir = maxTicksInAir;
}
@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();
if (ticksInAir > maxTicksInAir)
{
this.setDead();
}
posX += motionX;
posY += motionY;
posZ += motionZ;
MathHelper.sqrt_double(motionX * motionX + motionZ * motionZ);
this.setPosition(posX, posY, posZ);
this.doFiringParticles();
if (Math.pow(posX - xDest, 2) + Math.pow(posY - yDest, 2) + Math.pow(posZ - zDest, 2) <= 1)
{
this.scheduledForDeath = true;
}
if (this.scheduledForDeath)
{
this.setDead();
}
}
public void doFiringParticles()
{
if (!worldObj.isRemote)
{
return;
}
EntityFX particle = new EntityCloudFX(worldObj, posX, posY, posZ, 0, 0, 0);
particle.setRBGColorF(colourRed + 0.15f * (worldObj.rand.nextFloat() - worldObj.rand.nextFloat()), colourGreen + 0.15f * (worldObj.rand.nextFloat() - worldObj.rand.nextFloat()), colourBlue + 0.15f * (worldObj.rand.nextFloat() - worldObj.rand.nextFloat()));
FMLClientHandler.instance().getClient().effectRenderer.addEffect(particle);
}
/**
* (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));
par1NBTTagCompound.setInteger("ticksInAir", ticksInAir);
par1NBTTagCompound.setInteger("maxTicksInAir", maxTicksInAir);
par1NBTTagCompound.setInteger("projectileDamage", this.projectileDamage);
par1NBTTagCompound.setFloat("colourRed", colourRed);
par1NBTTagCompound.setFloat("colourGreen", colourGreen);
par1NBTTagCompound.setFloat("colourBlue", colourBlue);
par1NBTTagCompound.setInteger("xDest", xDest);
par1NBTTagCompound.setInteger("yDest", yDest);
par1NBTTagCompound.setInteger("zDest", zDest);
}
/**
* (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;
ticksInAir = par1NBTTagCompound.getInteger("ticksInAir");
maxTicksInAir = par1NBTTagCompound.getInteger("maxTicksInAir");
projectileDamage = par1NBTTagCompound.getInteger("projectileDamage");
colourRed = par1NBTTagCompound.getFloat("colourRed");
colourGreen = par1NBTTagCompound.getFloat("colourGreen");
colourBlue = par1NBTTagCompound.getFloat("colourBlue");
xDest = par1NBTTagCompound.getInteger("xDest");
yDest = par1NBTTagCompound.getInteger("yDest");
zDest = par1NBTTagCompound.getInteger("zDest");
}
@Override
protected boolean canTriggerWalking()
{
return false;
}
@Override
@SideOnly(Side.CLIENT)
public float getShadowSize()
{
return 0.0F;
}
protected void spawnHitParticles(String string, int i)
{
for (int particles = 0; particles < i; particles++)
{
worldObj.spawnParticle(string, posX, posY - (string == "portal" ? 1 : 0), posZ, gaussian(motionX), gaussian(motionY), gaussian(motionZ));
}
}
public DamageSource getDamageSource()
{
return DamageSource.causeMobDamage(shootingEntity);
}
public double smallGauss(double d)
{
return (worldObj.rand.nextFloat() - 0.5D) * d;
}
public double gaussian(double d)
{
return d + d * ((rand.nextFloat() - 0.5D) / 4);
}
private int getRicochetMax()
{
return 0;
}
@Override
public Entity getThrower()
{
// TODO Auto-generated method stub
return this.shootingEntity;
}
@Override
public void setThrower(Entity entity)
{
if (entity instanceof EntityLivingBase)
this.shootingEntity = (EntityLivingBase) entity;
}
public void setColour(float red, float green, float blue)
{
this.colourRed = red;
this.colourGreen = green;
this.colourBlue = blue;
}
public void setDestination(int xDest, int yDest, int zDest)
{
this.xDest = xDest;
this.yDest = yDest;
this.zDest = zDest;
}
}

View file

@ -0,0 +1,113 @@
package WayofTime.alchemicalWizardry.common.entity.projectile;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.DamageSource;
import net.minecraft.util.MovingObjectPosition;
import net.minecraft.world.World;
public class ExplosionProjectile extends EnergyBlastProjectile
{
protected boolean causesEnvDamage;
public ExplosionProjectile(World par1World)
{
super(par1World);
}
public ExplosionProjectile(World par1World, double par2, double par4, double par6)
{
super(par1World, par2, par4, par6);
}
public ExplosionProjectile(World par1World, EntityLivingBase par2EntityPlayer, int damage, boolean flag)
{
super(par1World, par2EntityPlayer, damage);
causesEnvDamage = flag;
}
public ExplosionProjectile(World par1World, EntityLivingBase par2EntityPlayer, int damage, int maxTicksInAir, double posX, double posY, double posZ, float rotationYaw, float rotationPitch, boolean flag)
{
super(par1World, par2EntityPlayer, damage, maxTicksInAir, posX, posY, posZ, rotationYaw, rotationPitch);
causesEnvDamage = flag;
}
@Override
public DamageSource getDamageSource()
{
return DamageSource.causeMobDamage(shootingEntity);
}
@Override
public void onImpact(MovingObjectPosition mop)
{
if (mop.typeOfHit == MovingObjectPosition.MovingObjectType.ENTITY && mop.entityHit != null)
{
if (mop.entityHit == shootingEntity)
{
return;
}
worldObj.createExplosion(this, this.posX, this.posY, this.posZ, (float) (2), causesEnvDamage);
} else if (mop.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK)
{
worldObj.createExplosion(this, this.posX, this.posY, this.posZ, (float) (2), causesEnvDamage);
}
this.setDead();
}
@Override
public void onImpact(Entity mop)
{
if (mop == shootingEntity && ticksInAir > 3)
{
shootingEntity.attackEntityFrom(DamageSource.causeMobDamage(shootingEntity), 1);
this.setDead();
} else
{
if (mop instanceof EntityLivingBase)
{
if (((EntityLivingBase) mop).isImmuneToFire())
{
doDamage((int) (projectileDamage), mop);
} else
{
doDamage(projectileDamage, mop);
}
}
}
if (worldObj.isAirBlock((int) this.posX, (int) this.posY, (int) this.posZ))
{
}
spawnHitParticles("magicCrit", 8);
this.setDead();
}
@Override
public 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("explode", posX, posY, posZ, gaussian(motionX), gaussian(motionY), gaussian(motionZ));
}
@Override
public void writeEntityToNBT(NBTTagCompound par1NBTTagCompound)
{
super.writeEntityToNBT(par1NBTTagCompound);
par1NBTTagCompound.setBoolean("causesEnvDamage", causesEnvDamage);
}
/**
* (abstract) Protected helper method to read subclass entity data from NBT.
*/
@Override
public void readEntityFromNBT(NBTTagCompound par1NBTTagCompound)
{
super.readEntityFromNBT(par1NBTTagCompound);
causesEnvDamage = par1NBTTagCompound.getBoolean("causesEnvDamage");
}
}

View file

@ -0,0 +1,108 @@
package WayofTime.alchemicalWizardry.common.entity.projectile;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.init.Blocks;
import net.minecraft.potion.Potion;
import net.minecraft.util.DamageSource;
import net.minecraft.util.MovingObjectPosition;
import net.minecraft.world.World;
public class FireProjectile extends EnergyBlastProjectile
{
public FireProjectile(World par1World)
{
super(par1World);
}
public FireProjectile(World par1World, double par2, double par4, double par6)
{
super(par1World, par2, par4, par6);
}
public FireProjectile(World par1World, EntityLivingBase par2EntityPlayer, int damage)
{
super(par1World, par2EntityPlayer, damage);
}
public FireProjectile(World par1World, EntityLivingBase par2EntityPlayer, int damage, int maxTicksInAir, double posX, double posY, double posZ, float rotationYaw, float rotationPitch)
{
super(par1World, par2EntityPlayer, damage, maxTicksInAir, posX, posY, posZ, rotationYaw, rotationPitch);
}
public FireProjectile(World par1World, EntityLivingBase par2EntityLivingBase, EntityLivingBase par3EntityLivingBase, float par4, float par5, int damage, int maxTicksInAir)
{
super(par1World, par2EntityLivingBase, par3EntityLivingBase, par4, par5, damage, maxTicksInAir);
}
@Override
public DamageSource getDamageSource()
{
return DamageSource.causeMobDamage(shootingEntity);
}
@Override
public void onImpact(MovingObjectPosition mop)
{
if (mop.typeOfHit == MovingObjectPosition.MovingObjectType.ENTITY && mop.entityHit != null)
{
if (mop.entityHit == shootingEntity)
{
return;
}
this.onImpact(mop.entityHit);
} else if (mop.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK)
{
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) this.posX + i, (int) this.posY + j, (int) this.posZ + k))
{
worldObj.setBlock((int) this.posX + i, (int) this.posY + j, (int) this.posZ + k, Blocks.fire);
}
}
}
}
}
this.setDead();
}
@Override
public void onImpact(Entity mop)
{
if (mop == shootingEntity && ticksInAir > 3)
{
shootingEntity.attackEntityFrom(DamageSource.causeMobDamage(shootingEntity), 1);
this.setDead();
} else
{
if (mop instanceof EntityLivingBase)
{
((EntityLivingBase) mop).setFire(50);
((EntityLivingBase) mop).setRevengeTarget(shootingEntity);
if (((EntityLivingBase) mop).isPotionActive(Potion.fireResistance) || ((EntityLivingBase) mop).isImmuneToFire())
{
((EntityLivingBase) mop).attackEntityFrom(DamageSource.causeMobDamage(shootingEntity), 1);
} else
{
doDamage(projectileDamage, mop);
((EntityLivingBase) mop).hurtResistantTime = 0;
}
}
}
if (worldObj.isAirBlock((int) this.posX, (int) this.posY, (int) this.posZ))
{
worldObj.setBlock((int) this.posX, (int) this.posY, (int) this.posZ, Blocks.fire);
}
spawnHitParticles("magicCrit", 8);
this.setDead();
}
}

View file

@ -0,0 +1,96 @@
package WayofTime.alchemicalWizardry.common.entity.projectile;
import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.util.DamageSource;
import net.minecraft.util.MovingObjectPosition;
import net.minecraft.world.World;
public class HolyProjectile extends EnergyBlastProjectile
{
public HolyProjectile(World par1World)
{
super(par1World);
}
public HolyProjectile(World par1World, double par2, double par4, double par6)
{
super(par1World, par2, par4, par6);
}
public HolyProjectile(World par1World, EntityLivingBase par2EntityPlayer, int damage)
{
super(par1World, par2EntityPlayer, damage);
}
public HolyProjectile(World par1World, EntityLivingBase par2EntityPlayer, int damage, int maxTicksInAir, double posX, double posY, double posZ, float rotationYaw, float rotationPitch)
{
super(par1World, par2EntityPlayer, damage, maxTicksInAir, posX, posY, posZ, rotationYaw, rotationPitch);
}
public HolyProjectile(World par1World, EntityLivingBase par2EntityLivingBase, EntityLivingBase par3EntityLivingBase, float par4, float par5, int damage, int maxTicksInAir)
{
super(par1World, par2EntityLivingBase, par3EntityLivingBase, par4, par5, damage, maxTicksInAir);
}
@Override
public DamageSource getDamageSource()
{
return DamageSource.causeMobDamage(shootingEntity);
}
@Override
public void onImpact(MovingObjectPosition mop)
{
if (mop.typeOfHit == MovingObjectPosition.MovingObjectType.ENTITY && mop.entityHit != null)
{
if (mop.entityHit == shootingEntity)
{
return;
}
this.onImpact(mop.entityHit);
} else if (mop.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK)
{
}
this.setDead();
}
@Override
public void onImpact(Entity mop)
{
if (mop == shootingEntity && ticksInAir > 3)
{
shootingEntity.attackEntityFrom(DamageSource.causeMobDamage(shootingEntity), 1);
this.setDead();
} else
{
if (mop instanceof EntityLivingBase)
{
if (((EntityLivingBase) mop).isEntityUndead())
{
doDamage((int) (projectileDamage * 2), mop);
} else
{
doDamage(projectileDamage, mop);
}
}
}
if (worldObj.isAirBlock((int) this.posX, (int) this.posY, (int) this.posZ))
{
}
spawnHitParticles("magicCrit", 8);
this.setDead();
}
@Override
public void doFiringParticles()
{
SpellHelper.sendParticleToAllAround(worldObj, posX, posY, posZ, 30, worldObj.provider.dimensionId, "mobSpellAmbient", posX + smallGauss(0.1D), posY + smallGauss(0.1D), posZ + smallGauss(0.1D), 0.5D, 0.5D, 0.5D);
SpellHelper.sendParticleToAllAround(worldObj, posX, posY, posZ, 30, worldObj.provider.dimensionId, "mobSpell", posX, posY, posZ, 1.0F, 1.0F, 1.0F);
}
}

View file

@ -0,0 +1,101 @@
package WayofTime.alchemicalWizardry.common.entity.projectile;
import WayofTime.alchemicalWizardry.common.entity.mob.EntityIceDemon;
import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.potion.Potion;
import net.minecraft.potion.PotionEffect;
import net.minecraft.util.DamageSource;
import net.minecraft.util.MovingObjectPosition;
import net.minecraft.world.World;
public class IceProjectile extends EnergyBlastProjectile
{
public IceProjectile(World par1World)
{
super(par1World);
}
public IceProjectile(World par1World, double par2, double par4, double par6)
{
super(par1World, par2, par4, par6);
}
public IceProjectile(World par1World, EntityLivingBase par2EntityPlayer, int damage)
{
super(par1World, par2EntityPlayer, damage);
}
public IceProjectile(World par1World, EntityLivingBase par2EntityPlayer, int damage, int maxTicksInAir, double posX, double posY, double posZ, float rotationYaw, float rotationPitch)
{
super(par1World, par2EntityPlayer, damage, maxTicksInAir, posX, posY, posZ, rotationYaw, rotationPitch);
}
public IceProjectile(World worldObj, EntityIceDemon entityIceDemon, EntityLivingBase par1EntityLivingBase, float f, float g, int i, int j)
{
super(worldObj, entityIceDemon, par1EntityLivingBase, f, g, i, j);
}
@Override
public DamageSource getDamageSource()
{
return DamageSource.causeMobDamage(shootingEntity);
}
@Override
public void onImpact(MovingObjectPosition mop)
{
if (mop.typeOfHit == MovingObjectPosition.MovingObjectType.ENTITY && mop.entityHit != null)
{
if (mop.entityHit == shootingEntity)
{
return;
}
this.onImpact(mop.entityHit);
} else if (mop.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK)
{
}
this.setDead();
}
@Override
public void onImpact(Entity mop)
{
if (mop == shootingEntity && ticksInAir > 3)
{
shootingEntity.attackEntityFrom(DamageSource.causeMobDamage(shootingEntity), 1);
this.setDead();
} else
{
if (mop instanceof EntityLivingBase)
{
if (((EntityLivingBase) mop).isImmuneToFire())
{
doDamage((int) (projectileDamage * 2), mop);
((EntityLivingBase) mop).addPotionEffect(new PotionEffect(Potion.moveSlowdown.id, 200, 2));
} else
{
doDamage(projectileDamage, mop);
((EntityLivingBase) mop).addPotionEffect(new PotionEffect(Potion.moveSlowdown.id, 100, 1));
}
}
}
if (worldObj.isAirBlock((int) this.posX, (int) this.posY, (int) this.posZ))
{
//worldObj.setBlock((int)this.posX, (int)this.posY, (int)this.posZ,Block.fire.blockID);
}
spawnHitParticles("magicCrit", 8);
this.setDead();
}
@Override
public void doFiringParticles()
{
SpellHelper.sendParticleToAllAround(worldObj, posX, posY, posZ, 30, worldObj.provider.dimensionId, "mobSpellAmbient", posX + smallGauss(0.1D), posY + smallGauss(0.1D), posZ + smallGauss(0.1D), 0.5D, 0.5D, 0.5D);
SpellHelper.sendParticleToAllAround(worldObj, posX, posY, posZ, 30, worldObj.provider.dimensionId, "explode", posX, posY, posZ, gaussian(motionX), gaussian(motionY), gaussian(motionZ));
}
}

View file

@ -0,0 +1,110 @@
package WayofTime.alchemicalWizardry.common.entity.projectile;
import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.effect.EntityLightningBolt;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.DamageSource;
import net.minecraft.util.MovingObjectPosition;
import net.minecraft.world.World;
public class LightningBoltProjectile extends EnergyBlastProjectile
{
private boolean causeLightning;
public LightningBoltProjectile(World par1World)
{
super(par1World);
}
public LightningBoltProjectile(World par1World, double par2, double par4, double par6)
{
super(par1World, par2, par4, par6);
}
public LightningBoltProjectile(World par1World, EntityLivingBase par2EntityPlayer, int damage, boolean flag)
{
super(par1World, par2EntityPlayer, damage);
causeLightning = flag;
}
public LightningBoltProjectile(World par1World, EntityLivingBase par2EntityPlayer, int damage, int maxTicksInAir, double posX, double posY, double posZ, float rotationYaw, float rotationPitch, boolean flag)
{
super(par1World, par2EntityPlayer, damage, maxTicksInAir, posX, posY, posZ, rotationYaw, rotationPitch);
causeLightning = flag;
}
@Override
public DamageSource getDamageSource()
{
return DamageSource.causeMobDamage(shootingEntity);
}
@Override
public void onImpact(MovingObjectPosition mop)
{
if (mop.typeOfHit == MovingObjectPosition.MovingObjectType.ENTITY && mop.entityHit != null)
{
if (mop.entityHit == shootingEntity)
{
return;
}
this.onImpact(mop.entityHit);
} else if (mop.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK)
{
if (causeLightning)
{
this.worldObj.addWeatherEffect(new EntityLightningBolt(this.worldObj, this.posX, this.posY, this.posZ));
}
}
this.setDead();
}
@Override
public void onImpact(Entity mop)
{
if (mop == shootingEntity && ticksInAir > 3)
{
this.setDead();
} else
{
if (mop instanceof EntityLivingBase)
{
if (causeLightning)
{
this.worldObj.addWeatherEffect(new EntityLightningBolt(this.worldObj, ((EntityLivingBase) mop).posX, ((EntityLivingBase) mop).posY, ((EntityLivingBase) mop).posZ));
} else
{
doDamage(projectileDamage, mop);
}
}
}
spawnHitParticles("magicCrit", 8);
this.setDead();
}
@Override
public void doFiringParticles()
{
SpellHelper.sendParticleToAllAround(worldObj, posX, posY, posZ, 30, worldObj.provider.dimensionId, "mobSpellAmbient", posX + smallGauss(0.1D), posY + smallGauss(0.1D), posZ + smallGauss(0.1D), 0.5D, 0.5D, 0.5D);
SpellHelper.sendParticleToAllAround(worldObj, posX, posY, posZ, 30, worldObj.provider.dimensionId, "mobSpell", posX, posY, posZ, 1.0F, 1.0F, 1.0F);
}
@Override
public void writeEntityToNBT(NBTTagCompound par1NBTTagCompound)
{
super.writeEntityToNBT(par1NBTTagCompound);
par1NBTTagCompound.setBoolean("causeLightning", causeLightning);
}
@Override
public void readEntityFromNBT(NBTTagCompound par1NBTTagCompound)
{
super.readEntityFromNBT(par1NBTTagCompound);
causeLightning = par1NBTTagCompound.getBoolean("causeLightning");
}
}

View file

@ -0,0 +1,114 @@
package WayofTime.alchemicalWizardry.common.entity.projectile;
import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.potion.Potion;
import net.minecraft.potion.PotionEffect;
import net.minecraft.util.DamageSource;
import net.minecraft.util.MovingObjectPosition;
import net.minecraft.world.World;
public class MudProjectile extends EnergyBlastProjectile
{
private boolean doesBlindness; //True for when it applies blindness, false for slowness
public MudProjectile(World par1World)
{
super(par1World);
}
public MudProjectile(World par1World, double par2, double par4, double par6)
{
super(par1World, par2, par4, par6);
}
public MudProjectile(World par1World, EntityLivingBase par2EntityPlayer, int damage, boolean flag)
{
super(par1World, par2EntityPlayer, damage);
doesBlindness = flag;
}
public MudProjectile(World par1World, EntityLivingBase par2EntityPlayer, int damage, int maxTicksInAir, double posX, double posY, double posZ, float rotationYaw, float rotationPitch, boolean flag)
{
super(par1World, par2EntityPlayer, damage, maxTicksInAir, posX, posY, posZ, rotationYaw, rotationPitch);
doesBlindness = flag;
}
public MudProjectile(World par1World, EntityLivingBase par2EntityLivingBase, EntityLivingBase par3EntityLivingBase, float par4, float par5, int damage, int maxTicksInAir, boolean flag)
{
super(par1World, par2EntityLivingBase, par3EntityLivingBase, par4, par5, damage, maxTicksInAir);
doesBlindness = flag;
}
@Override
public DamageSource getDamageSource()
{
return DamageSource.causeMobDamage(shootingEntity);
}
@Override
public void onImpact(MovingObjectPosition mop)
{
if (mop.typeOfHit == MovingObjectPosition.MovingObjectType.ENTITY && mop.entityHit != null)
{
if (mop.entityHit == shootingEntity)
{
return;
}
this.onImpact(mop.entityHit);
} else if (mop.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK)
{
}
this.setDead();
}
@Override
public void onImpact(Entity mop)
{
if (mop == shootingEntity && ticksInAir > 3)
{
this.setDead();
} else
{
if (mop instanceof EntityLivingBase)
{
if (doesBlindness)
{
((EntityLivingBase) mop).addPotionEffect(new PotionEffect(Potion.blindness.id, 100, 0));
} else
{
((EntityLivingBase) mop).addPotionEffect(new PotionEffect(Potion.moveSlowdown.id, 100, 2));
}
doDamage(projectileDamage, mop);
}
}
spawnHitParticles("magicCrit", 8);
this.setDead();
}
@Override
public void doFiringParticles()
{
SpellHelper.sendParticleToAllAround(worldObj, posX, posY, posZ, 30, worldObj.provider.dimensionId, "mobSpellAmbient", posX + smallGauss(0.1D), posY + smallGauss(0.1D), posZ + smallGauss(0.1D), 0.5D, 0.5D, 0.5D);
SpellHelper.sendParticleToAllAround(worldObj, posX, posY, posZ, 30, worldObj.provider.dimensionId, "mobSpell", posX, posY, posZ, 0.5F, 0.297F, 0.0664F);
}
@Override
public void writeEntityToNBT(NBTTagCompound par1NBTTagCompound)
{
super.writeEntityToNBT(par1NBTTagCompound);
par1NBTTagCompound.setBoolean("doesBlindness", doesBlindness);
}
@Override
public void readEntityFromNBT(NBTTagCompound par1NBTTagCompound)
{
super.readEntityFromNBT(par1NBTTagCompound);
doesBlindness = par1NBTTagCompound.getBoolean("doesBlindness");
}
}

View file

@ -0,0 +1,158 @@
package WayofTime.alchemicalWizardry.common.entity.projectile;
import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper;
import WayofTime.alchemicalWizardry.common.spell.simple.SpellTeleport;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.DamageSource;
import net.minecraft.util.MovingObjectPosition;
import net.minecraft.world.World;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.event.entity.living.EnderTeleportEvent;
public class TeleportProjectile extends EnergyBlastProjectile
{
private boolean isEntityTeleport;
public TeleportProjectile(World par1World)
{
super(par1World);
this.motionX *= 3;
this.motionY *= 3;
this.motionZ *= 3;
}
public TeleportProjectile(World par1World, double par2, double par4, double par6)
{
super(par1World, par2, par4, par6);
this.motionX *= 3;
this.motionY *= 3;
this.motionZ *= 3;
}
public TeleportProjectile(World par1World, EntityLivingBase par2EntityPlayer, int damage, boolean flag)
{
super(par1World, par2EntityPlayer, damage);
isEntityTeleport = flag;
this.motionX *= 3;
this.motionY *= 3;
this.motionZ *= 3;
}
public TeleportProjectile(World par1World, EntityLivingBase par2EntityPlayer, int damage, int maxTicksInAir, double posX, double posY, double posZ, float rotationYaw, float rotationPitch, boolean flag)
{
super(par1World, par2EntityPlayer, damage, maxTicksInAir, posX, posY, posZ, rotationYaw, rotationPitch);
isEntityTeleport = flag;
this.motionX *= 3;
this.motionY *= 3;
this.motionZ *= 3;
}
@Override
public DamageSource getDamageSource()
{
return DamageSource.causeMobDamage(shootingEntity);
}
@Override
public void onImpact(MovingObjectPosition mop)
{
if (mop.typeOfHit == MovingObjectPosition.MovingObjectType.ENTITY && mop.entityHit != null)
{
if (mop.entityHit == shootingEntity)
{
return;
}
this.onImpact(mop.entityHit);
} else if (mop.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK)
{
if (isEntityTeleport)
{
if (shootingEntity != null && shootingEntity instanceof EntityPlayerMP)
{
EntityPlayerMP entityplayermp = (EntityPlayerMP) shootingEntity;
if (entityplayermp.worldObj == this.worldObj)
{
EnderTeleportEvent event = new EnderTeleportEvent(entityplayermp, this.posX, this.posY, this.posZ, 5.0F);
if (!MinecraftForge.EVENT_BUS.post(event))
{
if (shootingEntity.isRiding())
{
shootingEntity.mountEntity((Entity) null);
}
shootingEntity.setPositionAndUpdate(event.targetX, event.targetY, event.targetZ);
}
}
}
}
}
this.setDead();
}
@Override
public void onImpact(Entity mop)
{
if (mop == shootingEntity && ticksInAir > 3)
{
this.setDead();
} else
{
if (mop instanceof EntityLivingBase)
{
if (isEntityTeleport)
{
if (shootingEntity != null && shootingEntity instanceof EntityPlayerMP)
{
EntityPlayerMP entityplayermp = (EntityPlayerMP) shootingEntity;
if (entityplayermp.worldObj == this.worldObj)
{
EnderTeleportEvent event = new EnderTeleportEvent(entityplayermp, this.posX, this.posY, this.posZ, 5.0F);
if (!MinecraftForge.EVENT_BUS.post(event))
{
if (shootingEntity.isRiding())
{
shootingEntity.mountEntity((Entity) null);
}
shootingEntity.setPositionAndUpdate(event.targetX, event.targetY, event.targetZ);
}
}
}
} else
{
SpellTeleport.teleportRandomly((EntityLivingBase) mop, 64);
}
}
}
spawnHitParticles("magicCrit", 8);
this.setDead();
}
@Override
public void doFiringParticles()
{
SpellHelper.sendParticleToAllAround(worldObj, posX, posY, posZ, 30, worldObj.provider.dimensionId, "mobSpellAmbient", posX + smallGauss(0.1D), posY + smallGauss(0.1D), posZ + smallGauss(0.1D), 0.5D, 0.5D, 0.5D);
SpellHelper.sendParticleToAllAround(worldObj, posX, posY, posZ, 30, worldObj.provider.dimensionId, "portal", posX, posY, posZ, -motionX, -motionY, -motionZ);
}
@Override
public void writeEntityToNBT(NBTTagCompound par1NBTTagCompound)
{
super.writeEntityToNBT(par1NBTTagCompound);
par1NBTTagCompound.setBoolean("isEntityTeleport", isEntityTeleport);
}
@Override
public void readEntityFromNBT(NBTTagCompound par1NBTTagCompound)
{
super.readEntityFromNBT(par1NBTTagCompound);
isEntityTeleport = par1NBTTagCompound.getBoolean("isEntityTeleport");
}
}

View file

@ -0,0 +1,90 @@
package WayofTime.alchemicalWizardry.common.entity.projectile;
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.potion.PotionEffect;
import net.minecraft.util.DamageSource;
import net.minecraft.util.MovingObjectPosition;
import net.minecraft.world.World;
public class WaterProjectile extends EnergyBlastProjectile
{
public WaterProjectile(World par1World)
{
super(par1World);
}
public WaterProjectile(World par1World, double par2, double par4, double par6)
{
super(par1World, par2, par4, par6);
}
public WaterProjectile(World par1World, EntityLivingBase par2EntityPlayer, int damage)
{
super(par1World, par2EntityPlayer, damage);
}
public WaterProjectile(World par1World, EntityLivingBase par2EntityPlayer, int damage, int maxTicksInAir, double posX, double posY, double posZ, float rotationYaw, float rotationPitch)
{
super(par1World, par2EntityPlayer, damage, maxTicksInAir, posX, posY, posZ, rotationYaw, rotationPitch);
}
@Override
public DamageSource getDamageSource()
{
return DamageSource.causeMobDamage(shootingEntity);
}
@Override
public void onImpact(MovingObjectPosition mop)
{
if (mop.typeOfHit == MovingObjectPosition.MovingObjectType.ENTITY && mop.entityHit != null)
{
if (mop.entityHit == shootingEntity)
{
return;
}
this.onImpact(mop.entityHit);
} else if (mop.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK)
{
}
this.setDead();
}
@Override
public void onImpact(Entity mop)
{
if (mop == shootingEntity && ticksInAir > 3)
{
this.setDead();
} else
{
if (mop instanceof EntityLivingBase)
{
if (((EntityLivingBase) mop).isImmuneToFire())
{
doDamage(projectileDamage * 2, mop);
((EntityLivingBase) mop).addPotionEffect(new PotionEffect(AlchemicalWizardry.customPotionDrowning.id, 80, 1));
} else
{
doDamage(projectileDamage, mop);
((EntityLivingBase) mop).addPotionEffect(new PotionEffect(AlchemicalWizardry.customPotionDrowning.id, 80, 0));
}
}
}
spawnHitParticles("magicCrit", 8);
this.setDead();
}
@Override
public void doFiringParticles()
{
SpellHelper.sendParticleToAllAround(worldObj, posX, posY, posZ, 30, worldObj.provider.dimensionId, "portal", posX, posY, posZ, -motionX, -motionY, -motionZ);
SpellHelper.sendParticleToAllAround(worldObj, posX, posY, posZ, 30, worldObj.provider.dimensionId, "mobSpellAmbient", posX + smallGauss(0.1D), posY + smallGauss(0.1D), posZ + smallGauss(0.1D), 0.5D, 0.5D, 0.5D);
}
}

View file

@ -0,0 +1,82 @@
package WayofTime.alchemicalWizardry.common.entity.projectile;
import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.util.DamageSource;
import net.minecraft.util.MovingObjectPosition;
import net.minecraft.world.World;
public class WindGustProjectile extends EnergyBlastProjectile
{
public WindGustProjectile(World par1World)
{
super(par1World);
}
public WindGustProjectile(World par1World, double par2, double par4, double par6)
{
super(par1World, par2, par4, par6);
}
public WindGustProjectile(World par1World, EntityLivingBase par2EntityPlayer, int damage)
{
super(par1World, par2EntityPlayer, damage);
}
public WindGustProjectile(World par1World, EntityLivingBase par2EntityPlayer, int damage, int maxTicksInAir, double posX, double posY, double posZ, float rotationYaw, float rotationPitch)
{
super(par1World, par2EntityPlayer, damage, maxTicksInAir, posX, posY, posZ, rotationYaw, rotationPitch);
}
@Override
public DamageSource getDamageSource()
{
return DamageSource.causeMobDamage(shootingEntity);
}
@Override
public void onImpact(MovingObjectPosition mop)
{
if (mop.typeOfHit == MovingObjectPosition.MovingObjectType.ENTITY && mop.entityHit != null)
{
if (mop.entityHit == shootingEntity)
{
return;
}
this.onImpact(mop.entityHit);
} else if (mop.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK)
{
}
this.setDead();
}
@Override
public void onImpact(Entity mop)
{
if (mop == shootingEntity && ticksInAir > 3)
{
this.setDead();
} else
{
if (mop instanceof EntityLivingBase)
{
((EntityLivingBase) mop).motionX = this.motionX * 2;
((EntityLivingBase) mop).motionY = 1.5;
((EntityLivingBase) mop).motionZ = this.motionZ * 2;
}
}
spawnHitParticles("magicCrit", 8);
this.setDead();
}
@Override
public void doFiringParticles()
{
SpellHelper.sendParticleToAllAround(worldObj, posX, posY, posZ, 30, worldObj.provider.dimensionId, "mobSpellAmbient", posX + smallGauss(0.1D), posY + smallGauss(0.1D), posZ + smallGauss(0.1D), 0.5D, 0.5D, 0.5D);
SpellHelper.sendParticleToAllAround(worldObj, posX, posY, posZ, 30, worldObj.provider.dimensionId, "mobSpell", posX, posY, posZ, 1.0F, 1.0F, 1.0F);
}
}