Added Guardians

This commit is contained in:
WayofTime 2014-12-10 11:01:03 -05:00
parent a2b0f59765
commit 08a8f1dc13
23 changed files with 618 additions and 65 deletions

View file

@ -4,6 +4,11 @@ import net.minecraft.world.World;
import WayofTime.alchemicalWizardry.common.demonVillage.demonHoard.demon.EntityMinorDemonGrunt;
import WayofTime.alchemicalWizardry.common.demonVillage.demonHoard.demon.EntityMinorDemonGruntEarth;
import WayofTime.alchemicalWizardry.common.demonVillage.demonHoard.demon.EntityMinorDemonGruntFire;
import WayofTime.alchemicalWizardry.common.demonVillage.demonHoard.demon.EntityMinorDemonGruntGuardian;
import WayofTime.alchemicalWizardry.common.demonVillage.demonHoard.demon.EntityMinorDemonGruntGuardianEarth;
import WayofTime.alchemicalWizardry.common.demonVillage.demonHoard.demon.EntityMinorDemonGruntGuardianFire;
import WayofTime.alchemicalWizardry.common.demonVillage.demonHoard.demon.EntityMinorDemonGruntGuardianIce;
import WayofTime.alchemicalWizardry.common.demonVillage.demonHoard.demon.EntityMinorDemonGruntGuardianWind;
import WayofTime.alchemicalWizardry.common.demonVillage.demonHoard.demon.EntityMinorDemonGruntIce;
import WayofTime.alchemicalWizardry.common.demonVillage.demonHoard.demon.EntityMinorDemonGruntWind;
import WayofTime.alchemicalWizardry.common.demonVillage.tileEntity.TEDemonPortal;
@ -26,26 +31,58 @@ public class DemonPacketMinorGrunt extends DemonHoardPacket
public int summonDemons(TEDemonPortal teDemonPortal, World world, int x, int y, int z, DemonType type, int tier, boolean spawnGuardian)
{
EntityMinorDemonGrunt entity;
switch(type)
{
case FIRE:
entity = new EntityMinorDemonGruntFire(world);
break;
case ICE:
entity = new EntityMinorDemonGruntIce(world);
break;
case WATER:
entity = new EntityMinorDemonGruntEarth(world);
break;
case WIND:
entity = new EntityMinorDemonGruntWind(world);
break;
case NORMAL:
default:
entity = new EntityMinorDemonGrunt(world);
break;
switch(type)
{
case FIRE:
if(spawnGuardian)
{
entity = new EntityMinorDemonGruntGuardianFire(world);
}else
{
entity = new EntityMinorDemonGruntFire(world);
}
break;
case ICE:
if(spawnGuardian)
{
entity = new EntityMinorDemonGruntGuardianIce(world);
}else
{
entity = new EntityMinorDemonGruntIce(world);
}
break;
case EARTH:
if(spawnGuardian)
{
entity = new EntityMinorDemonGruntGuardianEarth(world);
}else
{
entity = new EntityMinorDemonGruntEarth(world);
}
break;
case WIND:
if(spawnGuardian)
{
entity = new EntityMinorDemonGruntGuardianWind(world);
}else
{
entity = new EntityMinorDemonGruntWind(world);
}
break;
case NORMAL:
default:
if(spawnGuardian)
{
entity = new EntityMinorDemonGruntGuardian(world);
}else
{
entity = new EntityMinorDemonGrunt(world);
}
break;
}
}
entity.setPosition(x, y, z);

View file

@ -4,7 +4,7 @@ public enum DemonType
{
NORMAL,
FIRE,
WATER,
EARTH,
ICE,
WIND
}

View file

@ -0,0 +1,47 @@
package WayofTime.alchemicalWizardry.common.demonVillage.demonHoard.demon;
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
import WayofTime.alchemicalWizardry.common.entity.projectile.HolyProjectile;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.util.DamageSource;
import net.minecraft.world.World;
public class EntityMinorDemonGruntGuardian extends EntityMinorDemonGrunt
{
public EntityMinorDemonGruntGuardian(World par1World)
{
super(par1World);
this.setDemonID(AlchemicalWizardry.entityMinorDemonGruntGuardianID);
}
@Override
public boolean attackEntityAsMob(Entity par1Entity)
{
int i = this.isTamed() ? 25 : 25;
if(par1Entity instanceof IHoardDemon && ((IHoardDemon) par1Entity).isSamePortal(this))
{
return false;
}
return par1Entity.attackEntityFrom(DamageSource.causeMobDamage(this), (float) i);
}
/**
* Attack the specified entity using a ranged attack.
*/
@Override
public void attackEntityWithRangedAttack(EntityLivingBase par1EntityLivingBase, float par2)
{
if(par1EntityLivingBase instanceof IHoardDemon && ((IHoardDemon) par1EntityLivingBase).isSamePortal(this))
{
return;
}
double xCoord;
double yCoord;
double zCoord;
HolyProjectile hol = new HolyProjectile(worldObj, this, par1EntityLivingBase, 1.8f, 0f, 20, 600);
this.worldObj.spawnEntityInWorld(hol);
}
}

View file

@ -0,0 +1,54 @@
package WayofTime.alchemicalWizardry.common.demonVillage.demonHoard.demon;
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.world.World;
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
import WayofTime.alchemicalWizardry.common.entity.projectile.ExplosionProjectile;
public class EntityMinorDemonGruntGuardianEarth extends EntityMinorDemonGruntGuardian
{
public EntityMinorDemonGruntGuardianEarth(World par1World)
{
super(par1World);
this.setDemonID(AlchemicalWizardry.entityMinorDemonGruntGuardianEarthID);
}
@Override
public boolean attackEntityAsMob(Entity par1Entity)
{
int i = this.isTamed() ? 25 : 25;
if(par1Entity instanceof IHoardDemon && ((IHoardDemon) par1Entity).isSamePortal(this))
{
return false;
}
if(par1Entity instanceof EntityLivingBase)
{
((EntityLivingBase) par1Entity).addPotionEffect(new PotionEffect(Potion.moveSlowdown.id, 200, 4));
}
return par1Entity.attackEntityFrom(DamageSource.causeMobDamage(this), (float) i);
}
/**
* Attack the specified entity using a ranged attack.
*/
@Override
public void attackEntityWithRangedAttack(EntityLivingBase par1EntityLivingBase, float par2)
{
if(par1EntityLivingBase instanceof IHoardDemon && ((IHoardDemon) par1EntityLivingBase).isSamePortal(this))
{
return;
}
double xCoord;
double yCoord;
double zCoord;
ExplosionProjectile hol = new ExplosionProjectile(worldObj, this, par1EntityLivingBase, 1.8f, 0f, 20, 600, false);
this.worldObj.spawnEntityInWorld(hol);
}
}

View file

@ -0,0 +1,50 @@
package WayofTime.alchemicalWizardry.common.demonVillage.demonHoard.demon;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.util.DamageSource;
import net.minecraft.world.World;
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
import WayofTime.alchemicalWizardry.common.entity.projectile.FireProjectile;
public class EntityMinorDemonGruntGuardianFire extends EntityMinorDemonGruntGuardian
{
public EntityMinorDemonGruntGuardianFire(World par1World)
{
super(par1World);
this.setDemonID(AlchemicalWizardry.entityMinorDemonGruntGuardianFireID);
this.isImmuneToFire = true;
}
@Override
public boolean attackEntityAsMob(Entity par1Entity)
{
int i = this.isTamed() ? 25 : 25;
if(par1Entity instanceof IHoardDemon && ((IHoardDemon) par1Entity).isSamePortal(this))
{
return false;
}
par1Entity.setFire(15);
return par1Entity.attackEntityFrom(DamageSource.causeMobDamage(this), (float) i);
}
/**
* Attack the specified entity using a ranged attack.
*/
@Override
public void attackEntityWithRangedAttack(EntityLivingBase par1EntityLivingBase, float par2)
{
if(par1EntityLivingBase instanceof IHoardDemon && ((IHoardDemon) par1EntityLivingBase).isSamePortal(this))
{
return;
}
double xCoord;
double yCoord;
double zCoord;
FireProjectile hol = new FireProjectile(worldObj, this, par1EntityLivingBase, 1.8f, 0f, 20, 600);
this.worldObj.spawnEntityInWorld(hol);
}
}

View file

@ -0,0 +1,47 @@
package WayofTime.alchemicalWizardry.common.demonVillage.demonHoard.demon;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.util.DamageSource;
import net.minecraft.world.World;
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
import WayofTime.alchemicalWizardry.common.entity.projectile.IceProjectile;
public class EntityMinorDemonGruntGuardianIce extends EntityMinorDemonGruntGuardian
{
public EntityMinorDemonGruntGuardianIce(World par1World)
{
super(par1World);
this.setDemonID(AlchemicalWizardry.entityMinorDemonGruntGuardianIceID);
}
@Override
public boolean attackEntityAsMob(Entity par1Entity)
{
int i = this.isTamed() ? 25 : 25;
if(par1Entity instanceof IHoardDemon && ((IHoardDemon) par1Entity).isSamePortal(this))
{
return false;
}
return par1Entity.attackEntityFrom(DamageSource.causeMobDamage(this), (float) i);
}
/**
* Attack the specified entity using a ranged attack.
*/
@Override
public void attackEntityWithRangedAttack(EntityLivingBase par1EntityLivingBase, float par2)
{
if(par1EntityLivingBase instanceof IHoardDemon && ((IHoardDemon) par1EntityLivingBase).isSamePortal(this))
{
return;
}
double xCoord;
double yCoord;
double zCoord;
IceProjectile hol = new IceProjectile(worldObj, this, par1EntityLivingBase, 1.8f, 0f, 20, 600);
this.worldObj.spawnEntityInWorld(hol);
}
}

View file

@ -0,0 +1,64 @@
package WayofTime.alchemicalWizardry.common.demonVillage.demonHoard.demon;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.util.DamageSource;
import net.minecraft.world.World;
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
import WayofTime.alchemicalWizardry.common.entity.projectile.WindGustProjectile;
import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper;
public class EntityMinorDemonGruntGuardianWind extends EntityMinorDemonGruntGuardian
{
public EntityMinorDemonGruntGuardianWind(World par1World)
{
super(par1World);
this.setDemonID(AlchemicalWizardry.entityMinorDemonGruntGuardianWindID);
}
@Override
public boolean attackEntityAsMob(Entity par1Entity)
{
int i = this.isTamed() ? 25 : 25;
if(par1Entity instanceof IHoardDemon && ((IHoardDemon) par1Entity).isSamePortal(this))
{
return false;
}
if (par1Entity instanceof EntityPlayer)
{
SpellHelper.setPlayerSpeedFromServer((EntityPlayer) par1Entity, par1Entity.motionX, par1Entity.motionY + 4, par1Entity.motionZ);
} else if (par1Entity instanceof EntityLivingBase)
{
((EntityLivingBase) par1Entity).motionY += 4.0D;
}
return par1Entity.attackEntityFrom(DamageSource.causeMobDamage(this), (float) i);
}
@Override
public void onLivingUpdate()
{
super.onLivingUpdate();
this.fallDistance = 0;
}
/**
* Attack the specified entity using a ranged attack.
*/
@Override
public void attackEntityWithRangedAttack(EntityLivingBase par1EntityLivingBase, float par2)
{
if(par1EntityLivingBase instanceof IHoardDemon && ((IHoardDemon) par1EntityLivingBase).isSamePortal(this))
{
return;
}
double xCoord;
double yCoord;
double zCoord;
WindGustProjectile hol = new WindGustProjectile(worldObj, this, par1EntityLivingBase, 1.8f, 0f, 20, 600);
this.worldObj.spawnEntityInWorld(hol);
}
}

View file

@ -46,7 +46,7 @@ public class TEDemonPortal extends TileEntity
{
public DemonType type = DemonType.FIRE;
public static boolean printDebug = false;
public static boolean printDebug = true;
public static int limit = 100;
@ -576,6 +576,9 @@ public class TEDemonPortal extends TileEntity
return 0;
}
if(TEDemonPortal.printDebug)
System.out.println("Spawning Demons");
return DemonPacketRegistry.spawnDemons(teDemonPortal, worldObj, xCoord + road.xCoord * 5, road.yCoord + 1, zCoord + road.zCoord * 5, type, tier, spawnGuardian);
}