Initial commit!

This commit is contained in:
oitsjustjose 2013-06-21 16:36:50 -05:00
commit d15d9ac848
61 changed files with 4590 additions and 0 deletions

View file

@ -0,0 +1,239 @@
package MysticWorld.Entity;
import java.util.List;
import java.util.Random;
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.EntityLiving;
import net.minecraft.entity.IProjectile;
import net.minecraft.entity.boss.EntityDragon;
import net.minecraft.entity.boss.EntityWither;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.entity.monster.EntityBlaze;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.projectile.EntityFireball;
import net.minecraft.entity.projectile.EntitySmallFireball;
import net.minecraft.entity.projectile.EntityThrowable;
import net.minecraft.item.Item;
import net.minecraft.item.ItemDye;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
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.FakePlayerFactory;
import net.minecraftforge.common.ForgeHooks;
import MysticWorld.MysticWorld;
public class EntityChargeAir extends Entity {
public EntityLiving shootingEntity;
public EntityPlayer entityPlayer;
public EntityDragon entityDragon;
public EntityWither entityWither;
private boolean inGround = false;
private int xTile = -1;
private int yTile = -1;
private int zTile = -1;
private int inTile = 0;
private int ticksAlive;
private int ticksInAir = 0;
public EntityChargeAir(World par1World)
{
super(par1World);
}
public EntityChargeAir(World par1World, EntityLiving par2EntityLiving)
{
super(par1World);
this.setSize(0.25F, 0.25F);
this.setLocationAndAngles(par2EntityLiving.posX, par2EntityLiving.posY + (double)par2EntityLiving.getEyeHeight(), par2EntityLiving.posZ, par2EntityLiving.rotationYaw, par2EntityLiving.rotationPitch);
this.setPosition(this.posX, this.posY, this.posZ);
this.motionX = (double)(-MathHelper.sin(this.rotationYaw / 180.0F * (float)Math.PI) * MathHelper.cos(this.rotationPitch / 180.0F * (float)Math.PI));
this.motionY = (double)(-MathHelper.sin((this.rotationPitch) / 180.0F * (float)Math.PI));
this.motionZ = (double)(MathHelper.cos(this.rotationYaw / 180.0F * (float)Math.PI) * MathHelper.cos(this.rotationPitch / 180.0F * (float)Math.PI));
this.shootingEntity = par2EntityLiving;
}
public void onUpdate()
{
if (!this.worldObj.isRemote && (this.shootingEntity != null && this.shootingEntity.isDead || !this.worldObj.blockExists((int)this.posX, (int)this.posY, (int)this.posZ)))
{
this.setDead();
}
else
{
super.onUpdate();
Vec3 vec3 = this.worldObj.getWorldVec3Pool().getVecFromPool(this.posX, this.posY, this.posZ);
Vec3 vec31 = this.worldObj.getWorldVec3Pool().getVecFromPool(this.posX + this.motionX, this.posY + this.motionY, this.posZ + this.motionZ);
MovingObjectPosition movingobjectposition = this.worldObj.rayTraceBlocks(vec3, vec31);
vec3 = this.worldObj.getWorldVec3Pool().getVecFromPool(this.posX, this.posY, this.posZ);
vec31 = this.worldObj.getWorldVec3Pool().getVecFromPool(this.posX + this.motionX, this.posY + this.motionY, this.posZ + this.motionZ);
if (movingobjectposition != null)
{
vec31 = this.worldObj.getWorldVec3Pool().getVecFromPool(movingobjectposition.hitVec.xCoord, movingobjectposition.hitVec.yCoord, movingobjectposition.hitVec.zCoord);
}
Entity entity = null;
List list = this.worldObj.getEntitiesWithinAABBExcludingEntity(this, this.boundingBox.addCoord(this.motionX, this.motionY, this.motionZ).expand(1.0D, 1.0D, 1.0D));
double d0 = 0.0D;
for (int j = 0; j < list.size(); ++j)
{
Entity entity1 = (Entity)list.get(j);
if (entity1.canBeCollidedWith() && (!entity1.isEntityEqual(this.shootingEntity) || this.ticksInAir >= 25))
{
float f = 0.3F;
AxisAlignedBB axisalignedbb = entity1.boundingBox.expand((double)f, (double)f, (double)f);
MovingObjectPosition movingobjectposition1 = axisalignedbb.calculateIntercept(vec3, vec31);
if (movingobjectposition1 != null)
{
double d1 = vec3.distanceTo(movingobjectposition1.hitVec);
if (d1 < d0 || d0 == 0.0D)
{
entity = entity1;
d0 = d1;
}
}
}
}
if (entity != null)
{
movingobjectposition = new MovingObjectPosition(entity);
}
if (movingobjectposition != null)
{
this.onImpact(movingobjectposition);
}
this.posX += this.motionX;
this.posY += this.motionY;
this.posZ += this.motionZ;
float f2 = this.getMotionFactor();
if (this.isInWater())
{
for (int k = 0; k < 4; ++k)
{
float f3 = 0.25F;
this.worldObj.spawnParticle("bubble", this.posX - this.motionX * (double)f3, this.posY - this.motionY * (double)f3, this.posZ - this.motionZ * (double)f3, this.motionX, this.motionY, this.motionZ);
}
f2 = 0.8F;
}
MysticWorld.proxy.airFX(this.worldObj, this.posX, this.posY + 0.5D, this.posZ, 1.0F);
this.setPosition(this.posX, this.posY, this.posZ);
}
}
protected float getMotionFactor()
{
return 0.95F;
}
protected void onImpact(MovingObjectPosition par1MovingObjectPosition)
{
Random rand = new Random();
if (!this.worldObj.isRemote)
{
this.worldObj.playSoundEffect(this.posX, this.posY, this.posZ, "random.explode", 4.0F, (1.0F + (this.worldObj.rand.nextFloat() - this.worldObj.rand.nextFloat()) * 0.2F) * 0.7F);
if (par1MovingObjectPosition.entityHit != entityPlayer && par1MovingObjectPosition.entityHit != entityDragon && par1MovingObjectPosition.entityHit != entityWither)
{
double f3 = MathHelper.sqrt_double(this.motionX * this.motionX + this.motionZ * this.motionZ);
if (f3 > 0.0F)
{
par1MovingObjectPosition.entityHit.addVelocity(this.motionX * (double)2 * 0.6000000238418579D / (double)f3, 2.5, this.motionZ * (double)2 * 0.6000000238418579D / (double)f3);
}
}
else
{
int i = par1MovingObjectPosition.blockX;
int j = par1MovingObjectPosition.blockY;
int k = par1MovingObjectPosition.blockZ;
switch (par1MovingObjectPosition.sideHit)
{
case 0:
--j;
break;
case 1:
++j;
break;
case 2:
--k;
break;
case 3:
++k;
break;
case 4:
--i;
break;
case 5:
++i;
}
}
this.setDead();
}
}
@Override
protected void entityInit() {
}
@Override
protected void readEntityFromNBT(NBTTagCompound nbttagcompound) {
}
@Override
protected void writeEntityToNBT(NBTTagCompound nbttagcompound) {
}
public boolean canBeCollidedWith()
{
return true;
}
public float getCollisionBorderSize()
{
return 1.0F;
}
@SideOnly(Side.CLIENT)
public float getShadowSize()
{
return 0.0F;
}
public float getBrightness(float par1)
{
return 1.0F;
}
@SideOnly(Side.CLIENT)
public int getBrightnessForRender(float par1)
{
return 15728880;
}
}

