Created all code necessary to summon the portal. I'm awesome, I know.

This commit is contained in:
WayofTime 2014-12-04 14:31:31 -05:00
parent 832ed15060
commit 9b0fa9b052
37 changed files with 915 additions and 89 deletions

View file

@ -1,34 +0,0 @@
package WayofTime.alchemicalWizardry.common.demonVillage.demonHoard;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.world.World;
import WayofTime.alchemicalWizardry.common.demonVillage.demonHoard.demon.EntityMinorDemonGrunt;
import WayofTime.alchemicalWizardry.common.demonVillage.tileEntity.TEDemonPortal;
public class DemonPacketAngel extends DemonHoardPacket
{
@Override
public boolean canFitType(DemonType type)
{
return true;
}
@Override
public float getRelativeChance(DemonType type, int tier, boolean spawnGuardian)
{
return 1.0f;
}
@Override
public int summonDemons(TEDemonPortal teDemonPortal, World world, int x, int y, int z, DemonType type, int tier, boolean spawnGuardian)
{
EntityLivingBase entity = new EntityMinorDemonGrunt(world);
entity.setPosition(x, y, z);
world.spawnEntityInWorld(entity);
teDemonPortal.enthrallDemon(entity);
return 1;
}
}

View file

@ -0,0 +1,61 @@
package WayofTime.alchemicalWizardry.common.demonVillage.demonHoard;
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.EntityMinorDemonGruntIce;
import WayofTime.alchemicalWizardry.common.demonVillage.demonHoard.demon.EntityMinorDemonGruntWind;
import WayofTime.alchemicalWizardry.common.demonVillage.tileEntity.TEDemonPortal;
public class DemonPacketMinorGrunt extends DemonHoardPacket
{
@Override
public boolean canFitType(DemonType type)
{
return true;
}
@Override
public float getRelativeChance(DemonType type, int tier, boolean spawnGuardian)
{
return 1.0f;
}
@Override
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;
}
entity.setPosition(x, y, z);
world.spawnEntityInWorld(entity);
teDemonPortal.enthrallDemon(entity);
entity.setAggro(true);
entity.setDropCrystal(false);
return 1;
}
}

View file

@ -2,6 +2,7 @@ package WayofTime.alchemicalWizardry.common.demonVillage.demonHoard;
public enum DemonType
{
NORMAL,
FIRE,
WATER,
ICE,

View file

@ -25,7 +25,7 @@ import net.minecraft.util.DamageSource;
import net.minecraft.world.World;
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
import WayofTime.alchemicalWizardry.ModItems;
import WayofTime.alchemicalWizardry.common.EntityAITargetAggro;
import WayofTime.alchemicalWizardry.common.EntityAITargetAggroCloaking;
import WayofTime.alchemicalWizardry.common.Int3;
import WayofTime.alchemicalWizardry.common.demonVillage.ai.EntityAIOccasionalRangedAttack;
import WayofTime.alchemicalWizardry.common.demonVillage.ai.EntityDemonAIHurtByTarget;
@ -62,8 +62,8 @@ public class EntityMinorDemonGrunt extends EntityDemon implements IOccasionalRan
this.targetTasks.addTask(1, new EntityAIOwnerHurtByTarget(this));
this.targetTasks.addTask(2, new EntityAIOwnerHurtTarget(this));
this.targetTasks.addTask(3, new EntityDemonAIHurtByTarget(this, true));
this.targetTasks.addTask(4, new EntityAITargetAggro(this, EntityPlayer.class, 0, false));
this.setAggro(true);
this.targetTasks.addTask(4, new EntityAITargetAggroCloaking(this, EntityPlayer.class, 0, false, 0));
this.setAggro(false);
this.setTamed(false);
demonPortal = new Int3(0,0,0);
@ -419,6 +419,12 @@ public class EntityMinorDemonGrunt extends EntityDemon implements IOccasionalRan
public boolean attackEntityAsMob(Entity par1Entity)
{
int i = this.isTamed() ? 20 : 20;
if(par1Entity instanceof IHoardDemon && ((IHoardDemon) par1Entity).isSamePortal(this))
{
return false;
}
return par1Entity.attackEntityFrom(DamageSource.causeMobDamage(this), (float) i);
}
@ -428,6 +434,10 @@ public class EntityMinorDemonGrunt extends EntityDemon implements IOccasionalRan
@Override
public void attackEntityWithRangedAttack(EntityLivingBase par1EntityLivingBase, float par2)
{
if(par1EntityLivingBase instanceof IHoardDemon && ((IHoardDemon) par1EntityLivingBase).isSamePortal(this))
{
return;
}
double xCoord;
double yCoord;
double zCoord;

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.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 EntityMinorDemonGruntEarth extends EntityMinorDemonGrunt
{
public EntityMinorDemonGruntEarth(World par1World)
{
super(par1World);
this.setDemonID(AlchemicalWizardry.entityMinorDemonGruntEarthID);
}
@Override
public boolean attackEntityAsMob(Entity par1Entity)
{
int i = this.isTamed() ? 20 : 20;
if(par1Entity instanceof IHoardDemon && ((IHoardDemon) par1Entity).isSamePortal(this))
{
return false;
}
if(par1Entity instanceof EntityLivingBase)
{
((EntityLivingBase) par1Entity).addPotionEffect(new PotionEffect(Potion.moveSlowdown.id, 200, 2));
}
return par1Entity.attackEntityFrom(DamageSource.causeMobDamage(this), (float) i);
}
@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, 15, 600, false);
this.worldObj.spawnEntityInWorld(hol);
}
}

