Search in sources :

Example 1 with IHoardDemon

use of WayofTime.alchemicalWizardry.common.demonVillage.demonHoard.demon.IHoardDemon in project BloodMagic by WayofTime.

the class TEDemonPortal method notifyDemons.

public // TODO
void notifyDemons(// TODO
EntityLivingBase demon, // TODO
EntityLivingBase target, // TODO
double radius) {
    this.lockdownTimer = 1000;
    for (IHoardDemon thrallDemon : this.hoardList) {
        if (thrallDemon instanceof EntityCreature) {
            if (thrallDemon != demon && ((EntityCreature) thrallDemon).getAttackTarget() == null && !((EntityCreature) thrallDemon).isOnSameTeam(target)) {
                double xf = demon.posX;
                double yf = demon.posY;
                double zf = demon.posZ;
                double xi = ((EntityCreature) thrallDemon).posX;
                double yi = ((EntityCreature) thrallDemon).posY;
                double zi = ((EntityCreature) thrallDemon).posZ;
                if ((xi - xf) * (xi - xf) + (yi - yf) * (yi - yf) + (zi - zf) * (zi - zf) <= radius * radius) {
                    ((EntityCreature) thrallDemon).setAttackTarget(target);
                } else {
                    ((EntityCreature) thrallDemon).getNavigator().tryMoveToEntityLiving(target, 2);
                }
            }
        }
    }
}
Also used : IHoardDemon(WayofTime.alchemicalWizardry.common.demonVillage.demonHoard.demon.IHoardDemon) EntityCreature(net.minecraft.entity.EntityCreature)

Example 2 with IHoardDemon

use of WayofTime.alchemicalWizardry.common.demonVillage.demonHoard.demon.IHoardDemon in project BloodMagic by WayofTime.

the class TEDemonPortal method notifyDemons.

public void notifyDemons(int xf, int yf, int zf, double radius) {
    for (IHoardDemon thrallDemon : this.hoardList) {
        if (thrallDemon instanceof EntityCreature) {
            if (((EntityCreature) thrallDemon).getAttackTarget() == null) {
                double xi = ((EntityCreature) thrallDemon).posX;
                double yi = ((EntityCreature) thrallDemon).posY;
                double zi = ((EntityCreature) thrallDemon).posZ;
                if ((xi - xf) * (xi - xf) + (yi - yf) * (yi - yf) + (zi - zf) * (zi - zf) <= radius * radius) {
                    ((EntityCreature) thrallDemon).getNavigator().tryMoveToXYZ(xf, yf, zf, 1);
                }
            }
        }
    }
}
Also used : IHoardDemon(WayofTime.alchemicalWizardry.common.demonVillage.demonHoard.demon.IHoardDemon) EntityCreature(net.minecraft.entity.EntityCreature)

Example 3 with IHoardDemon

use of WayofTime.alchemicalWizardry.common.demonVillage.demonHoard.demon.IHoardDemon in project BloodMagic by WayofTime.

the class RitualEffectAlphaPact method performEffect.

@Override
public void performEffect(IMasterRitualStone ritualStone) {
    String owner = ritualStone.getOwner();
    int currentEssence = SoulNetworkHandler.getCurrentEssence(owner);
    World world = ritualStone.getWorld();
    int x = ritualStone.getXCoord();
    int y = ritualStone.getYCoord();
    int z = ritualStone.getZCoord();
    if (world.getWorldTime() % 20 != 0) {
        return;
    }
    LocalRitualStorage stor = ritualStone.getLocalStorage();
    if (stor instanceof LocalStorageAlphaPact) {
        LocalStorageAlphaPact storage = (LocalStorageAlphaPact) stor;
        Object[] demonList = storage.hoardList.toArray();
        for (Object demon : demonList) {
            if (demon instanceof EntityLivingBase) {
                if (!((EntityLivingBase) demon).isEntityAlive()) {
                    System.out.println(storage.hoardList.remove(demon));
                }
            }
        }
        System.out.println("Hi!");
        int summons = 0;
        int horizontalRange = 25;
        int verticalRange = 20;
        if (storage.hoardList.isEmpty()) {
            IHoardDemon demon = this.getRandomDemonForStage(world, x, y, z, horizontalRange, verticalRange);
            if (demon instanceof EntityLivingBase) {
                world.spawnEntityInWorld((EntityLivingBase) demon);
                storage.thrallDemon(demon);
            }
        } else {
        }
    }
}
Also used : LocalRitualStorage(WayofTime.alchemicalWizardry.api.rituals.LocalRitualStorage) EntityLivingBase(net.minecraft.entity.EntityLivingBase) World(net.minecraft.world.World) IHoardDemon(WayofTime.alchemicalWizardry.common.demonVillage.demonHoard.demon.IHoardDemon)

Example 4 with IHoardDemon

use of WayofTime.alchemicalWizardry.common.demonVillage.demonHoard.demon.IHoardDemon in project BloodMagic by WayofTime.

the class EntityDemonAIHurtByTarget method startExecuting.