View file

@ -0,0 +1,251 @@
package MysticWorld.Entity;
import java.util.List;
import java.util.Random;
import MysticWorld.MysticWorld;
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.EntityLiving;
import net.minecraft.entity.IProjectile;
import net.minecraft.entity.boss.EntityDragon;
import net.minecraft.entity.boss.EntityWither;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.entity.monster.EntityBlaze;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.projectile.EntityFireball;
import net.minecraft.entity.projectile.EntitySmallFireball;
import net.minecraft.entity.projectile.EntityThrowable;
import net.minecraft.item.Item;
import net.minecraft.item.ItemDye;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
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.FakePlayerFactory;
import net.minecraftforge.common.ForgeHooks;
public class EntityChargeEarth extends Entity {
public EntityLiving shootingEntity;
public EntityPlayer entityPlayer;
public EntityDragon entityDragon;
public EntityWither entityWither;
private boolean inGround = false;
private int xTile = -1;
private int yTile = -1;
private int zTile = -1;
private int inTile = 0;
private int ticksAlive;
private int ticksInAir = 0;
public EntityChargeEarth(World par1World)
{
super(par1World);
}
public EntityChargeEarth(World par1World, EntityLiving par2EntityLiving)
{
super(par1World);
this.setSize(0.25F, 0.25F);
this.setLocationAndAngles(par2EntityLiving.posX, par2EntityLiving.posY + (double)par2EntityLiving.getEyeHeight(), par2EntityLiving.posZ, par2EntityLiving.rotationYaw, par2EntityLiving.rotationPitch);
this.setPosition(this.posX, this.posY, this.posZ);
this.motionX = (double)(-MathHelper.sin(this.rotationYaw / 180.0F * (float)Math.PI) * MathHelper.cos(this.rotationPitch / 180.0F * (float)Math.PI));
this.motionY = (double)(-MathHelper.sin((this.rotationPitch) / 180.0F * (float)Math.PI));
this.motionZ = (double)(MathHelper.cos(this.rotationYaw / 180.0F * (float)Math.PI) * MathHelper.cos(this.rotationPitch / 180.0F * (float)Math.PI));
this.shootingEntity = par2EntityLiving;
}
public void onUpdate()
{
if (!this.worldObj.isRemote && (this.shootingEntity != null && this.shootingEntity.isDead || !this.worldObj.blockExists((int)this.posX, (int)this.posY, (int)this.posZ)))
{
this.setDead();
}
else
{
super.onUpdate();
Vec3 vec3 = this.worldObj.getWorldVec3Pool().getVecFromPool(this.posX, this.posY, this.posZ);
Vec3 vec31 = this.worldObj.getWorldVec3Pool().getVecFromPool(this.posX + this.motionX, this.posY + this.motionY, this.posZ + this.motionZ);
MovingObjectPosition movingobjectposition = this.worldObj.rayTraceBlocks(vec3, vec31);
vec3 = this.worldObj.getWorldVec3Pool().getVecFromPool(this.posX, this.posY, this.posZ);
vec31 = this.worldObj.getWorldVec3Pool().getVecFromPool(this.posX + this.motionX, this.posY + this.motionY, this.posZ + this.motionZ);
if (movingobjectposition != null)
{
vec31 = this.worldObj.getWorldVec3Pool().getVecFromPool(movingobjectposition.hitVec.xCoord, movingobjectposition.hitVec.yCoord, movingobjectposition.hitVec.zCoord);
}
Entity entity = null;
List list = this.worldObj.getEntitiesWithinAABBExcludingEntity(this, this.boundingBox.addCoord(this.motionX, this.motionY, this.motionZ).expand(1.0D, 1.0D, 1.0D));
double d0 = 0.0D;
for (int j = 0; j < list.size(); ++j)
{
Entity entity1 = (Entity)list.get(j);
if (entity1.canBeCollidedWith() && (!entity1.isEntityEqual(this.shootingEntity) || this.ticksInAir >= 25))
{
float f = 0.3F;
AxisAlignedBB axisalignedbb = entity1.boundingBox.expand((double)f, (double)f, (double)f);
MovingObjectPosition movingobjectposition1 = axisalignedbb.calculateIntercept(vec3, vec31);
if (movingobjectposition1 != null)
{
double d1 = vec3.distanceTo(movingobjectposition1.hitVec);
if (d1 < d0 || d0 == 0.0D)
{
entity = entity1;
d0 = d1;
}
}
}
}
if (entity != null)
{
movingobjectposition = new MovingObjectPosition(entity);
}
if (movingobjectposition != null)
{
this.onImpact(movingobjectposition);
}
this.posX += this.motionX;
this.posY += this.motionY;
this.posZ += this.motionZ;
float f2 = this.getMotionFactor();
if (this.isInWater())
{
for (int k = 0; k < 4; ++k)
{
float f3 = 0.25F;
this.worldObj.spawnParticle("bubble", this.posX - this.motionX * (double)f3, this.posY - this.motionY * (double)f3, this.posZ - this.motionZ * (double)f3, this.motionX, this.motionY, this.motionZ);
}
f2 = 0.8F;
}
MysticWorld.proxy.earthFX(this.worldObj, this.posX, this.posY + 0.5D, this.posZ, 1.0F);
this.setPosition(this.posX, this.posY, this.posZ);
}
}
protected float getMotionFactor()
{
return 0.95F;
}
protected void onImpact(MovingObjectPosition par1MovingObjectPosition)
{
Random rand = new Random();
if (!this.worldObj.isRemote)
{
this.worldObj.playSoundEffect(this.posX, this.posY, this.posZ, "random.explode", 4.0F, (1.0F + (this.worldObj.rand.nextFloat() - this.worldObj.rand.nextFloat()) * 0.2F) * 0.7F);
if (par1MovingObjectPosition.entityHit != null)
{
double f3 = MathHelper.sqrt_double(this.motionX * this.motionX + this.motionZ * this.motionZ);
if (f3 > 0.0F)
{
par1MovingObjectPosition.entityHit.addVelocity(this.motionX * (double)1 * 0.6000000238418579D / (double)f3, 0.1D, this.motionZ * (double)1 * 0.6000000238418579D / (double)f3);
}
par1MovingObjectPosition.entityHit.attackEntityFrom(DamageSource.magic, 20);
this.worldObj.spawnEntityInWorld(new EntityItem(worldObj, this.posX, this.posY, this.posZ, new ItemStack(Item.seeds, rand.nextInt(4))));
this.worldObj.spawnEntityInWorld(new EntityItem(worldObj, this.posX, this.posY, this.posZ, new ItemStack(Block.mushroomBrown, rand.nextInt(2))));
this.worldObj.spawnEntityInWorld(new EntityItem(worldObj, this.posX, this.posY, this.posZ, new ItemStack(Item.appleRed, rand.nextInt(2))));
this.worldObj.spawnEntityInWorld(new EntityItem(worldObj, this.posX, this.posY, this.posZ, new ItemStack(Block.sapling, rand.nextInt(2), 0)));
this.worldObj.spawnEntityInWorld(new EntityItem(worldObj, this.posX, this.posY, this.posZ, new ItemStack(Item.pumpkinSeeds, rand.nextInt(2))));
this.worldObj.spawnEntityInWorld(new EntityItem(worldObj, this.posX, this.posY, this.posZ, new ItemStack(Block.sapling, rand.nextInt(2), 1)));
this.worldObj.spawnEntityInWorld(new EntityItem(worldObj, this.posX, this.posY, this.posZ, new ItemStack(Block.sapling, rand.nextInt(2), 2)));
this.worldObj.spawnEntityInWorld(new EntityItem(worldObj, this.posX, this.posY, this.posZ, new ItemStack(Block.sapling, rand.nextInt(2), 3)));
this.worldObj.spawnEntityInWorld(new EntityItem(worldObj, this.posX, this.posY, this.posZ, new ItemStack(Item.melonSeeds, rand.nextInt(3))));
}
else
{
int i = par1MovingObjectPosition.blockX;
int j = par1MovingObjectPosition.blockY;
int k = par1MovingObjectPosition.blockZ;
switch (par1MovingObjectPosition.sideHit)
{
case 0:
--j;
break;
case 1:
++j;
break;
case 2:
--k;
break;
case 3:
++k;
break;
case 4:
--i;
break;
case 5:
++i;
}
}
this.setDead();
}
}
@Override
protected void entityInit() {
}
@Override
protected void readEntityFromNBT(NBTTagCompound nbttagcompound) {
}
@Override
protected void writeEntityToNBT(NBTTagCompound nbttagcompound) {
}
public boolean canBeCollidedWith()
{
return true;
}
public float getCollisionBorderSize()
{
return 1.0F;
}
@SideOnly(Side.CLIENT)
public float getShadowSize()
{
return 0.0F;
}
public float getBrightness(float par1)
{
return 1.0F;
}
@SideOnly(Side.CLIENT)
public int getBrightnessForRender(float par1)
{
return 15728880;
}
}

