use of net.minecraft.entity.boss.IBossDisplayData in project ArsMagica2 by Mithion.
the class ItemCrystalPhylactery method getSpawnableEntities.
public void getSpawnableEntities(World world) {
for (Object clazz : EntityList.classToStringMapping.keySet()) {
if (EntityCreature.class.isAssignableFrom((Class) clazz)) {
try {
EntityCreature temp = (EntityCreature) ((Class) clazz).getConstructor(World.class).newInstance(world);
if (EntityUtilities.isAIEnabled(temp) && !(temp instanceof IBossDisplayData)) {
int color = 0;
boolean found = false;
//look for entity egg
for (Object info : EntityList.entityEggs.values()) {
EntityEggInfo eei = (EntityEggInfo) info;
Class spawnClass = EntityList.getClassFromID(eei.spawnedID);
if (spawnClass == (Class) clazz) {
color = eei.primaryColor;
found = true;
break;
}
}
if (!found) {
//no spawn egg...pick random color?
color = world.rand.nextInt();
}
spawnableEntities.put((String) EntityList.classToStringMapping.get(clazz), color);
}
} catch (Throwable e) {
//e.printStackTrace();
}
}
}
}
use of net.minecraft.entity.boss.IBossDisplayData in project ArsMagica2 by Mithion.
the class Appropriation method applyEffectEntity.
@Override
public boolean applyEffectEntity(ItemStack stack, World world, EntityLivingBase caster, Entity target) {
if (target instanceof EntityPlayer || target instanceof IBossDisplayData)
return false;
if (!(target instanceof EntityLivingBase))
return false;
for (Class clazz : AMCore.config.getAppropriationMobBlacklist()) if (target.getClass() == clazz)
return false;
if (!(caster instanceof EntityPlayer))
return false;
ItemStack originalSpellStack = getOriginalSpellStack((EntityPlayer) caster);
if (originalSpellStack == null)
return false;
if (!world.isRemote) {
if (originalSpellStack.stackTagCompound.hasKey(storageKey)) {
restore((EntityPlayer) caster, world, originalSpellStack, (int) target.posX, (int) target.posY, (int) target.posZ, target.posX, target.posY + target.getEyeHeight(), target.posZ);
} else {
NBTTagCompound data = new NBTTagCompound();
data.setString("class", target.getClass().getName());
data.setString(storageType, "ent");
NBTTagCompound targetData = new NBTTagCompound();
target.writeToNBT(targetData);
data.setTag("targetNBT", targetData);
originalSpellStack.stackTagCompound.setTag(storageKey, data);
setOriginalSpellStackData((EntityPlayer) caster, originalSpellStack);
target.setDead();
}
}
return true;
}
use of net.minecraft.entity.boss.IBossDisplayData in project ArsMagica2 by Mithion.
the class EntityUtilities method makeSummon_PlayerFaction.
public static void makeSummon_PlayerFaction(EntityCreature entityliving, EntityPlayer player, boolean storeForRevert) {
if (isAIEnabled(entityliving) && !(entityliving instanceof IBossDisplayData) && ExtendedProperties.For(player).getCanHaveMoreSummons()) {
if (storeForRevert)
storedTasks.put(entityliving.getEntityId(), new ArrayList(entityliving.targetTasks.taskEntries));
boolean addMeleeAttack = false;
ArrayList<EntityAITaskEntry> toRemove = new ArrayList<EntityAITaskEntry>();
for (Object task : entityliving.tasks.taskEntries) {
EntityAITaskEntry base = (EntityAITaskEntry) task;
if (base.action instanceof EntityAIAttackOnCollide) {
toRemove.add(base);
addMeleeAttack = true;
}
}
entityliving.tasks.taskEntries.removeAll(toRemove);
if (storeForRevert)
storedAITasks.put(entityliving.getEntityId(), toRemove);
if (addMeleeAttack) {
float speed = entityliving.getAIMoveSpeed();
if (speed <= 0)
speed = 1.0f;
entityliving.tasks.addTask(3, new EntityAIAttackOnCollide(entityliving, EntityMob.class, speed, true));
entityliving.tasks.addTask(3, new EntityAIAttackOnCollide(entityliving, IMob.class, speed, true));
entityliving.tasks.addTask(3, new EntityAIAttackOnCollide(entityliving, EntitySlime.class, speed, true));
}
entityliving.targetTasks.taskEntries.clear();
entityliving.targetTasks.addTask(1, new EntityAIHurtByTarget(entityliving, true));
entityliving.targetTasks.addTask(2, new EntityAINearestAttackableTarget(entityliving, EntityMob.class, 0, true, false, SummonEntitySelector.instance));
entityliving.targetTasks.addTask(2, new EntityAINearestAttackableTarget(entityliving, EntitySlime.class, 0, true));
entityliving.targetTasks.addTask(2, new EntityAINearestAttackableTarget(entityliving, EntityGhast.class, 0, true));
if (!entityliving.worldObj.isRemote && entityliving.getAttackTarget() != null && entityliving.getAttackTarget() instanceof EntityPlayer)
AMCore.proxy.addDeferredTargetSet(entityliving, null);
if (entityliving instanceof EntityTameable) {
((EntityTameable) entityliving).setTamed(true);
((EntityTameable) entityliving).func_152115_b(player.getCommandSenderName());
}
entityliving.getEntityData().setBoolean(isSummonKey, true);
ExtendedProperties.For(player).addSummon(entityliving);
}
}
use of net.minecraft.entity.boss.IBossDisplayData in project ArsMagica2 by Mithion.
the class TileEntityBlackAurem method updateNearbyEntities.
private void updateNearbyEntities() {
ArrayList<EntityLivingBase> toRemove = new ArrayList<EntityLivingBase>();
List<EntityLivingBase> nearbyEntities = this.worldObj.getEntitiesWithinAABB(EntityLivingBase.class, AxisAlignedBB.getBoundingBox(this.xCoord - 10, this.yCoord, this.zCoord - 10, this.xCoord + 10, this.yCoord + 4, this.zCoord + 10));
for (EntityLivingBase entity : nearbyEntities) {
if (entity.isEntityInvulnerable() || entity instanceof IBossDisplayData || entity instanceof EntityDarkling || entity instanceof EntityPlayer || entity instanceof EntityAirSled || entity instanceof EntityWinterGuardianArm || entity instanceof EntityThrownSickle || entity instanceof EntityFlicker || entity instanceof EntityShadowHelper)
continue;
if (!cachedEntities.contains(entity))
cachedEntities.add(entity);
}
ticksSinceLastEntityScan = 0;
}
use of net.minecraft.entity.boss.IBossDisplayData in project ArsMagica2 by Mithion.
the class EntityUtilities method makeSummon_MonsterFaction.
public static void makeSummon_MonsterFaction(EntityCreature entityliving, boolean storeForRevert) {
if (isAIEnabled(entityliving) && !(entityliving instanceof IBossDisplayData)) {
if (storeForRevert)
storedTasks.put(entityliving.getEntityId(), new ArrayList(entityliving.targetTasks.taskEntries));
entityliving.targetTasks.taskEntries.clear();
entityliving.targetTasks.addTask(1, new EntityAIHurtByTarget(entityliving, true));
entityliving.targetTasks.addTask(2, new EntityAINearestAttackableTarget(entityliving, EntityPlayer.class, 0, true));
if (!entityliving.worldObj.isRemote && entityliving.getAttackTarget() != null && entityliving.getAttackTarget() instanceof EntityMob)
AMCore.proxy.addDeferredTargetSet(entityliving, null);
entityliving.getEntityData().setBoolean(isSummonKey, true);
}
}
Aggregations