@Override
public void startExecuting() {
    Int3 portalPosition = ((IHoardDemon) this.taskOwner).getPortalLocation();
    if (portalPosition == null) {
        super.startExecuting();
        return;
    }
    TileEntity portal = this.taskOwner.worldObj.getTileEntity(portalPosition.xCoord, portalPosition.yCoord, portalPosition.zCoord);
    if ((this.taskOwner.getAITarget() instanceof IHoardDemon && portalPosition.equals(((IHoardDemon) this.taskOwner.getAITarget()).getPortalLocation()))) {
        return;
    }
    this.taskOwner.setAttackTarget(this.taskOwner.getAITarget());
    if (this.entityCallsForHelp && this.taskOwner instanceof IHoardDemon) {
        if (portal instanceof TEDemonPortal) {
            ((TEDemonPortal) portal).notifyDemons(taskOwner, this.taskOwner.getAITarget(), 25);
        }
    // double d0 = this.getTargetDistance();
    // List list = this.taskOwner.worldObj.getEntitiesWithinAABB(this.taskOwner.getClass(), AxisAlignedBB.getBoundingBox(this.taskOwner.posX, this.taskOwner.posY, this.taskOwner.posZ, this.taskOwner.posX + 1.0D, this.taskOwner.posY + 1.0D, this.taskOwner.posZ + 1.0D).expand(d0, 10.0D, d0));
    // Iterator iterator = list.iterator();
    // 
    // while (iterator.hasNext())
    // {
    // EntityCreature entitycreature = (EntityCreature)iterator.next();
    // 
    // if (this.taskOwner != entitycreature && entitycreature.getAttackTarget() == null && !entitycreature.isOnSameTeam(this.taskOwner.getAITarget()))
    // {
    // entitycreature.setAttackTarget(this.taskOwner.getAITarget());
    // }
    // }
    }
    super.startExecuting();
}
Also used : TileEntity(net.minecraft.tileentity.TileEntity) Int3(WayofTime.alchemicalWizardry.api.Int3) TEDemonPortal(WayofTime.alchemicalWizardry.common.demonVillage.tileEntity.TEDemonPortal) IHoardDemon(WayofTime.alchemicalWizardry.common.demonVillage.demonHoard.demon.IHoardDemon)

Example 5 with IHoardDemon

use of WayofTime.alchemicalWizardry.common.demonVillage.demonHoard.demon.IHoardDemon in project BloodMagic by WayofTime.

the class RitualEffectAlphaPact method getRandomDemonForStage.

public IHoardDemon getRandomDemonForStage(World world, int x, int y, int z, int horizontalRange, int verticalRange) {
    EntityLivingBase entityLiving = new EntityMinorDemonGrunt(world);
    boolean isGood = false;
    for (int n = 0; n < 100; n++) {
        double newX = x + (rand.nextInt(horizontalRange) - horizontalRange) + 0.5;
        double newY = y + (double) (rand.nextInt((int) verticalRange));
        double newZ = z + (rand.nextInt(horizontalRange) - horizontalRange) + 0.5;
        entityLiving.posX = newX;
        entityLiving.posY = newY;
        entityLiving.posZ = newZ;
        int i = MathHelper.floor_double(entityLiving.posX);
        int j = MathHelper.floor_double(entityLiving.posY);
        int k = MathHelper.floor_double(entityLiving.posZ);
        Block l;
        if (entityLiving.worldObj.blockExists(i, j, k)) {
            boolean flag1 = false;
            while (!flag1 && j > 0) {
                l = entityLiving.worldObj.getBlock(i, j - 1, k);
                if (l != null && l.getMaterial().blocksMovement()) {
                    flag1 = true;
                } else {
                    --entityLiving.posY;
                    --j;
                }
            }
        }
        if (entityLiving.worldObj.getCollidingBoundingBoxes(entityLiving, entityLiving.boundingBox).isEmpty() && !entityLiving.worldObj.isAnyLiquid(entityLiving.boundingBox)) {
            entityLiving.setPositionAndUpdate(newX, newY, newZ);
            isGood = true;
        }
    }
    if (isGood = false) {
        return null;
    }
    return (IHoardDemon) entityLiving;
}
Also used : EntityMinorDemonGrunt(WayofTime.alchemicalWizardry.common.demonVillage.demonHoard.demon.EntityMinorDemonGrunt) EntityLivingBase(net.minecraft.entity.EntityLivingBase) Block(net.minecraft.block.Block) IHoardDemon(WayofTime.alchemicalWizardry.common.demonVillage.demonHoard.demon.IHoardDemon)

Aggregations

IHoardDemon (WayofTime.alchemicalWizardry.common.demonVillage.demonHoard.demon.IHoardDemon)7 EntityLivingBase (net.minecraft.entity.EntityLivingBase)3 EntityCreature (net.minecraft.entity.EntityCreature)2 EntityPlayer (net.minecraft.entity.player.EntityPlayer)2 World (net.minecraft.world.World)2 Int3 (WayofTime.alchemicalWizardry.api.Int3)1 LocalRitualStorage (WayofTime.alchemicalWizardry.api.rituals.LocalRitualStorage)1 IDemon (WayofTime.alchemicalWizardry.common.IDemon)1 EntityMinorDemonGrunt (WayofTime.alchemicalWizardry.common.demonVillage.demonHoard.demon.EntityMinorDemonGrunt)1 TEDemonPortal (WayofTime.alchemicalWizardry.common.demonVillage.tileEntity.TEDemonPortal)1 SubscribeEvent (cpw.mods.fml.common.eventhandler.SubscribeEvent)1 Block (net.minecraft.block.Block)1 IBossDisplayData (net.minecraft.entity.boss.IBossDisplayData)1 EntityEnderman (net.minecraft.entity.monster.EntityEnderman)1 EntitySlime (net.minecraft.entity.monster.EntitySlime)1 EntityAnimal (net.minecraft.entity.passive.EntityAnimal)1 EntityVillager (net.minecraft.entity.passive.EntityVillager)1 TileEntity (net.minecraft.tileentity.TileEntity)1