View file

@ -0,0 +1,230 @@
package MysticWorld.Entity;
import java.util.List;
import MysticWorld.MysticWorld;
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.EntityLiving;
import net.minecraft.entity.IProjectile;
import net.minecraft.entity.effect.EntityLightningBolt;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.entity.monster.EntityBlaze;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.projectile.EntityFireball;
import net.minecraft.entity.projectile.EntitySmallFireball;
import net.minecraft.entity.projectile.EntityThrowable;
import net.minecraft.nbt.NBTTagCompound;
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;
public class EntityChargeEnergy extends Entity {
public EntityLiving shootingEntity;
private boolean inGround = false;
private int xTile = -1;
private int yTile = -1;
private int zTile = -1;
private int inTile = 0;
private int ticksAlive;
private int ticksInAir = 0;
public EntityChargeEnergy(World par1World)
{
super(par1World);
}
public EntityChargeEnergy(World par1World, EntityLiving par2EntityLiving)
{
super(par1World);
this.setSize(0.25F, 0.25F);
this.setLocationAndAngles(par2EntityLiving.posX, par2EntityLiving.posY + (double)par2EntityLiving.getEyeHeight(), par2EntityLiving.posZ, par2EntityLiving.rotationYaw, par2EntityLiving.rotationPitch);
this.setPosition(this.posX, this.posY, this.posZ);
this.motionX = (double)(-MathHelper.sin(this.rotationYaw / 180.0F * (float)Math.PI) * MathHelper.cos(this.rotationPitch / 180.0F * (float)Math.PI));
this.motionY = (double)(-MathHelper.sin((this.rotationPitch) / 180.0F * (float)Math.PI));
this.motionZ = (double)(MathHelper.cos(this.rotationYaw / 180.0F * (float)Math.PI) * MathHelper.cos(this.rotationPitch / 180.0F * (float)Math.PI));
this.shootingEntity = par2EntityLiving;
}
public void onUpdate()
{
if (!this.worldObj.isRemote && (this.shootingEntity != null && this.shootingEntity.isDead || !this.worldObj.blockExists((int)this.posX, (int)this.posY, (int)this.posZ)))
{
this.setDead();
}
else
{
super.onUpdate();
Vec3 vec3 = this.worldObj.getWorldVec3Pool().getVecFromPool(this.posX, this.posY, this.posZ);
Vec3 vec31 = this.worldObj.getWorldVec3Pool().getVecFromPool(this.posX + this.motionX, this.posY + this.motionY, this.posZ + this.motionZ);
MovingObjectPosition movingobjectposition = this.worldObj.rayTraceBlocks(vec3, vec31);
vec3 = this.worldObj.getWorldVec3Pool().getVecFromPool(this.posX, this.posY, this.posZ);
vec31 = this.worldObj.getWorldVec3Pool().getVecFromPool(this.posX + this.motionX, this.posY + this.motionY, this.posZ + this.motionZ);
if (movingobjectposition != null)
{
vec31 = this.worldObj.getWorldVec3Pool().getVecFromPool(movingobjectposition.hitVec.xCoord, movingobjectposition.hitVec.yCoord, movingobjectposition.hitVec.zCoord);
}
Entity entity = null;
List list = this.worldObj.getEntitiesWithinAABBExcludingEntity(this, this.boundingBox.addCoord(this.motionX, this.motionY, this.motionZ).expand(1.0D, 1.0D, 1.0D));
double d0 = 0.0D;
for (int j = 0; j < list.size(); ++j)
{
Entity entity1 = (Entity)list.get(j);
if (entity1.canBeCollidedWith() && (!entity1.isEntityEqual(this.shootingEntity) || this.ticksInAir >= 25))
{
float f = 0.3F;
AxisAlignedBB axisalignedbb = entity1.boundingBox.expand((double)f, (double)f, (double)f);
MovingObjectPosition movingobjectposition1 = axisalignedbb.calculateIntercept(vec3, vec31);
if (movingobjectposition1 != null)
{
double d1 = vec3.distanceTo(movingobjectposition1.hitVec);
if (d1 < d0 || d0 == 0.0D)
{
entity = entity1;
d0 = d1;
}
}
}
}
if (entity != null)
{
movingobjectposition = new MovingObjectPosition(entity);
}
if (movingobjectposition != null)
{
this.onImpact(movingobjectposition);
}
this.posX += this.motionX;
this.posY += this.motionY;
this.posZ += this.motionZ;
float f2 = this.getMotionFactor();
if (this.isInWater())
{
for (int k = 0; k < 4; ++k)
{
float f3 = 0.25F;
this.worldObj.spawnParticle("bubble", this.posX - this.motionX * (double)f3, this.posY - this.motionY * (double)f3, this.posZ - this.motionZ * (double)f3, this.motionX, this.motionY, this.motionZ);
}
f2 = 0.8F;
}
MysticWorld.proxy.energyFX(this.worldObj, this.posX, this.posY + 0.5D, this.posZ, 1.0F);
this.setPosition(this.posX, this.posY, this.posZ);
}
}
protected float getMotionFactor()
{
return 0.95F;
}
protected void onImpact(MovingObjectPosition par1MovingObjectPosition)
{
int i = par1MovingObjectPosition.blockX;
int j = par1MovingObjectPosition.blockY;
int k = par1MovingObjectPosition.blockZ;
if (!this.worldObj.isRemote)
{
if (par1MovingObjectPosition.entityHit != null)
{
double f3 = MathHelper.sqrt_double(this.motionX * this.motionX + this.motionZ * this.motionZ);
if (f3 > 0.0F)
{
par1MovingObjectPosition.entityHit.addVelocity(this.motionX * (double)1 * 0.6000000238418579D / (double)f3, 0.1D, this.motionZ * (double)1 * 0.6000000238418579D / (double)f3);
}
worldObj.addWeatherEffect(new EntityLightningBolt(worldObj, par1MovingObjectPosition.entityHit.posX, par1MovingObjectPosition.entityHit.posY, par1MovingObjectPosition.entityHit.posZ));
}
else
{
worldObj.addWeatherEffect(new EntityLightningBolt(worldObj, i, j, k));
switch (par1MovingObjectPosition.sideHit)
{
case 0:
--j;
break;
case 1:
++j;
break;
case 2:
--k;
break;
case 3:
++k;
break;
case 4:
--i;
break;
case 5:
++i;
}
}
this.setDead();
}
}
@Override
protected void entityInit() {
}
@Override
protected void readEntityFromNBT(NBTTagCompound nbttagcompound) {
}
@Override
protected void writeEntityToNBT(NBTTagCompound nbttagcompound) {
}
public boolean canBeCollidedWith()
{
return true;
}
public float getCollisionBorderSize()
{
return 1.0F;
}
@SideOnly(Side.CLIENT)
public float getShadowSize()
{
return 0.0F;
}
public float getBrightness(float par1)
{
return 1.0F;
}
@SideOnly(Side.CLIENT)
public int getBrightnessForRender(float par1)
{
return 15728880;
}
}

