Skip to content
Permalink
Browse files

Chestbursters now run from large entities, and attack smaller entitie…

…s in order to grow up.
  • Loading branch information...
Ri5ux committed Mar 30, 2019
1 parent 297d3a9 commit 60e424f3779c783f1fc59dda1ca3622f92ae8b7e
@@ -1,10 +1,112 @@
package org.avp.api.parasitoidic;

import java.util.ArrayList;

import org.avp.entities.living.EntityMarine;
import org.avp.entities.living.species.SpeciesEngineer;
import org.avp.entities.living.species.SpeciesYautja;
import org.avp.world.capabilities.IOrganism.Organism;
import org.avp.world.capabilities.IOrganism.Provider;

import com.google.common.base.Predicate;

import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.boss.EntityWither;
import net.minecraft.entity.monster.EntityBlaze;
import net.minecraft.entity.monster.EntityEnderman;
import net.minecraft.entity.monster.EntityEndermite;
import net.minecraft.entity.monster.EntityGhast;
import net.minecraft.entity.monster.EntityGolem;
import net.minecraft.entity.monster.EntityHusk;
import net.minecraft.entity.monster.EntityMagmaCube;
import net.minecraft.entity.monster.EntityPigZombie;
import net.minecraft.entity.monster.EntityShulker;
import net.minecraft.entity.monster.EntitySkeleton;
import net.minecraft.entity.monster.EntitySlime;
import net.minecraft.entity.monster.EntitySnowman;
import net.minecraft.entity.monster.EntityStray;
import net.minecraft.entity.monster.EntityVex;
import net.minecraft.entity.monster.EntityZombie;
import net.minecraft.entity.passive.EntitySkeletonHorse;
import net.minecraft.entity.passive.EntityZombieHorse;

public interface INascentic extends IMaturable
{
public void vitalize(EntityLivingBase host);

public void grow(EntityLivingBase host);

public static ArrayList<Class<?>> getDefaultEntityRunFromlist()
{
ArrayList<Class<?>> blacklist = new ArrayList<Class<?>>();

blacklist.add(EntitySnowman.class);
blacklist.add(EntityGolem.class);
blacklist.add(EntitySkeleton.class);
blacklist.add(EntityZombie.class);
blacklist.add(EntityPigZombie.class);
blacklist.add(EntityGhast.class);
blacklist.add(EntityBlaze.class);
blacklist.add(EntitySlime.class);
blacklist.add(EntityMagmaCube.class);
blacklist.add(EntityWither.class);
blacklist.add(EntityShulker.class);
blacklist.add(EntitySkeletonHorse.class);
blacklist.add(EntityZombieHorse.class);
blacklist.add(EntityEndermite.class);
blacklist.add(EntityEnderman.class);
blacklist.add(EntityVex.class);
blacklist.add(EntityHusk.class);
blacklist.add(EntityStray.class);
blacklist.add(EntityMarine.class);
blacklist.add(SpeciesYautja.class);
blacklist.add(SpeciesEngineer.class);

return blacklist;
}

public static Predicate<EntityLivingBase> avoidSelector = new Predicate<EntityLivingBase>() {
@Override
public boolean apply(EntityLivingBase potentialTarget)
{
ArrayList<Class<?>> blacklist = getDefaultEntityRunFromlist();

for (Class<?> c : blacklist)
{
if (c.isInstance(potentialTarget))
{
return true;
}
}

if (potentialTarget.height > 1.5F)
{
return true;
}

Organism organism = (Organism) potentialTarget.getCapability(Provider.CAPABILITY, null);

if (potentialTarget instanceof IHost)
{
IHost host = (IHost) potentialTarget;

if (!host.canHostParasite() || !host.canParasiteAttach())
{
return true;
}
}

if (organism != null && organism.hasEmbryo())
{
return true;
}

if (!(potentialTarget instanceof EntityLivingBase))
{
return true;
}

return false;
}
};
}
@@ -6,10 +6,8 @@
import org.avp.api.parasitoidic.IRoyalOrganism;
import org.avp.client.Sounds;
import org.avp.entities.ai.EntityAICustomAttackOnCollide;
import org.avp.entities.living.EntityMarine;
import org.avp.entities.living.species.EntityParasitoid;
import org.avp.entities.living.species.SpeciesAlien;
import org.avp.entities.living.species.engineer.EntityEngineer;
import org.avp.entities.living.species.yautja.EntityYautjaWarrior;
import org.avp.world.capabilities.IOrganism.Organism;
import org.avp.world.capabilities.IOrganism.Provider;

@@ -20,9 +18,11 @@
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.SharedMonsterAttributes;
import net.minecraft.entity.ai.EntityAIAttackMelee;
import net.minecraft.entity.ai.EntityAIAvoidEntity;
import net.minecraft.entity.ai.EntityAIHurtByTarget;
import net.minecraft.entity.ai.EntityAILeapAtTarget;
import net.minecraft.entity.ai.EntityAINearestAttackableTarget;
import net.minecraft.entity.ai.EntityAISwimming;
import net.minecraft.entity.ai.EntityAIWander;
import net.minecraft.entity.monster.IMob;
@@ -46,13 +46,12 @@ public EntityChestburster(World world)
this.setSize(1.0F, 0.4F);
this.experienceValue = 16;
this.tasks.addTask(0, new EntityAISwimming(this));
this.tasks.addTask(1, new EntityAIAvoidEntity<>(this, EntityPlayer.class, 16.0F, 0.23F, 0.4F));
this.tasks.addTask(1, new EntityAIAvoidEntity<>(this, EntityYautjaWarrior.class, 16.0F, 0.23F, 0.4F));
this.tasks.addTask(1, new EntityAIAvoidEntity<>(this, EntityEngineer.class, 16.0F, 0.23F, 0.4F));
this.tasks.addTask(1, new EntityAIAvoidEntity<>(this, EntityMarine.class, 16.0F, 0.23F, 0.4F));
this.tasks.addTask(1, new EntityAIAvoidEntity<EntityLivingBase>(this, EntityLivingBase.class, INascentic.avoidSelector, 8.0F, 0.4F, 0.7F));
this.tasks.addTask(3, new EntityAICustomAttackOnCollide(this, 0.800000011920929D, true));
this.tasks.addTask(8, new EntityAIWander(this, 0.800000011920929D));
this.tasks.addTask(4, new EntityAIWander(this, 0.800000011920929D));
this.targetTasks.addTask(0, new EntityAIHurtByTarget(this, true));
this.targetTasks.addTask(0, new EntityAINearestAttackableTarget<EntityLivingBase>(this, EntityLivingBase.class, 0, false, false, EntityParasitoid.impregnationSelector));
this.targetTasks.addTask(1, new EntityAIAttackMelee(this, 0.8F, false));
this.targetTasks.addTask(2, new EntityAILeapAtTarget(this, 0.8F));
}

0 comments on commit 60e424f

Please sign in to comment.
You can’t perform that action at this time.