@SubscribeEvent public static void onLivingDropsEvent(LivingDropsEvent event) { if (ConfigHandler.dropMoney && !(event.getEntityLiving() instanceof EntityPlayer) && event.getEntityLiving() instanceof IMob && event.getEntityLiving().getEntityWorld().isRemote == false) { if (event.getSource().getTrueSource() != null && event.getSource().getTrueSource() instanceof EntityPlayer && !(event.getSource().getTrueSource() instanceof FakePlayer)) { CurrencyUtils.dropMoneyAmount(event.getEntityLiving().getMaxHealth() / ConfigHandler.mobDivisionValue, event.getEntityLiving().getEntityWorld(), event.getEntityLiving().posX, event.getEntityLiving().posY, event.getEntityLiving().posZ); return; } if (event.getSource().getTrueSource() != null && event.getSource().getTrueSource() != null && event.getSource().getTrueSource() instanceof EntityArrow) { EntityArrow arrow = (EntityArrow) event.getSource().getTrueSource(); if (arrow.shootingEntity instanceof EntityPlayer && !(arrow.shootingEntity instanceof FakePlayer)) { CurrencyUtils.dropMoneyAmount(event.getEntityLiving().getMaxHealth() / ConfigHandler.mobDivisionValue, event.getEntityLiving().getEntityWorld(), event.getEntityLiving().posX, event.getEntityLiving().posY, event.getEntityLiving().posZ); return; } } } }
private boolean entityMatchesTargetTypes(EntityLivingBase entityLivingBase) { boolean matches = false; if (entityLivingBase instanceof EntityPlayer) { matches = players.getValue(); } else if (entityLivingBase instanceof IMob) { matches = mobs.getValue(); } else if (entityLivingBase instanceof IAnimals) { matches = animals.getValue(); } if (mobs.getValue()) { if (entityLivingBase instanceof EntityWolf) { EntityWolf wolf = (EntityWolf) entityLivingBase; matches = wolf.isAngry(); } } return matches; }
@Override public void applyTasks() { //this.targetTasks.addTask(1, new EntityAISentryOwnerHurt(this, true)); this.targetTasks.addTask(2, new EntityAINearestChecked(this, EntityLivingBase.class, true, false, new Predicate<EntityLivingBase>() { @Override public boolean apply(EntityLivingBase target) { return (((((getAttackFlags() & 2) == 2 && getOwnerId() != null) && target instanceof EntityPlayer) || target.getTeam() != null || ((getAttackFlags() & 1) == 1 && (getRevengeTarget()==target || (getOwner() != null && getOwner().getRevengeTarget()==target))) || ((getAttackFlags() & 4) == 4 && target instanceof IMob && getOwnerId() != null) || ((getAttackFlags() & 4) == 4 && target instanceof EntityLiving && ((EntityLiving) target).getAttackTarget() == getOwner())) || ((getAttackFlags() & 8) == 8 && !(target instanceof EntityPlayer) && !(target instanceof IMob) && getOwnerId() != null)) && (!TF2Util.isOnSameTeam(EntitySentry.this, target)) && (!(target instanceof EntityTF2Character && TF2ConfigVars.naturalCheck.equals("Never")) || !((EntityTF2Character) target).natural); } }, false)); this.tasks.addTask(1, new EntityAISentryAttack(this)); this.tasks.addTask(2, new EntityAISentryIdle(this)); }
@SubscribeEvent public void onSpawn(EntityJoinWorldEvent event) { if (TF2ConfigVars.targetSentries && event.getEntity() instanceof IMob && event.getEntity() instanceof EntityCreature) { ((EntityCreature)event.getEntity()).targetTasks.addTask(100, new EntityAINearestAttackableTarget<EntitySentry>((EntityCreature) event.getEntity(), EntitySentry.class, 10, true, false, sentry -> { return sentry.getOwnerId() != null; }) { protected double getTargetDistance() { return super.getTargetDistance() * 0.45f; } }); } if (event.getEntity() instanceof EntityPlayer){ if (event.getEntity().world.isRemote) { if (event.getEntity() == ClientProxy.getLocalPlayer()) TF2weapons.network.sendToServer(new TF2Message.InitClientMessage(TF2weapons.conf)); TF2weapons.network.sendToServer(new TF2Message.ActionMessage(99, (EntityLivingBase) event.getEntity())); } if (event.getEntity().world != null && !event.getEntity().world.isRemote && event.getEntity() instanceof EntityPlayerMP){ EntityPlayerMP player=((EntityPlayerMP)event.getEntity()); player.inventoryContainer.addListener(new TF2ContainerListener(player)); } } }
@SuppressWarnings("unchecked") /* Register targeting tasks here */ public void addTargetTasks() { switch (dataManager.get(ATTACK_MODE)) { case 2: this.targetTasks.addTask(2, new EntityAIMasterHurtTarget(this)); case 1: this.targetTasks.addTask(1, new EntityAIMasterHurtByTarget(this)); this.targetTasks.addTask(1, new EntityAIHurtByNonAllied(this, true)); this.targetTasks.addTask(2, new EntityAINearestNonTeamTarget(this, EntityPlayer.class, true)); this.targetTasks.addTask(2, new EntityAINearestNonTeamTarget(this, EntityArmyMember.class, true)); this.targetTasks.addTask(3, new EntityAINearestNonTeamTarget(this, IMob.class, true)); break; case 0: default: this.setAttackTarget(null); this.setRevengeTarget(null); break; } }
public static List<EntityLivingBase> attackEntitiesInArea(World world, List<EntityLivingBase> targets, DamageSource damageSource, float damage, boolean attackMobs){ List<EntityLivingBase> attacked = Lists.newArrayList(); for(Object obj : targets){ if(obj instanceof EntityLivingBase){ EntityLivingBase atEntity = (EntityLivingBase) obj; boolean isMob = attackMobs; if(atEntity instanceof IMob){ if(!isMob)continue; } else if(isMob) { continue; } if(damageSource == null || atEntity.attackEntityFrom(damageSource, damage)){ attacked.add(atEntity); } } } return attacked; }
public EntityJenGolem(World p_i1694_1_) { super(p_i1694_1_); this.setSize(1.4F, 2.9F); this.getNavigator().setAvoidsWater(true); this.tasks.addTask(1, new EntityAIAttackOnCollide(this, 1.0D, true)); this.tasks.addTask(2, new EntityAIMoveTowardsTarget(this, 0.9D, 32.0F)); this.tasks.addTask(3, new EntityAIMoveThroughVillage(this, 0.6D, true)); this.tasks.addTask(4, new EntityAIMoveTowardsRestriction(this, 1.0D)); //this.tasks.addTask(5, new EntityAILookAtVillager(this)); this.tasks.addTask(6, new EntityAIWander(this, 0.6D)); this.tasks.addTask(7, new EntityAIWatchClosest(this, EntityPlayer.class, 6.0F)); this.tasks.addTask(8, new EntityAILookIdle(this)); //this.targetTasks.addTask(1, new EntityAIDefendVillage(this)); this.targetTasks.addTask(2, new EntityAIHurtByTarget(this, false)); this.targetTasks.addTask(3, new EntityAINearestAttackableTarget(this, EntityLiving.class, 0, false, true, IMob.mobSelector)); }
public EntityCandyMan(World var1) { super(var1); world = var1; experienceValue = 5; this.isImmuneToFire = true; this.tasks.addTask(1, new EntityAIAttackOnCollide(this, 1.0D, true)); this.tasks.addTask(2, new EntityAIMoveTowardsTarget(this, 0.9D, 32.0F)); this.tasks.addTask(3, new EntityAIMoveThroughVillage(this, 0.6D, true)); this.tasks.addTask(4, new EntityAIMoveTowardsRestriction(this, 1.0D)); this.tasks.addTask(6, new EntityAIWander(this, 0.6D)); this.tasks.addTask(7, new EntityAIWatchClosest(this, EntityPlayer.class, 6.0F)); this.tasks.addTask(8, new EntityAILookIdle(this)); this.targetTasks.addTask(2, new EntityAIHurtByTarget(this, false)); this.targetTasks.addTask(3, new EntityAINearestAttackableTarget(this, EntityLiving.class, 0, false, true, IMob.mobSelector)); this.hasCustomNameTag(); this.setCustomNameTag("�2The Candy Man"); addRandomArmor(); DungeonHooks.addDungeonMob("�2The Candy Man", 180); }
public EntityPat(World var1) { super(var1); world = var1; experienceValue = 5; this.isImmuneToFire = true; this.tasks.addTask(1, new EntityAIAttackOnCollide(this, 1.0D, true)); this.tasks.addTask(2, new EntityAIMoveTowardsTarget(this, 0.9D, 32.0F)); this.tasks.addTask(3, new EntityAIMoveThroughVillage(this, 0.6D, true)); this.tasks.addTask(4, new EntityAIMoveTowardsRestriction(this, 1.0D)); this.tasks.addTask(6, new EntityAIWander(this, 0.6D)); this.tasks.addTask(7, new EntityAIWatchClosest(this, EntityPlayer.class, 6.0F)); this.tasks.addTask(8, new EntityAILookIdle(this)); this.targetTasks.addTask(2, new EntityAIHurtByTarget(this, false)); this.targetTasks.addTask(3, new EntityAINearestAttackableTarget(this, EntityLiving.class, 0, false, true, IMob.mobSelector)); this.hasCustomNameTag(); this.setCustomNameTag("FuriousDestroyer"); addRandomArmor(); DungeonHooks.addDungeonMob("FuriousDestroyer", 180); }
public EntityCaptianCookie(World var1) { super(var1); world = var1; experienceValue = 5; this.isImmuneToFire = true; this.tasks.addTask(1, new EntityAIAttackOnCollide(this, 1.0D, true)); this.tasks.addTask(2, new EntityAIMoveTowardsTarget(this, 0.9D, 32.0F)); this.tasks.addTask(3, new EntityAIMoveThroughVillage(this, 0.6D, true)); this.tasks.addTask(4, new EntityAIMoveTowardsRestriction(this, 1.0D)); this.tasks.addTask(6, new EntityAIWander(this, 0.6D)); this.tasks.addTask(7, new EntityAIWatchClosest(this, EntityPlayer.class, 6.0F)); this.tasks.addTask(8, new EntityAILookIdle(this)); this.targetTasks.addTask(2, new EntityAIHurtByTarget(this, false)); this.targetTasks.addTask(3, new EntityAINearestAttackableTarget(this, EntityLiving.class, 0, false, true, IMob.mobSelector)); this.hasCustomNameTag(); this.setCustomNameTag("Captian Cookie"); addRandomArmor(); DungeonHooks.addDungeonMob("Captian Cookie", 180); }
public EntityJen(World var1) { super(var1); world = var1; experienceValue = 5; this.isImmuneToFire = true; this.tasks.addTask(1, new EntityAIAttackOnCollide(this, 1.0D, true)); this.tasks.addTask(2, new EntityAIMoveTowardsTarget(this, 0.9D, 32.0F)); this.tasks.addTask(3, new EntityAIMoveThroughVillage(this, 0.6D, true)); this.tasks.addTask(4, new EntityAIMoveTowardsRestriction(this, 1.0D)); this.tasks.addTask(6, new EntityAIWander(this, 0.6D)); this.tasks.addTask(7, new EntityAIWatchClosest(this, EntityPlayer.class, 6.0F)); this.tasks.addTask(8, new EntityAILookIdle(this)); this.targetTasks.addTask(2, new EntityAIHurtByTarget(this, false)); this.targetTasks.addTask(3, new EntityAINearestAttackableTarget(this, EntityLiving.class, 0, false, true, IMob.mobSelector)); this.hasCustomNameTag(); this.setCustomNameTag("SuperGirlyGamer"); addRandomArmor(); DungeonHooks.addDungeonMob("SuperGirlyGamer", 180); }
public EntityPatGolem(World p_i1694_1_) { super(p_i1694_1_); this.setSize(1.4F, 2.9F); this.getNavigator().setAvoidsWater(true); this.tasks.addTask(1, new EntityAIAttackOnCollide(this, 1.0D, true)); this.tasks.addTask(2, new EntityAIMoveTowardsTarget(this, 0.9D, 32.0F)); this.tasks.addTask(3, new EntityAIMoveThroughVillage(this, 0.6D, true)); this.tasks.addTask(4, new EntityAIMoveTowardsRestriction(this, 1.0D)); //this.tasks.addTask(5, new EntityAILookAtVillager(this)); this.tasks.addTask(6, new EntityAIWander(this, 0.6D)); this.tasks.addTask(7, new EntityAIWatchClosest(this, EntityPlayer.class, 6.0F)); this.tasks.addTask(8, new EntityAILookIdle(this)); //this.targetTasks.addTask(1, new EntityAIDefendVillage(this)); this.targetTasks.addTask(2, new EntityAIHurtByTarget(this, false)); this.targetTasks.addTask(3, new EntityAINearestAttackableTarget(this, EntityLiving.class, 0, false, true, IMob.mobSelector)); }
public EntityBellie(World var1) { super(var1); world = var1; experienceValue = 5; this.isImmuneToFire = true; this.tasks.addTask(1, new EntityAIAttackOnCollide(this, 1.0D, true)); this.tasks.addTask(2, new EntityAIMoveTowardsTarget(this, 0.9D, 32.0F)); this.tasks.addTask(3, new EntityAIMoveThroughVillage(this, 0.6D, true)); this.tasks.addTask(4, new EntityAIMoveTowardsRestriction(this, 1.0D)); this.tasks.addTask(6, new EntityAIWander(this, 0.6D)); this.tasks.addTask(7, new EntityAIWatchClosest(this, EntityPlayer.class, 6.0F)); this.tasks.addTask(8, new EntityAILookIdle(this)); this.targetTasks.addTask(2, new EntityAIHurtByTarget(this, false)); this.targetTasks.addTask(3, new EntityAINearestAttackableTarget(this, EntityLiving.class, 0, false, true, IMob.mobSelector)); this.hasCustomNameTag(); //this.setCustomNameTag("Captian Cookie"); addRandomArmor(); //DungeonHooks.addDungeonMob("Captian Cookie", 180); }
public EntitySpookyPat(World var1) { super(var1); world = var1; experienceValue = 5; this.isImmuneToFire = true; this.tasks.addTask(1, new EntityAIAttackOnCollide(this, 1.0D, true)); this.tasks.addTask(2, new EntityAIMoveTowardsTarget(this, 0.9D, 32.0F)); this.tasks.addTask(3, new EntityAIMoveThroughVillage(this, 0.6D, true)); this.tasks.addTask(4, new EntityAIMoveTowardsRestriction(this, 1.0D)); this.tasks.addTask(6, new EntityAIWander(this, 0.6D)); this.tasks.addTask(7, new EntityAIWatchClosest(this, EntityPlayer.class, 6.0F)); this.tasks.addTask(8, new EntityAILookIdle(this)); this.targetTasks.addTask(2, new EntityAIHurtByTarget(this, false)); this.targetTasks.addTask(3, new EntityAINearestAttackableTarget(this, EntityLiving.class, 0, false, true, IMob.mobSelector)); this.hasCustomNameTag(); this.setCustomNameTag("FuriousDestroyer"); addRandomArmor(); DungeonHooks.addDungeonMob("FuriousDestroyer", 180); }
public EntitySpookyJen(World var1) { super(var1); world = var1; experienceValue = 5; this.isImmuneToFire = true; this.tasks.addTask(1, new EntityAIAttackOnCollide(this, 1.0D, true)); this.tasks.addTask(2, new EntityAIMoveTowardsTarget(this, 0.9D, 32.0F)); this.tasks.addTask(3, new EntityAIMoveThroughVillage(this, 0.6D, true)); this.tasks.addTask(4, new EntityAIMoveTowardsRestriction(this, 1.0D)); this.tasks.addTask(6, new EntityAIWander(this, 0.6D)); this.tasks.addTask(7, new EntityAIWatchClosest(this, EntityPlayer.class, 6.0F)); this.tasks.addTask(8, new EntityAILookIdle(this)); this.targetTasks.addTask(2, new EntityAIHurtByTarget(this, false)); this.targetTasks.addTask(3, new EntityAINearestAttackableTarget(this, EntityLiving.class, 0, false, true, IMob.mobSelector)); this.hasCustomNameTag(); this.setCustomNameTag("SuperGirlyGamer"); addRandomArmor(); DungeonHooks.addDungeonMob("SuperGirlyGamer", 180); }
public EntityGingerBreadMan(World var1) { super(var1); world = var1; experienceValue = 5; this.isImmuneToFire = true; this.tasks.addTask(1, new EntityAIAttackOnCollide(this, 1.0D, true)); this.tasks.addTask(2, new EntityAIMoveTowardsTarget(this, 0.9D, 32.0F)); this.tasks.addTask(3, new EntityAIMoveThroughVillage(this, 0.6D, true)); this.tasks.addTask(4, new EntityAIMoveTowardsRestriction(this, 1.0D)); this.tasks.addTask(6, new EntityAIWander(this, 0.6D)); this.tasks.addTask(7, new EntityAIWatchClosest(this, EntityPlayer.class, 6.0F)); this.tasks.addTask(8, new EntityAILookIdle(this)); this.targetTasks.addTask(2, new EntityAIHurtByTarget(this, false)); this.targetTasks.addTask(3, new EntityAINearestAttackableTarget(this, EntityLiving.class, 0, false, true, IMob.mobSelector)); this.hasCustomNameTag(); this.setCustomNameTag("GingerBreadMan"); addRandomArmor(); DungeonHooks.addDungeonMob("GingerBreadMan", 180); }
/** * This method gets called when the entity kills another one. */ public void onKillEntity(EntityLivingBase par1EntityLivingBase) { if (par1EntityLivingBase instanceof IMob) { this.triggerAchievement(AchievementList.killEnemy); } int var2 = EntityList.getEntityID(par1EntityLivingBase); EntityList.EntityEggInfo var3 = (EntityList.EntityEggInfo)EntityList.entityEggs.get(Integer.valueOf(var2)); if (var3 != null) { this.addStat(var3.field_151512_d, 1); } }
@Override protected boolean matches(EntityLivingBase entity) { if (type == BOSS) return !entity.isNonBoss(); else if (!entity.isNonBoss()) return false; switch (type) { case ANIMAL: return entity instanceof EntityAnimal; case MONSTER: return entity instanceof IMob; case TAMEABLE: return entity instanceof IEntityOwnable; case PLAYER: return entity instanceof EntityPlayer; case WATER: return entity instanceof EntityWaterMob || entity instanceof EntityGuardian; case NPC: return entity instanceof INpc; case GOLEM: return entity instanceof EntityGolem; default: return false; } }
private List<EntityLivingBase> getAttackableEntities(double rad) { double x = owningPlayer.posX; double y = owningPlayer.posY; double z = owningPlayer.posZ; List<EntityLivingBase> entities = owningPlayer.worldObj.getEntitiesWithinAABB(EntityLivingBase.class, AxisAlignedBB.getBoundingBox(x - 0.5, y - 0.5, z - 0.5, x + 0.5, y + 0.5, z + 0.5).expand(rad, rad, rad)); Iterator<EntityLivingBase> it = entities.iterator(); while (it.hasNext()) { EntityLivingBase base = it.next(); if (base == null || base.isDead || base instanceof EntityPlayer || !(base instanceof IMob)) it.remove(); //TODO remove entities we don't want to attack... } return entities; }
private void setTitan() { if(worldObj.isRemote) { return; } experienceValue = 250; this.stepHeight = 1.0F; this.jumpMovementFactor = 0.02F * 1.5F; this.setSize(1.5F, 4.5F); isTitan = true; this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setAttribute(0.5F); this.getEntityAttribute(SharedMonsterAttributes.attackDamage).setAttribute(7.0D); this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setAttribute(120D); this.setHealth(getMaxHealth()); this.targetTasks.addTask(2, new EntityAINearestAttackableTarget(this, IMob.class, 0, false)); }
@Override public boolean isEntityApplicable(Entity var1) { // This class lets the minion know if they should attack the mob they // are looking at or not. // Never attack the owner, even if he attacks them. if (var1 != owner) { if (var1 instanceof EntityTameable) { if (((EntityTameable) var1).getOwner() != owner) { return true; } else { return false; } } if (var1 instanceof IMob) { return true; } } return false; }
private BeastMasterPet(World par1World) { super(par1World); this.moveSpeed = 0.35F; this.tasks.addTask(1, new EntityAISwimming(this)); this.tasks.addTask(2, this.aiSit); this.tasks.addTask(3, new EntityAILeapAtTarget(this, 0.4F)); this.tasks.addTask(4, new EntityAIAttackOnCollide(this, 1.0D, true)); this.tasks.addTask(5, new EntityAIFollowOwner(this, 1.0D, 5.0F, 2.0F)); this.tasks.addTask(6, new EntityAIMate(this, 1.0D)); this.tasks.addTask(7, new EntityAIWander(this, 1.0D)); this.tasks.addTask(8, new EntityAITempt(this, 0.5D, RpgMastersAddon.whistle,false)); this.tasks.addTask(9, new EntityAIWatchClosest(this,EntityLivingBase.class, 8.0F)); this.tasks.addTask(9, new EntityAILookIdle(this)); this.targetTasks.addTask(1, new EntityAIOwnerHurtByTarget(this)); this.targetTasks.addTask(2, new EntityAIOwnerHurtTarget(this)); this.targetTasks.addTask(3, new EntityAIHurtByTarget(this, true)); this.tasks.addTask(1, this.aiControlledByPlayer = new EntityAIControlledByPlayer(this, 0.1F)); this.targetTasks.addTask(2, new EntityAINearestAttackableTarget(this,IMob.class, 0, true)); }
@Override public void onDeath(DamageSource par1DamageSource) { if (this.villageObj != null) { final Entity entity = par1DamageSource.getEntity(); if (entity != null) { if (entity instanceof EntityPlayer) { this.villageObj.setReputationForPlayer(((EntityPlayer) entity).getCommandSenderName(), -2); } else if (entity instanceof IMob) { this.villageObj.endMatingSeason(); } } else if (entity == null) { final EntityPlayer entityplayer = this.worldObj.getClosestPlayerToEntity(this, 16.0D); if (entityplayer != null) { this.villageObj.endMatingSeason(); } } } super.onDeath(par1DamageSource); }
private static EnumCreatureType getCreatureType(EntityLiving entity) { Class<? extends EntityLiving> entityClass = entity.getClass(); if (IMob.class.isAssignableFrom(entityClass)) { return EnumCreatureType.MONSTER; } else if (EntityAnimal.class.isAssignableFrom(entityClass)) { return EnumCreatureType.CREATURE; } else if (EntityAmbientCreature.class.isAssignableFrom(entityClass)) { return EnumCreatureType.AMBIENT; } else if (EntityWaterMob.class.isAssignableFrom(entityClass)) { return EnumCreatureType.WATER_CREATURE; } else { return null; } }
public EntityGoldGolem(World par1World) { super(par1World); this.setSize(1.4F, 2.9F); this.getNavigator().setAvoidsWater(true); this.tasks.addTask(1, new EntityAIAttackOnCollide(this, 1.0D, true)); this.tasks.addTask(2, new EntityAIMoveTowardsTarget(this, 0.9D, 32.0F)); this.tasks.addTask(3, new EntityAIMoveThroughVillage(this, 0.6D, true)); this.tasks.addTask(4, new EntityAIMoveTowardsRestriction(this, 1.0D)); this.tasks.addTask(5, new EntityAIGoldGolemLookAtVillager(this)); this.tasks.addTask(6, new EntityAIWander(this, 0.6D)); this.tasks.addTask(7, new EntityAIWatchClosest(this, EntityPlayer.class, 6.0F)); this.tasks.addTask(8, new EntityAILookIdle(this)); this.targetTasks.addTask(2, new EntityAIHurtByTarget(this, false)); this.targetTasks.addTask(3, new EntityAINearestAttackableTarget(this, EntityLiving.class, 0, false, true, IMob.mobSelector)); }
public EntityDiamondGolem(World par1World) { super(par1World); this.setSize(1.4F, 2.9F); this.getNavigator().setAvoidsWater(true); this.tasks.addTask(1, new EntityAIAttackOnCollide(this, 1.0D, true)); this.tasks.addTask(2, new EntityAIMoveTowardsTarget(this, 0.9D, 32.0F)); this.tasks.addTask(3, new EntityAIMoveThroughVillage(this, 0.6D, true)); this.tasks.addTask(4, new EntityAIMoveTowardsRestriction(this, 1.0D)); this.tasks.addTask(5, new EntityAIDiamondGolemLookAtVillager(this)); this.tasks.addTask(6, new EntityAIWander(this, 0.6D)); this.tasks.addTask(7, new EntityAIWatchClosest(this, EntityPlayer.class, 6.0F)); this.tasks.addTask(8, new EntityAILookIdle(this)); this.targetTasks.addTask(2, new EntityAIHurtByTarget(this, false)); this.targetTasks.addTask(3, new EntityAINearestAttackableTarget(this, EntityLiving.class, 0, false, true, IMob.mobSelector)); }
@Override public void performEffect(World world, BlockPos pos, Modifiers modifiers) { int radius = DEFAULT_RADIUS + (int) (RANGE_BOOST * modifiers.range); AxisAlignedBB aabb = new AxisAlignedBB(pos.getX() - radius, pos.getY() - radius, pos.getZ() - radius, pos.getX() + radius, pos.getY() + radius, pos.getZ() + radius); List<Entity> teList = world.getEntitiesWithinAABB(Entity.class, aabb); for (Entity entity : teList) { if (entity instanceof IMob) { if (entity.getPosition().getDistance(pos.getX(), pos.getY(), pos.getZ()) <= radius) { if (!entity.isImmuneToFire()) { entity.setFire(FIRE_DURATION); entity.attackEntityFrom(DamageSource.ON_FIRE, LlamaLogic.DAMAGE_MODIFIER * modifiers.damage); } } } } }
@Override public void performEffect(World world, BlockPos pos, Modifiers modifiers) { int radius = DEFAULT_RADIUS + (int) (RANGE_BOOST * modifiers.range); AxisAlignedBB aabb = new AxisAlignedBB(pos.getX() - radius, pos.getY() - radius, pos.getZ() - radius, pos.getX() + radius, pos.getY() + radius, pos.getZ() + radius); List<EntityLivingBase> teList = world.getEntitiesWithinAABB(EntityLivingBase.class, aabb); for (EntityLivingBase entity : teList) { if (entity instanceof IMob) { if (entity.getPosition().getDistance(pos.getX(), pos.getY(), pos.getZ()) <= radius) { PotionEffect potionEffect = new PotionEffect(MobEffects.POISON, POISON_DURATION, POTION_AMPLIFIER); if (entity.isPotionApplicable(potionEffect)) { entity.attackEntityFrom(DamageSource.MAGIC, LlamaLogic.DAMAGE_MODIFIER * modifiers.damage); entity.addPotionEffect(potionEffect); } } } } }
public EntityRobot(World par1World) { super(par1World); this.setSize(1.4F, 2.9F); this.getNavigator().setAvoidsWater(true); this.tasks.addTask(1, new EntityAIAttackOnCollide(this, 1.0D, true)); this.tasks.addTask(2, new EntityAIMoveTowardsTarget(this, 0.9D, 32.0F)); this.tasks.addTask(3, new EntityAIMoveThroughVillage(this, 0.6D, true)); this.tasks.addTask(4, new EntityAIMoveTowardsRestriction(this, 1.0D)); this.tasks.addTask(5, new EntityAILookAtVillager(this)); this.tasks.addTask(6, new EntityAIWander(this, 0.6D)); this.tasks.addTask(7, new EntityAIWatchClosest(this, EntityPlayer.class, 6.0F)); this.tasks.addTask(8, new EntityAILookIdle(this)); this.targetTasks.addTask(1, new EntityAIDefendVillage(this)); this.targetTasks.addTask(2, new EntityAIHurtByTarget(this, false)); this.targetTasks.addTask(3, new EntityAINearestAttackableTarget(this, EntityLiving.class, 0, false, true, IMob.mobSelector)); }
public EntityBear(World par1World) { super(par1World); getNavigator().setAvoidsWater(true); tasks.addTask(0, new EntityAISwimming(this)); tasks.addTask(1, new EntityAIPanic(this, 1.25f)); /* Attack On Collide Declared in SubClass */ tasks.addTask(5, new EntityAIMate(this, 1.0f)); tasks.addTask(6, new EntityAITempt(this, 1.2f, Items.spider_eye, false)); tasks.addTask(7, new EntityAIFollowParent(this, 1.1f)); tasks.addTask(9, new EntityAIWander(this, 1.0f, 120)); targetTasks.addTask(3, new EntityAIHurtByTarget(this, false, false)); targetTasks.addTask(4, new EntityAINearestAttackableTarget(this, EnumSet.of(EntityStates.attacking, EntityStates.looking), EntityPlayer.class, 16.0F, 0, true)); targetTasks.addTask(4, new EntityAINearestAttackableTarget(this, EnumSet.of(EntityStates.attacking, EntityStates.looking), EntityLiving.class, 16.0F, 0, false, true, IMob.mobSelector)); }
public EntityTreeEnt(World par1World) { super(par1World); setSize(1.7f, 3.0f); getNavigator().setAvoidsWater(true); tasks.addTask(0, new EntityAISwimming(this)); tasks.addTask(1, new EntityAIPanic(this, 1.25f)); tasks.addTask(3, new EntityAIAttackOnCollide(this, 1.0f, false)); // tasks.addTask(4, new EntityAIFollowOwner(this, moveSpeed, 10.0F, 2.0F)); // tasks.addTask(5, new EntityAIMate(this, moveSpeed)); // tasks.addTask(6, new EntityAITempt(this, moveSpeed, Blocks.tallgrass, false)); // tasks.addTask(7, new EntityAIFollowParent(this, moveSpeed)); tasks.addTask(9, new EntityAIWander(this, 1.0f, 120)); targetTasks.addTask(3, new EntityAIHurtByTarget(this, false, false)); targetTasks.addTask(4, new EntityAINearestAttackableTarget(this, EnumSet.of(EntityStates.attacking, EntityStates.looking), EntityPlayer.class, 16.0F, 0, true)); targetTasks.addTask(4, new EntityAINearestAttackableTarget(this, EnumSet.of(EntityStates.attacking, EntityStates.looking), EntityLiving.class, 16.0F, 0, false, true, IMob.mobSelector)); }
/** * Adds a monster spawn to all of the biomes. * @param spawnClazz The class of the entity that is to be spawned when the entry is registered. * @param chance The chance the entity has of spawning. * @param minGroupCount The smallest number of mobs there can be in a group of mobs spawned. * @param maxGroupCount The largest number of mobs there can be in a group of mobs spawned. */ public static final void addMonsterSpawnToAll(Class<? extends Entity> spawnClazz, int chance, int minGroupCount, int maxGroupCount) { try { BiomeGenBase.SpawnListEntry spawn = constructSpawnEntryFromArgs(spawnClazz, chance, minGroupCount, maxGroupCount); if (spawn.entityClass.newInstance() instanceof IMob) { for (int i = 0; i == biomes.length; i++) { biomes[i].spawnableMonsterList.add(spawn); } } } catch (InstantiationException | IllegalAccessException e) { e.printStackTrace(); } }
public EntityBotShoot(World p_i1738_1_) { super(p_i1738_1_); this.tasks.addTask(1, new EntityAISwimming(this)); this.tasks.addTask(2, new EntityAIArrowAttack(this, 1.0D, 30, 10.0F)); this.tasks.addTask(3, new EntityAIWander(this, 0.40D)); this.tasks.addTask(4, new EntityAIWatchClosest(this, EntityPlayer.class, 8.0F)); this.tasks.addTask(5, new EntityAIWatchClosest(this, EntityAgeable.class, 8.0F)); this.tasks.addTask(6, new EntityAIWatchClosest(this, EntityMob.class, 16.0F)); this.targetTasks.addTask(2, new EntityAINearestAttackableTarget(this, EntityVillager.class, false)); this.targetTasks.addTask(3, new AINearestAttackableTargetNonCreeper(this, EntityLiving.class, 10, false, true, IMob.field_175450_e)); this.tasks.addTask(7, new EntityAILookIdle(this)); this.tasks.addTask(8, this.aiArrowAttack); //this.tasks.addTask(7, this.aiAttackOnCollide); this.tasks.addTask(9, new EntityAIWatchClosest(this, EntityLiving.class,16.0F)); }
public EntityNpcBase(World world) { super(world); this.setSize(0.6F, 1.8F); this.enablePersistence(); ((PathNavigateGround) this.getNavigator()).setBreakDoors(true); ((PathNavigateGround) this.getNavigator()).setAvoidsWater(true); this.tasks.addTask(0, new EntityAISwimming(this)); this.tasks.addTask(1, new EntityAIAvoidEntity<Entity>(this, Entity.class, new Predicate<Entity>() { public boolean apply(Entity entity) { return entity instanceof IMob; } }, 8.0F, 0.6D, 0.6D)); this.tasks.addTask(2, new EntityAIMoveIndoors(this)); this.tasks.addTask(3, new EntityAIRestrictOpenDoor(this)); this.tasks.addTask(4, new EntityAIOpenDoor(this, true)); this.tasks.addTask(5, new EntityAIMoveTowardsRestriction(this, 0.6D)); this.tasks.addTask(6, new EntityAIWatchClosest2(this, EntityPlayer.class, 3.0F, 1.0F)); this.tasks.addTask(6, new EntityAIWander(this, 0.6D)); this.tasks.addTask(7, new EntityAIWatchClosest(this, EntityLiving.class, 8.0F)); }
public void func_70645_a(DamageSource p_70645_1_) { if(this.field_70954_d != null) { Entity var2 = p_70645_1_.func_76346_g(); if(var2 != null) { if(var2 instanceof EntityPlayer) { this.field_70954_d.func_82688_a(((EntityPlayer)var2).func_70005_c_(), -2); } else if(var2 instanceof IMob) { this.field_70954_d.func_82692_h(); } } else if(var2 == null) { EntityPlayer var3 = this.field_70170_p.func_72890_a(this, 16.0D); if(var3 != null) { this.field_70954_d.func_82692_h(); } } } super.func_70645_a(p_70645_1_); }
public EntityIronGolem(World p_i1694_1_) { super(p_i1694_1_); this.func_70105_a(1.4F, 2.9F); this.func_70661_as().func_75491_a(true); this.field_70714_bg.func_75776_a(1, new EntityAIAttackOnCollide(this, 1.0D, true)); this.field_70714_bg.func_75776_a(2, new EntityAIMoveTowardsTarget(this, 0.9D, 32.0F)); this.field_70714_bg.func_75776_a(3, new EntityAIMoveThroughVillage(this, 0.6D, true)); this.field_70714_bg.func_75776_a(4, new EntityAIMoveTowardsRestriction(this, 1.0D)); this.field_70714_bg.func_75776_a(5, new EntityAILookAtVillager(this)); this.field_70714_bg.func_75776_a(6, new EntityAIWander(this, 0.6D)); this.field_70714_bg.func_75776_a(7, new EntityAIWatchClosest(this, EntityPlayer.class, 6.0F)); this.field_70714_bg.func_75776_a(8, new EntityAILookIdle(this)); this.field_70715_bh.func_75776_a(1, new EntityAIDefendVillage(this)); this.field_70715_bh.func_75776_a(2, new EntityAIHurtByTarget(this, false)); this.field_70715_bh.func_75776_a(3, new EntityAINearestAttackableTarget(this, EntityLiving.class, 0, false, true, IMob.field_82192_a)); }
@Override public void onUpdate(ItemStack stack, World worldIn, Entity entityIn, int p_77663_4_, boolean inHand) { super.onUpdate(stack,worldIn,entityIn,p_77663_4_,inHand); if (inHand && worldIn.getTotalWorldTime() % 10 == 0) { boolean found = false; AxisAlignedBB box = AxisAlignedBB.getBoundingBox(entityIn.posX-10,entityIn.posY-5,entityIn.posZ-10,entityIn.posX+10,entityIn.posY+5,entityIn.posZ+10); List list = worldIn.getEntitiesWithinAABB(IMob.class, box); for (int i = 0;i < list.size() && !found; i++) { Entity e = (Entity)list.get(i); if (e instanceof IMob && !(e instanceof EntityEnderman)) { found = true; } } NBTTagCompound tag = stack.getTagCompound(); if (tag == null) tag = new NBTTagCompound(); tag.setBoolean("active", found); stack.setTagCompound(tag); } }
public EntityFooDog(World par1World) { super(par1World); //this.texture = "/mods/DecayingWorld/textures/mob/foodog.png"; this.setSize(0.6F, 0.8F); //this.moveSpeed = 0.28F; this.getNavigator().setAvoidsWater(true); this.tasks.addTask(1, new EntityAISwimming(this)); //this.tasks.addTask(2, new EntityAILeapAtTarget(this, 0.4F)); //this.tasks.addTask(3, new EntityAIAttackOnCollide(this, this.moveSpeed, true)); //this.tasks.addTask(4, new EntityAIWander(this, this.moveSpeed)); //this.tasks.addTask(5, new EntityAIMoveTwardsRestriction(this, 0.3F)); //this.tasks.addTask(6, new EntityAIWatchClosest(this, EntityPlayer.class, 8.0F)); //this.tasks.addTask(7, new EntityAILookIdle(this)); this.targetTasks.addTask(1, new EntityAIHurtByTarget(this, true)); this.targetTasks.addTask(2, new EntityAINearestAttackableTarget(this, EntityPlayer.class, 0, true, true, IMob.mobSelector)); setAngry(false); }
public EntityTreant(World par1World) { super(par1World); //this.moveSpeed = 0.16F; //this.texture = "/mods/DecayingWorld/textures/mob/treant.png"; this.setSize(1.4F, 2.9F); this.getNavigator().setAvoidsWater(true); this.tasks.addTask(1, new EntityAIAttackOnCollide(this, EntityPlayer.class, 0.288D, false)); this.tasks.addTask(2, new EntityAIAttackOnCollide(this, EntityZombie.class, 0.288D, true)); this.tasks.addTask(3, new EntityAIMoveTowardsRestriction(this, 0.16D)); this.tasks.addTask(4, new EntityAIWander(this, 0.16D)); this.tasks.addTask(5, new EntityAIWatchClosest(this, EntityPlayer.class, 8.0F)); this.tasks.addTask(6, new EntityAILookIdle(this)); this.targetTasks.addTask(1, new EntityAIHurtByTarget(this, true)); this.targetTasks.addTask(2, new EntityAINearestAttackableTarget(this, EntityPlayer.class, 0, true, true, IMob.mobSelector)); this.targetTasks.addTask(3, new EntityAINearestAttackableTarget(this, EntityZombie.class, 0, false, true, IMob.mobSelector)); }