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);
}
}
}
}
}
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);
}
}
}
}
}
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 {
}
}
}
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();
}
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;
}
Aggregations