View file

@ -0,0 +1,239 @@
package MysticWorld.Entity;
import java.util.List;
import MysticWorld.MysticWorld;
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.EntityLiving;
import net.minecraft.entity.IProjectile;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.entity.monster.EntityBlaze;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.projectile.EntityFireball;
import net.minecraft.entity.projectile.EntitySmallFireball;
import net.minecraft.entity.projectile.EntityThrowable;
import net.minecraft.nbt.NBTTagCompound;
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;
public class EntityChargeFire extends Entity {
public EntityLiving shootingEntity;
private boolean inGround = false;
private int xTile = -1;
private int yTile = -1;
private int zTile = -1;
private int inTile = 0;
private int ticksAlive;
private int ticksInAir = 0;
public EntityChargeFire(World par1World)
{
super(par1World);
}
public EntityChargeFire(World par1World, EntityLiving par2EntityLiving)
{
super(par1World);
this.setSize(0.25F, 0.25F);
this.setLocationAndAngles(par2EntityLiving.posX, par2EntityLiving.posY + (double)par2EntityLiving.getEyeHeight(), par2EntityLiving.posZ, par2EntityLiving.rotationYaw, par2EntityLiving.rotationPitch);
this.setPosition(this.posX, this.posY, this.posZ);
this.motionX = (double)(-MathHelper.sin(this.rotationYaw / 180.0F * (float)Math.PI) * MathHelper.cos(this.rotationPitch / 180.0F * (float)Math.PI));
this.motionY = (double)(-MathHelper.sin((this.rotationPitch) / 180.0F * (float)Math.PI));
this.motionZ = (double)(MathHelper.cos(this.rotationYaw / 180.0F * (float)Math.PI) * MathHelper.cos(this.rotationPitch / 180.0F * (float)Math.PI));
this.shootingEntity = par2EntityLiving;
}
public void onUpdate()
{
if (!this.worldObj.isRemote && (this.shootingEntity != null && this.shootingEntity.isDead || !this.worldObj.blockExists((int)this.posX, (int)this.posY, (int)this.posZ)))
{
this.setDead();
}
else
{
super.onUpdate();
Vec3 vec3 = this.worldObj.getWorldVec3Pool().getVecFromPool(this.posX, this.posY, this.posZ);
Vec3 vec31 = this.worldObj.getWorldVec3Pool().getVecFromPool(this.posX + this.motionX, this.posY + this.motionY, this.posZ + this.motionZ);
MovingObjectPosition movingobjectposition = this.worldObj.rayTraceBlocks(vec3, vec31);
vec3 = this.worldObj.getWorldVec3Pool().getVecFromPool(this.posX, this.posY, this.posZ);
vec31 = this.worldObj.getWorldVec3Pool().getVecFromPool(this.posX + this.motionX, this.posY + this.motionY, this.posZ + this.motionZ);
if (movingobjectposition != null)
{
vec31 = this.worldObj.getWorldVec3Pool().getVecFromPool(movingobjectposition.hitVec.xCoord, movingobjectposition.hitVec.yCoord, movingobjectposition.hitVec.zCoord);
}
Entity entity = null;
List list = this.worldObj.getEntitiesWithinAABBExcludingEntity(this, this.boundingBox.addCoord(this.motionX, this.motionY, this.motionZ).expand(1.0D, 1.0D, 1.0D));
double d0 = 0.0D;
for (int j = 0; j < list.size(); ++j)
{
Entity entity1 = (Entity)list.get(j);
if (entity1.canBeCollidedWith() && (!entity1.isEntityEqual(this.shootingEntity) || this.ticksInAir >= 25))
{
float f = 0.3F;
AxisAlignedBB axisalignedbb = entity1.boundingBox.expand((double)f, (double)f, (double)f);
MovingObjectPosition movingobjectposition1 = axisalignedbb.calculateIntercept(vec3, vec31);
if (movingobjectposition1 != null)
{
double d1 = vec3.distanceTo(movingobjectposition1.hitVec);
if (d1 < d0 || d0 == 0.0D)
{
entity = entity1;
d0 = d1;
}
}
}
}
if (entity != null)
{
movingobjectposition = new MovingObjectPosition(entity);
}
if (movingobjectposition != null)
{
this.onImpact(movingobjectposition);
}
this.posX += this.motionX;
this.posY += this.motionY;
this.posZ += this.motionZ;
float f2 = this.getMotionFactor();
if (this.isInWater())
{
for (int k = 0; k < 4; ++k)
{
float f3 = 0.25F;
this.worldObj.spawnParticle("bubble", this.posX - this.motionX * (double)f3, this.posY - this.motionY * (double)f3, this.posZ - this.motionZ * (double)f3, this.motionX, this.motionY, this.motionZ);
}
f2 = 0.8F;
}
MysticWorld.proxy.fireFX(this.worldObj, this.posX, this.posY + 0.5D, this.posZ, 1.0F);
this.setPosition(this.posX, this.posY, this.posZ);
}
}
protected float getMotionFactor()
{
return 0.95F;
}
protected void onImpact(MovingObjectPosition par1MovingObjectPosition)
{
if (!this.worldObj.isRemote)
{
this.worldObj.playSoundEffect(this.posX, this.posY, this.posZ, "random.explode", 4.0F, (1.0F + (this.worldObj.rand.nextFloat() - this.worldObj.rand.nextFloat()) * 0.2F) * 0.7F);
if (par1MovingObjectPosition.entityHit != null)
{
double f3 = MathHelper.sqrt_double(this.motionX * this.motionX + this.motionZ * this.motionZ);
if (f3 > 0.0F)
{
par1MovingObjectPosition.entityHit.addVelocity(this.motionX * (double)1 * 0.6000000238418579D / (double)f3, 0.1D, this.motionZ * (double)1 * 0.6000000238418579D / (double)f3);
}
if (!par1MovingObjectPosition.entityHit.isImmuneToFire())
{
par1MovingObjectPosition.entityHit.setFire(5);
par1MovingObjectPosition.entityHit.attackEntityFrom(DamageSource.magic, 7);
}
}
else
{
int i = par1MovingObjectPosition.blockX;
int j = par1MovingObjectPosition.blockY;
int k = par1MovingObjectPosition.blockZ;
switch (par1MovingObjectPosition.sideHit)
{
case 0:
--j;
break;
case 1:
++j;
break;
case 2:
--k;
break;
case 3:
++k;
break;
case 4:
--i;
break;
case 5:
++i;
}
if (this.worldObj.isAirBlock(i, j, k))
{
this.worldObj.setBlock(i, j, k, Block.fire.blockID);
}
}
this.setDead();
}
}
@Override
protected void entityInit() {
}
@Override
protected void readEntityFromNBT(NBTTagCompound nbttagcompound) {
}
@Override
protected void writeEntityToNBT(NBTTagCompound nbttagcompound) {
}
public boolean canBeCollidedWith()
{
return true;
}
public float getCollisionBorderSize()
{
return 1.0F;
}
@SideOnly(Side.CLIENT)
public float getShadowSize()
{
return 0.0F;
}
public float getBrightness(float par1)
{
return 1.0F;
}
@SideOnly(Side.CLIENT)
public int getBrightnessForRender(float par1)
{
return 15728880;
}
}