View file

@ -0,0 +1,45 @@
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 EntityMinorDemonGruntFire extends EntityMinorDemonGrunt
{
public EntityMinorDemonGruntFire(World par1World)
{
super(par1World);
this.setDemonID(AlchemicalWizardry.entityMinorDemonGruntFireID);
}
@Override
public boolean attackEntityAsMob(Entity par1Entity)
{
int i = this.isTamed() ? 20 : 20;
if(par1Entity instanceof IHoardDemon && ((IHoardDemon) par1Entity).isSamePortal(this))
{
return false;
}
par1Entity.setFire(10);
return par1Entity.attackEntityFrom(DamageSource.causeMobDamage(this), (float) i);
}
@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, 15, 600);
this.worldObj.spawnEntityInWorld(hol);
}
}

View file

@ -0,0 +1,43 @@
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 EntityMinorDemonGruntIce extends EntityMinorDemonGrunt
{
public EntityMinorDemonGruntIce(World par1World)
{
super(par1World);
this.setDemonID(AlchemicalWizardry.entityMinorDemonGruntIceID);
}
@Override
public boolean attackEntityAsMob(Entity par1Entity)
{
int i = this.isTamed() ? 20 : 20;
if(par1Entity instanceof IHoardDemon && ((IHoardDemon) par1Entity).isSamePortal(this))
{
return false;
}
return par1Entity.attackEntityFrom(DamageSource.causeMobDamage(this), (float) i);
}
@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, 15, 600);
this.worldObj.spawnEntityInWorld(hol);
}
}

View file

@ -0,0 +1,43 @@
package WayofTime.alchemicalWizardry.common.demonVillage.demonHoard.demon;
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
import WayofTime.alchemicalWizardry.common.entity.projectile.WindGustProjectile;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.util.DamageSource;
import net.minecraft.world.World;
public class EntityMinorDemonGruntWind extends EntityMinorDemonGrunt
{
public EntityMinorDemonGruntWind(World par1World)
{
super(par1World);
this.setDemonID(AlchemicalWizardry.entityMinorDemonGruntWindID);
}
@Override
public boolean attackEntityAsMob(Entity par1Entity)
{
int i = this.isTamed() ? 20 : 20;
if(par1Entity instanceof IHoardDemon && ((IHoardDemon) par1Entity).isSamePortal(this))
{
return false;
}
return par1Entity.attackEntityFrom(DamageSource.causeMobDamage(this), (float) i);
}
@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, 15, 600);
this.worldObj.spawnEntityInWorld(hol);
}
}