View file

@ -0,0 +1,233 @@
package MysticWorld.Entity;
import java.util.List;
import MysticWorld.MysticWorld;
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.EntityLiving;
import net.minecraft.entity.IProjectile;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.entity.monster.EntityBlaze;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.projectile.EntityFireball;
import net.minecraft.entity.projectile.EntitySmallFireball;
import net.minecraft.entity.projectile.EntityThrowable;
import net.minecraft.nbt.NBTTagCompound;
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;
public class EntityChargeWater extends Entity {
public EntityLiving shootingEntity;
private boolean inGround = false;
private int xTile = -1;
private int yTile = -1;
private int zTile = -1;
private int inTile = 0;
private int ticksAlive;
private int ticksInAir = 0;
public EntityChargeWater(World par1World)
{
super(par1World);
}
public EntityChargeWater(World par1World, EntityLiving par2EntityLiving)
{
super(par1World);
this.setSize(0.25F, 0.25F);
this.setLocationAndAngles(par2EntityLiving.posX, par2EntityLiving.posY + (double)par2EntityLiving.getEyeHeight(), par2EntityLiving.posZ, par2EntityLiving.rotationYaw, par2EntityLiving.rotationPitch);
this.setPosition(this.posX, this.posY, this.posZ);
this.motionX = (double)(-MathHelper.sin(this.rotationYaw / 180.0F * (float)Math.PI) * MathHelper.cos(this.rotationPitch / 180.0F * (float)Math.PI));
this.motionY = (double)(-MathHelper.sin((this.rotationPitch) / 180.0F * (float)Math.PI));
this.motionZ = (double)(MathHelper.cos(this.rotationYaw / 180.0F * (float)Math.PI) * MathHelper.cos(this.rotationPitch / 180.0F * (float)Math.PI));
this.shootingEntity = par2EntityLiving;
}
public void onUpdate()
{
if (!this.worldObj.isRemote && (this.shootingEntity != null && this.shootingEntity.isDead || !this.worldObj.blockExists((int)this.posX, (int)this.posY, (int)this.posZ)))
{
this.setDead();
}
else
{
super.onUpdate();
Vec3 vec3 = this.worldObj.getWorldVec3Pool().getVecFromPool(this.posX, this.posY, this.posZ);
Vec3 vec31 = this.worldObj.getWorldVec3Pool().getVecFromPool(this.posX + this.motionX, this.posY + this.motionY, this.posZ + this.motionZ);
MovingObjectPosition movingobjectposition = this.worldObj.rayTraceBlocks(vec3, vec31);
vec3 = this.worldObj.getWorldVec3Pool().getVecFromPool(this.posX, this.posY, this.posZ);
vec31 = this.worldObj.getWorldVec3Pool().getVecFromPool(this.posX + this.motionX, this.posY + this.motionY, this.posZ + this.motionZ);
if (movingobjectposition != null)
{
vec31 = this.worldObj.getWorldVec3Pool().getVecFromPool(movingobjectposition.hitVec.xCoord, movingobjectposition.hitVec.yCoord, movingobjectposition.hitVec.zCoord);
}
Entity entity = null;
List list = this.worldObj.getEntitiesWithinAABBExcludingEntity(this, this.boundingBox.addCoord(this.motionX, this.motionY, this.motionZ).expand(1.0D, 1.0D, 1.0D));
double d0 = 0.0D;
for (int j = 0; j < list.size(); ++j)
{
Entity entity1 = (Entity)list.get(j);
if (entity1.canBeCollidedWith() && (!entity1.isEntityEqual(this.shootingEntity) || this.ticksInAir >= 25))
{
float f = 0.3F;
AxisAlignedBB axisalignedbb = entity1.boundingBox.expand((double)f, (double)f, (double)f);
MovingObjectPosition movingobjectposition1 = axisalignedbb.calculateIntercept(vec3, vec31);
if (movingobjectposition1 != null)
{
double d1 = vec3.distanceTo(movingobjectposition1.hitVec);
if (d1 < d0 || d0 == 0.0D)
{
entity = entity1;
d0 = d1;
}
}
}
}
if (entity != null)
{
movingobjectposition = new MovingObjectPosition(entity);
}
if (movingobjectposition != null)
{
this.onImpact(movingobjectposition);
}
this.posX += this.motionX;
this.posY += this.motionY;
this.posZ += this.motionZ;
float f2 = this.getMotionFactor();
if (this.isInWater())
{
for (int k = 0; k < 4; ++k)
{
float f3 = 0.25F;
this.worldObj.spawnParticle("bubble", this.posX - this.motionX * (double)f3, this.posY - this.motionY * (double)f3, this.posZ - this.motionZ * (double)f3, this.motionX, this.motionY, this.motionZ);
}
f2 = 0.8F;
}
MysticWorld.proxy.waterFX(this.worldObj, this.posX, this.posY + 0.5D, this.posZ, 1.0F);
this.setPosition(this.posX, this.posY, this.posZ);
}
}
protected float getMotionFactor()
{
return 0.95F;
}
protected void onImpact(MovingObjectPosition par1MovingObjectPosition)
{
if (!this.worldObj.isRemote)
{
this.worldObj.playSoundEffect(this.posX, this.posY, this.posZ, "random.explode", 4.0F, (1.0F + (this.worldObj.rand.nextFloat() - this.worldObj.rand.nextFloat()) * 0.2F) * 0.7F);
if (par1MovingObjectPosition.entityHit != null)
{
double f3 = MathHelper.sqrt_double(this.motionX * this.motionX + this.motionZ * this.motionZ);
if (f3 > 0.0F)
{
par1MovingObjectPosition.entityHit.addVelocity(this.motionX * (double)1 * 0.6000000238418579D / (double)f3, 0.1D, this.motionZ * (double)1 * 0.6000000238418579D / (double)f3);
}
if (par1MovingObjectPosition.entityHit.isImmuneToFire())
{
par1MovingObjectPosition.entityHit.attackEntityFrom(DamageSource.magic, 20);
}
}
else
{
int i = par1MovingObjectPosition.blockX;
int j = par1MovingObjectPosition.blockY;
int k = par1MovingObjectPosition.blockZ;
switch (par1MovingObjectPosition.sideHit)
{
case 0:
--j;
break;
case 1:
++j;
break;
case 2:
--k;
break;
case 3:
++k;
break;
case 4:
--i;
break;
case 5:
++i;
}
}
this.setDead();
}
}
@Override
protected void entityInit() {
}
@Override
protected void readEntityFromNBT(NBTTagCompound nbttagcompound) {
}
@Override
protected void writeEntityToNBT(NBTTagCompound nbttagcompound) {
}
public boolean canBeCollidedWith()
{
return true;
}
public float getCollisionBorderSize()
{
return 1.0F;
}
@SideOnly(Side.CLIENT)
public float getShadowSize()
{
return 0.0F;
}
public float getBrightness(float par1)
{
return 1.0F;
}
@SideOnly(Side.CLIENT)
public int getBrightnessForRender(float par1)
{
return 15728880;
}
}

View file

@ -0,0 +1,30 @@
package MysticWorld.Entity;
import net.minecraft.entity.EnumCreatureType;
import net.minecraft.world.biome.BiomeGenBase;
import net.minecraftforge.common.BiomeDictionary;
import cpw.mods.fml.common.registry.EntityRegistry;
import MysticWorld.MysticWorld;
import MysticWorld.Lib.EntityIds;
import MysticWorld.Lib.Strings;
public class EntityHandler {
public static void init(){
registerEntities();
}
public static void registerEntities(){
EntityRegistry.registerModEntity(EntityChargeAir.class, Strings.ENTITY_AIR_CHARGE_NAME, EntityIds.ENTITY_AIR_CHARGE, MysticWorld.instance, 80, 3, false);
EntityRegistry.registerModEntity(EntityChargeFire.class, Strings.ENTITY_FIREBALL_NAME, EntityIds.ENTITY_FIREBALL, MysticWorld.instance, 80, 3, false);
EntityRegistry.registerModEntity(EntityChargeEarth.class, Strings.ENTITY_EARTH_CHARGE_NAME, EntityIds.ENTITY_EARTH_CHARGE, MysticWorld.instance, 80, 3, false);
EntityRegistry.registerModEntity(EntityChargeEnergy.class, Strings.ENTITY_ENERGY_CHARGE_NAME, EntityIds.ENTITY_ENERGY_CHARGE, MysticWorld.instance, 80, 3, false);
EntityRegistry.registerModEntity(EntityChargeWater.class, Strings.ENTITY_WATER_CHARGE_NAME, EntityIds.ENTITY_WATER_CHARGE, MysticWorld.instance, 80, 3, false);
EntityRegistry.registerModEntity(EntityPigman.class, Strings.ENTITY_PIGMAN_NAME, EntityIds.ENTITY_PIGMAN, MysticWorld.instance, 80, 3, false);
BiomeGenBase[] overworldbiomes = BiomeDictionary.getBiomesForType(BiomeDictionary.Type.PLAINS.DESERT.MAGICAL.MOUNTAIN.FOREST.HILLS);
EntityRegistry.addSpawn(EntityPigman.class, 10, 2, 12, EnumCreatureType.creature, overworldbiomes);
}
}

View file

@ -0,0 +1,133 @@
package MysticWorld.Entity;
import net.minecraft.entity.EntityAgeable;
import net.minecraft.entity.ai.EntityAIControlledByPlayer;
import net.minecraft.entity.ai.EntityAIFollowParent;
import net.minecraft.entity.ai.EntityAILookIdle;
import net.minecraft.entity.ai.EntityAIMate;
import net.minecraft.entity.ai.EntityAIPanic;
import net.minecraft.entity.ai.EntityAISwimming;
import net.minecraft.entity.ai.EntityAITempt;
import net.minecraft.entity.ai.EntityAIWander;
import net.minecraft.entity.ai.EntityAIWatchClosest;
import net.minecraft.entity.effect.EntityLightningBolt;
import net.minecraft.entity.monster.EntityPigZombie;
import net.minecraft.entity.passive.EntityAnimal;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.stats.AchievementList;
import net.minecraft.world.World;
public class EntityPigman extends EntityAnimal
{
public EntityPigman(World par1World)
{
super(par1World);
this.texture = "/mob/pigman.png";
this.setSize(0.9F, 0.9F);
this.getNavigator().setAvoidsWater(true);
float f = 0.25F;
this.tasks.addTask(0, new EntityAISwimming(this));
this.tasks.addTask(1, new EntityAIPanic(this, 0.38F));
this.tasks.addTask(3, new EntityAIMate(this, f));
this.tasks.addTask(4, new EntityAITempt(this, 0.3F, Item.carrot.itemID, false));
this.tasks.addTask(5, new EntityAIFollowParent(this, 0.28F));
this.tasks.addTask(6, new EntityAIWander(this, f));
this.tasks.addTask(7, new EntityAIWatchClosest(this, EntityPlayer.class, 6.0F));
this.tasks.addTask(8, new EntityAILookIdle(this));
}
public boolean isAIEnabled()
{
return true;
}
public int getMaxHealth()
{
return 20;
}
protected void updateAITasks()
{
super.updateAITasks();
}
protected void entityInit()
{
super.entityInit();
this.dataWatcher.addObject(16, Byte.valueOf((byte)0));
}
protected String getLivingSound()
{
return "mob.pig.say";
}
protected String getHurtSound()
{
return "mob.pig.say";
}
protected String getDeathSound()
{
return "mob.pig.death";
}
protected void playStepSound(int par1, int par2, int par3, int par4)
{
this.playSound("mob.pig.step", 0.15F, 1.0F);
}
protected int getDropItemId()
{
return this.isBurning() ? Item.porkCooked.itemID : Item.porkRaw.itemID;
}
protected void dropFewItems(boolean par1, int par2)
{
int j = this.rand.nextInt(3) + 1 + this.rand.nextInt(1 + par2);
for (int k = 0; k < j; ++k)
{
if (this.isBurning())
{
this.dropItem(Item.porkCooked.itemID, 1);
}
else
{
this.dropItem(Item.porkRaw.itemID, 1);
}
}
}
public void onStruckByLightning(EntityLightningBolt par1EntityLightningBolt)
{
if (!this.worldObj.isRemote)
{
EntityPigZombie entitypigzombie = new EntityPigZombie(this.worldObj);
entitypigzombie.setLocationAndAngles(this.posX, this.posY, this.posZ, this.rotationYaw, this.rotationPitch);
this.worldObj.spawnEntityInWorld(entitypigzombie);
this.setDead();
}
}
public EntityPigman spawnBabyAnimal(EntityAgeable par1EntityAgeable)
{
return new EntityPigman(this.worldObj);
}
public boolean isBreedingItem(ItemStack par1ItemStack)
{
return par1ItemStack != null && par1ItemStack.itemID == Item.carrot.itemID;
}
public EntityAgeable createChild(EntityAgeable par1EntityAgeable)
{
return this.spawnBabyAnimal(par1EntityAgeable);
}
}