Java 类com.google.common.base.Predicates 实例源码

项目:BaseClient    文件:EntityLivingBase.java   
protected void collideWithNearbyEntities()
{
    List<Entity> list = this.worldObj.getEntitiesInAABBexcluding(this, this.getEntityBoundingBox().expand(0.20000000298023224D, 0.0D, 0.20000000298023224D), Predicates.<Entity> and (EntitySelectors.NOT_SPECTATING, new Predicate<Entity>()
    {
        public boolean apply(Entity p_apply_1_)
        {
            return p_apply_1_.canBePushed();
        }
    }));

    if (!list.isEmpty())
    {
        for (int i = 0; i < list.size(); ++i)
        {
            Entity entity = (Entity)list.get(i);
            this.collideWithEntity(entity);
        }
    }
}
项目:guava-mock    文件:FluentIterableTest.java   
/**
 * This test passes if the {@code concat(…).filter(…).filter(…)} statement at the end compiles.
 * That statement compiles only if {@link FluentIterable#concat concat(aIterable, bIterable)}
 * returns a {@link FluentIterable} of elements of an anonymous type whose supertypes are the
 * <a href="https://docs.oracle.com/javase/specs/jls/se7/html/jls-4.html#jls-4.9">intersection</a>
 * of the supertypes of {@code A} and the supertypes of {@code B}.
 */
public void testConcatIntersectionType() {
  Iterable<A> aIterable = ImmutableList.of();
  Iterable<B> bIterable = ImmutableList.of();

  Predicate<X> xPredicate = Predicates.alwaysTrue();
  Predicate<Y> yPredicate = Predicates.alwaysTrue();

  FluentIterable<?> unused =
      FluentIterable.concat(aIterable, bIterable).filter(xPredicate).filter(yPredicate);

  /* The following fails to compile:
   *
   * The method append(Iterable<? extends FluentIterableTest.A>) in the type
   * FluentIterable<FluentIterableTest.A> is not applicable for the arguments
   * (Iterable<FluentIterableTest.B>)
   */
  // FluentIterable.from(aIterable).append(bIterable);

  /* The following fails to compile:
   *
   * The method filter(Predicate<? super Object>) in the type FluentIterable<Object> is not
   * applicable for the arguments (Predicate<FluentIterableTest.X>)
   */
  // FluentIterable.of().append(aIterable).append(bIterable).filter(xPredicate);
}
项目:NBANDROID-V2    文件:ProjectResourceLocator.java   
private ResourceLocation findResourceFile(SourceGroup[] resSG, final String value, final String folderName) {
    FileObject resFile = Iterables.find(
            Iterables.transform(
                    Arrays.asList(resSG),
                    new Function<SourceGroup, FileObject>() {
                @Override
                public FileObject apply(SourceGroup sg) {
                    return sg.getRootFolder().getFileObject(folderName + "/" + value + ".xml");
                }
            }),
            Predicates.notNull(),
            null);
    if (resFile == null) {
        LOG.log(Level.FINE, "Resource file {0} not found for {0}.", value);
        return null;
    }
    return new ResourceLocation(resFile, -1);
}
项目:DecompiledMinecraft    文件:EntityAINearestAttackableTarget.java   
/**
 * Returns whether the EntityAIBase should begin execution.
 */
public boolean shouldExecute()
{
    if (this.targetChance > 0 && this.taskOwner.getRNG().nextInt(this.targetChance) != 0)
    {
        return false;
    }
    else
    {
        double d0 = this.getTargetDistance();
        List<T> list = this.taskOwner.worldObj.<T>getEntitiesWithinAABB(this.targetClass, this.taskOwner.getEntityBoundingBox().expand(d0, 4.0D, d0), Predicates.<T> and (this.targetEntitySelector, EntitySelectors.NOT_SPECTATING));
        Collections.sort(list, this.theNearestAttackableTargetSorter);

        if (list.isEmpty())
        {
            return false;
        }
        else
        {
            this.targetEntity = (EntityLivingBase)list.get(0);
            return true;
        }
    }
}
项目:GitHub    文件:SourceOrdering.java   
@Override
public Ordering<Element> enclosedBy(Element element) {
  if (element instanceof ElementImpl &&
      Iterables.all(element.getEnclosedElements(), Predicates.instanceOf(ElementImpl.class))) {

    ElementImpl implementation = (ElementImpl) element;
    if (implementation._binding instanceof SourceTypeBinding) {
      SourceTypeBinding sourceBinding = (SourceTypeBinding) implementation._binding;

      return Ordering.natural().onResultOf(
          Functions.compose(bindingsToSourceOrder(sourceBinding), this));
    }
  }

  return DEFAULT_PROVIDER.enclosedBy(element);
}
项目:dremio-oss    文件:FragmentExecutors.java   
@Override
public Iterator<FragmentExecutor> iterator() {
  return Iterators.unmodifiableIterator(
    FluentIterable
      .from(handlers.asMap().values())
      .transform(new Function<FragmentHandler, FragmentExecutor>() {
        @Nullable
        @Override
        public FragmentExecutor apply(FragmentHandler input) {
          return input.getExecutor();
        }
      })
      .filter(Predicates.<FragmentExecutor>notNull())
      .iterator()
  );
}
项目:randomito-all    文件:AnnotationPostProcessorScanner.java   
public PostProcessor[] scan(final Object instance) {
    return FluentIterable
            .from(ReflectionUtils.getDeclaredFields(instance.getClass(), true))
            .filter(new Predicate<Field>() {
                @Override
                public boolean apply(Field input) {
                    return input.isAnnotationPresent(Random.PostProcessor.class)
                            && PostProcessor.class.isAssignableFrom(input.getType());
                }
            })
            .transform(new Function<Field, PostProcessor>() {
                @Override
                public PostProcessor apply(Field field) {
                    try {
                        if (!ReflectionUtils.makeFieldAccessible(field)) {
                            return null;
                        }
                        return (PostProcessor) field.get(instance);
                    } catch (IllegalAccessException e) {
                        throw new RandomitoException(e);
                    }
                }
            })
            .filter(Predicates.<PostProcessor>notNull())
            .toArray(PostProcessor.class);
}
项目:BaseClient    文件:EntityLivingBase.java   
protected void collideWithNearbyEntities()
{
    List<Entity> list = this.worldObj.getEntitiesInAABBexcluding(this, this.getEntityBoundingBox().expand(0.20000000298023224D, 0.0D, 0.20000000298023224D), Predicates.<Entity> and (EntitySelectors.NOT_SPECTATING, new Predicate<Entity>()
    {
        public boolean apply(Entity p_apply_1_)
        {
            return p_apply_1_.canBePushed();
        }
    }));

    if (!list.isEmpty())
    {
        for (int i = 0; i < list.size(); ++i)
        {
            Entity entity = (Entity)list.get(i);
            this.collideWithEntity(entity);
        }
    }
}
项目:Uranium    文件:SimpleHelpMap.java   
@SuppressWarnings("unchecked")
public SimpleHelpMap(CraftServer server) {
    this.helpTopics = new TreeMap<String, HelpTopic>(HelpTopicComparator.topicNameComparatorInstance()); // Using a TreeMap for its explicit sorting on key
    this.topicFactoryMap = new HashMap<Class, HelpTopicFactory<Command>>();
    this.server = server;
    this.yaml = new HelpYamlReader(server);

    Predicate indexFilter = Predicates.not(Predicates.instanceOf(CommandAliasHelpTopic.class));
    if (!yaml.commandTopicsInMasterIndex()) {
        indexFilter = Predicates.and(indexFilter, Predicates.not(new IsCommandTopicPredicate()));
    }

    this.defaultTopic = new IndexHelpTopic("Index", null, null, Collections2.filter(helpTopics.values(), indexFilter), "Use /help [n] to get page n of help.");

    registerHelpTopicFactory(MultipleCommandAlias.class, new MultipleCommandAliasHelpTopicFactory());
}
项目:tac-kbp-eal    文件:ValidateSystemOutput.java   
/**
 * Warns about CAS offsets for Responses being inconsistent with actual document text for non-TIME
 * roles
 */
private void warnOnMissingOffsets(final File systemOutputStoreFile, final Symbol docID,
    final ImmutableSet<Response> responses,
    final Map<Symbol, File> docIDMap) throws IOException {
  final String text = Files.asCharSource(docIDMap.get(docID), Charsets.UTF_8).read();
  for (final Response r : FluentIterable.from(responses)
      .filter(Predicates.compose(not(equalTo(TIME)), ResponseFunctions.role()))) {
    final KBPString cas = r.canonicalArgument();
    final String casTextInRaw =
        resolveCharOffsets(cas.charOffsetSpan(), docID, text).replaceAll("\\s+", " ");
    // allow whitespace
    if (!casTextInRaw.contains(cas.string())) {
      log.warn("Warning for {} - response {} CAS does not match text span of {} ",
          systemOutputStoreFile.getAbsolutePath(), renderResponse(r, text), casTextInRaw);
    }
  }
}
项目:Reer    文件:ModelRuleSourceDetector.java   
public Iterable<Class<? extends RuleSource>> getDeclaredSources(Class<?> container) {
    try {
        return FluentIterable.from(cache.get(container))
                .transform(new Function<Reference<Class<? extends RuleSource>>, Class<? extends RuleSource>>() {
                    @Override
                    public Class<? extends RuleSource> apply(Reference<Class<? extends RuleSource>> input) {
                        return input.get();
                    }
                })
                .filter(Predicates.notNull());
    } catch (ExecutionException e) {
        throw UncheckedException.throwAsUncheckedException(e);
    }
}
项目:NBANDROID-V2    文件:ManifestParser.java   
public Iterable<String> getManifestThemeNames(InputStream is) {
    return Iterables.filter(
            Iterables.transform(
                    getAttrNames(is, manifestXpathExp),
                    new Function<String, String>() {
                @Override
                public String apply(String name) {
                    return name.startsWith("@style/") ? name.substring("@style/".length()) : null;
                }
            }),
            Predicates.notNull());
}
项目:googles-monorepo-demo    文件:Maps.java   
/**
 * Support {@code clear()}, {@code removeAll()}, and {@code retainAll()} when
 * filtering a filtered navigable map.
 */
@GwtIncompatible // NavigableMap
private static <K, V> NavigableMap<K, V> filterFiltered(
    FilteredEntryNavigableMap<K, V> map, Predicate<? super Entry<K, V>> entryPredicate) {
  Predicate<Entry<K, V>> predicate =
      Predicates.<Entry<K, V>>and(map.entryPredicate, entryPredicate);
  return new FilteredEntryNavigableMap<K, V>(map.unfiltered, predicate);
}
项目:Reer    文件:S3ResourceResolver.java   
private List<String> resolveFileResourceNames(ObjectListing objectListing) {
    List<S3ObjectSummary> objectSummaries = objectListing.getObjectSummaries();
    if (null != objectSummaries) {
        return ImmutableList.copyOf(Iterables.filter(
            Iterables.transform(objectSummaries, EXTRACT_FILE_NAME),
            Predicates.notNull()
        ));
    }
    return Collections.emptyList();

}
项目:googles-monorepo-demo    文件:FluentIterableTest.java   
public void testFirstMatch() {
  FluentIterable<String> iterable = FluentIterable.from(Lists.newArrayList("cool", "pants"));
  assertThat(iterable.firstMatch(Predicates.equalTo("cool"))).hasValue("cool");
  assertThat(iterable.firstMatch(Predicates.equalTo("pants"))).hasValue("pants");
  assertThat(iterable.firstMatch(Predicates.alwaysFalse())).isAbsent();
  assertThat(iterable.firstMatch(Predicates.alwaysTrue())).hasValue("cool");
}
项目:GitHub    文件:RequestManagerGenerator.java   
@Nullable
TypeSpec generate(
    String generatedCodePackageName, @Nullable TypeSpec requestOptions, TypeSpec requestBuilder,
    Set<String> glideExtensions) {
  generatedRequestBuilderClassName = ClassName.get(generatedCodePackageName, requestBuilder.name);
  return TypeSpec.classBuilder(GENERATED_REQUEST_MANAGER_SIMPLE_NAME)
       .superclass(requestManagerClassName)
       .addJavadoc("Includes all additions from methods in {@link $T}s\n"
               + "annotated with {@link $T}\n"
               + "\n"
               + "<p>Generated code, do not modify\n",
           GlideExtension.class, GlideType.class)
      .addAnnotation(
          AnnotationSpec.builder(SuppressWarnings.class)
              .addMember("value", "$S", "deprecation")
              .build())
       .addModifiers(Modifier.PUBLIC)
       .addMethod(generateAsMethod(generatedCodePackageName, requestBuilder))
       .addMethod(generateCallSuperConstructor())
       .addMethods(generateExtensionRequestManagerMethods(glideExtensions))
       .addMethods(generateRequestManagerRequestManagerMethodOverrides(generatedCodePackageName))
       .addMethods(generateRequestManagerRequestBuilderMethodOverrides())
       .addMethods(
           FluentIterable.from(
               Collections.singletonList(
                   generateOverrideSetRequestOptions(generatedCodePackageName, requestOptions)))
               .filter(Predicates.<MethodSpec>notNull()))
       .build();
}
项目:guava-mock    文件:MapsTest.java   
public void testFilteredEntriesObjectPredicate() {
  Map<String, Integer> unfiltered = createUnfiltered();
  unfiltered.put("cat", 3);
  unfiltered.put("dog", 2);
  unfiltered.put("horse", 5);
  Predicate<Object> predicate = Predicates.alwaysFalse();
  Map<String, Integer> filtered
      = Maps.filterEntries(unfiltered, predicate);
  assertTrue(filtered.isEmpty());
}
项目:guava-mock    文件:FluentIterableTest.java   
public void testFromArrayAndIteratorRemove() {
  FluentIterable<TimeUnit> units = FluentIterable.from(TimeUnit.values());
  try {
    Iterables.removeIf(units, Predicates.equalTo(TimeUnit.SECONDS));
    fail("Expected an UnsupportedOperationException to be thrown but it wasn't.");
  } catch (UnsupportedOperationException expected) {
  }
}
项目:NBANDROID-V2    文件:GradleSourceForBinaryQuery.java   
@Override
public Result findSourceRoots2(final URL binaryRoot) {
    Result r = findAarLibraryRoots(binaryRoot);
    if (r != null) {
        return r;
    }
    if (project == null) {
        return null;
    }
    final File binRootDir = FileUtil.archiveOrDirForURL(binaryRoot);
    if (binRootDir == null) {
        return null;
    }

    Variant variant = Iterables.find(
            project.getVariants(),
            new Predicate<Variant>() {
        @Override
        public boolean apply(Variant input) {
            return binRootDir.equals(input.getMainArtifact().getClassesFolder());
        }
    },
            null);
    if (variant != null) {
        Iterable<FileObject> srcRoots = Iterables.filter(
                Iterables.transform(
                        sourceRootsForVariant(variant),
                        new Function<File, FileObject>() {
                    @Override
                    public FileObject apply(File f) {
                        return FileUtil.toFileObject(f);
                    }
                }),
                Predicates.notNull());
        return new GradleSourceResult(srcRoots);
    }
    return null;
}
项目:guava-mock    文件:IteratorsTest.java   
public void testFind_withDefault_notPresent() {
  Iterable<String> list = Lists.newArrayList("cool", "pants");
  Iterator<String> iterator = list.iterator();
  assertEquals("woot",
      Iterators.find(iterator, Predicates.alwaysFalse(), "woot"));
  assertFalse(iterator.hasNext());
}
项目:Randores2    文件:CraftiniumForgeTileEntity.java   
public CraftiniumForgeTileEntity() {
    this.input = new ItemStackHandler(1);
    this.output = new SelectiveItemStackHandler(1, Predicates.alwaysFalse());
    this.fuel = new SelectiveItemStackHandler(1, TileEntityFurnace::isItemFuel);
    this.furnaceBurnTime = 0;
    this.currentItemBurnTime = 0;
    this.cookTime = 0;
    this.totalCookTime = 0;
    this.divisor = 1;
    this.brokenByCreative = false;
}
项目:guava-mock    文件:IterablesTest.java   
public void testTryFind() {
  Iterable<String> list = newArrayList("cool", "pants");
  assertThat(Iterables.tryFind(list, Predicates.equalTo("cool"))).hasValue("cool");
  assertThat(Iterables.tryFind(list, Predicates.equalTo("pants"))).hasValue("pants");
  assertThat(Iterables.tryFind(list, Predicates.alwaysTrue())).hasValue("cool");
  assertThat(Iterables.tryFind(list, Predicates.alwaysFalse())).isAbsent();
  assertCanIterateAgain(list);
}
项目:shibboleth-idp-oidc-extension    文件:ChainingClientInformationResolver.java   
/**
 * Set the registered client information resolvers.
 * 
 * @param newResolvers the client information resolvers to use
 * 
 * @throws ResolverException thrown if there is a problem adding the client information resolvers
 */
public void setResolvers(@Nonnull @NonnullElements final List<? extends ClientInformationResolver> newResolvers)
        throws ResolverException {
    ComponentSupport.ifInitializedThrowUnmodifiabledComponentException(this);
    ComponentSupport.ifDestroyedThrowDestroyedComponentException(this);

    if (newResolvers == null || newResolvers.isEmpty()) {
        resolvers = Collections.emptyList();
        return;
    }

    resolvers = new ArrayList<>(Collections2.filter(newResolvers, Predicates.notNull()));
}
项目:shibboleth-idp-oidc-extension    文件:OIDCCoreProtocolConfiguration.java   
/**
 * Set the default authentication contexts to use, expressed as custom principals.
 * 
 * @param contexts default authentication contexts to use
 */
public void setDefaultAuthenticationMethods(
        @Nonnull @NonnullElements final List<Principal> contexts) {
    Constraint.isNotNull(contexts, "List of contexts cannot be null");

    defaultAuthenticationContexts = new ArrayList<>(Collections2.filter(contexts, Predicates.notNull()));
}
项目:swagger2-spring-boot-starter    文件:Swagger2AutoConfiguration.java   
private Predicate<RequestHandler> apis(Swagger2Properties swagger2Properties) {

        List<Predicate<RequestHandler>> basePackages = new LinkedList<>();

        if (swagger2Properties.getBasePackage().isEmpty()) {
            basePackages.add(RequestHandlerSelectors.any());
        }
        for (String basePackage : swagger2Properties.getBasePackage()) {
            basePackages.add(RequestHandlerSelectors.basePackage(basePackage));
        }

        return Predicates.or(basePackages);
    }
项目:googles-monorepo-demo    文件:IteratorsTest.java   
public void testTryFind_alwaysFalse_orDefault() {
  Iterable<String> list = Lists.newArrayList("cool", "pants");
  Iterator<String> iterator = list.iterator();
  assertEquals("woot",
      Iterators.tryFind(iterator, Predicates.alwaysFalse()).or("woot"));
  assertFalse(iterator.hasNext());
}
项目:guava-mock    文件:IteratorsTest.java   
public void testAny() {
  List<String> list = Lists.newArrayList();
  Predicate<String> predicate = Predicates.equalTo("pants");

  assertFalse(Iterators.any(list.iterator(), predicate));
  list.add("cool");
  assertFalse(Iterators.any(list.iterator(), predicate));
  list.add("pants");
  assertTrue(Iterators.any(list.iterator(), predicate));
}
项目:product-management-system    文件:SwaggerConfig.java   
@Bean
public Docket api() {
    return new Docket(DocumentationType.SWAGGER_2)
            .useDefaultResponseMessages(false)
            .select()
            .apis(RequestHandlerSelectors.any())
            .paths(Predicates.not(PathSelectors.regex("/error.*")))
            .build();
}
项目:guava-mock    文件:IteratorsTest.java   
public void testAll() {
  List<String> list = Lists.newArrayList();
  Predicate<String> predicate = Predicates.equalTo("cool");

  assertTrue(Iterators.all(list.iterator(), predicate));
  list.add("cool");
  assertTrue(Iterators.all(list.iterator(), predicate));
  list.add("pants");
  assertFalse(Iterators.all(list.iterator(), predicate));
}
项目:Spring-cloud-gather    文件:SwaggerConfiguration.java   
@Bean
public Docket createRestApi() {
    // @formatter:off
    return new Docket(DocumentationType.SWAGGER_2)
            .securitySchemes(this.oAuth())
            .apiInfo(apiInfo())
            .select()
            .paths(postPaths())
            .apis(Predicates.not(RequestHandlerSelectors.basePackage("org.springframework.boot")))  
            .paths(springBootActuatorJmxPaths())
            //.apis(RequestHandlerSelectors.basePackage("com.piggymetrics.account.controller"))
            .paths(PathSelectors.any())
            .build();
    // @formatter:on
}
项目:guava-mock    文件:IteratorsTest.java   
public void testFind_withDefault_notPresent_nullReturn() {
  Iterable<String> list = Lists.newArrayList("cool", "pants");
  Iterator<String> iterator = list.iterator();
  assertNull(
      Iterators.find(iterator, Predicates.alwaysFalse(), null));
  assertFalse(iterator.hasNext());
}
项目:googles-monorepo-demo    文件:Multimaps.java   
/**
 * Support removal operations when filtering a filtered multimap. Since a filtered multimap has
 * iterators that don't support remove, passing one to the FilteredEntryMultimap constructor would
 * lead to a multimap whose removal operations would fail. This method combines the predicates to
 * avoid that problem.
 */
private static <K, V> SetMultimap<K, V> filterFiltered(
    FilteredSetMultimap<K, V> multimap, Predicate<? super Entry<K, V>> entryPredicate) {
  Predicate<Entry<K, V>> predicate =
      Predicates.<Entry<K, V>>and(multimap.entryPredicate(), entryPredicate);
  return new FilteredEntrySetMultimap<K, V>(multimap.unfiltered(), predicate);
}
项目:url-classifier    文件:QueryClassifierBuilder.java   
/** @see #mayHaveKeys(String...) */
public QueryClassifierBuilder mayHaveKeys(Predicate<? super String> p) {
  if (mayClassifier == null) {
    mayClassifier = p;
  } else {
    mayClassifier = Predicates.<String>or(mayClassifier, p);
  }
  return this;
}
项目:googles-monorepo-demo    文件:FluentIterableTest.java   
public void testAllMatch() {
  List<String> list = Lists.newArrayList();
  FluentIterable<String> iterable = FluentIterable.<String>from(list);
  Predicate<String> predicate = Predicates.equalTo("cool");

  assertTrue(iterable.allMatch(predicate));
  list.add("cool");
  assertTrue(iterable.allMatch(predicate));
  list.add("pants");
  assertFalse(iterable.allMatch(predicate));
}
项目:CustomWorldGen    文件:EntitySelectors.java   
public static <T extends Entity> Predicate<T> getTeamCollisionPredicate(final Entity entityIn)
{
    final Team team = entityIn.getTeam();
    final Team.CollisionRule team$collisionrule = team == null ? Team.CollisionRule.ALWAYS : team.getCollisionRule();
    Predicate<?> ret = team$collisionrule == Team.CollisionRule.NEVER ? Predicates.alwaysFalse() : Predicates.and(NOT_SPECTATING, new Predicate<Entity>()
    {
        public boolean apply(@Nullable Entity p_apply_1_)
        {
            if (!p_apply_1_.canBePushed())
            {
                return false;
            }
            else if (!entityIn.worldObj.isRemote || p_apply_1_ instanceof EntityPlayer && ((EntityPlayer)p_apply_1_).isUser())
            {
                Team team1 = p_apply_1_.getTeam();
                Team.CollisionRule team$collisionrule1 = team1 == null ? Team.CollisionRule.ALWAYS : team1.getCollisionRule();

                if (team$collisionrule1 == Team.CollisionRule.NEVER)
                {
                    return false;
                }
                else
                {
                    boolean flag = team != null && team.isSameTeam(team1);
                    return (team$collisionrule == Team.CollisionRule.HIDE_FOR_OWN_TEAM || team$collisionrule1 == Team.CollisionRule.HIDE_FOR_OWN_TEAM) && flag ? false : team$collisionrule != Team.CollisionRule.HIDE_FOR_OTHER_TEAMS && team$collisionrule1 != Team.CollisionRule.HIDE_FOR_OTHER_TEAMS || flag;
                }
            }
            else
            {
                return false;
            }
        }
    });
    return (Predicate<T>)ret;
}
项目:Backmemed    文件:ConditionAnd.java   
public Predicate<IBlockState> getPredicate(final BlockStateContainer blockState)
{
    return Predicates.and(Iterables.transform(this.conditions, new Function<ICondition, Predicate<IBlockState>>()
    {
        @Nullable
        public Predicate<IBlockState> apply(@Nullable ICondition p_apply_1_)
        {
            return p_apply_1_ == null ? null : p_apply_1_.getPredicate(blockState);
        }
    }));
}
项目:c4sg-services    文件:SwaggerConfig.java   
@Bean
public Docket api() {
    return new Docket(DocumentationType.SWAGGER_2)
            .useDefaultResponseMessages(false)
            .apiInfo(apiInfo())
            .select()
            .apis(RequestHandlerSelectors.any())
            .paths(Predicates.not(PathSelectors.regex("/error.*")))
            .build();
}
项目:Mods    文件:EntityMedic.java   
public EntityMedic(World par1World) {
    super(par1World);
    this.targetTasks.taskEntries.clear();
    this.targetTasks.addTask(1, this.findplayer = new EntityAINearestChecked(this, EntityLivingBase.class, true,
            false, Predicates.and(this::isValidTarget, target -> {
                return target.getHealth()<target.getMaxHealth();
            }), false));
    this.targetTasks.addTask(2, new EntityAINearestChecked(this, EntityLivingBase.class, true,
            false, this::isValidTarget, true));
    this.targetTasks.addTask(3, new EntityAIHurtByTarget(this, true));
    this.targetTasks.addTask(4,
            new EntityAINearestChecked(this, EntityLivingBase.class, true, false, super::isValidTarget, true));
    this.unlimitedAmmo = true;
    //this.ammoLeft = 1;
    this.experienceValue = 15;
    this.rotation = 15;
    this.tasks.removeTask(attack);

    if (par1World != null) {
        this.tasks.addTask(4, useMedigun);
        //attack.setRange(7f);
        this.setCombatTask(true);
        this.friendly = true;
    }
    // this.setItemStackToSlot(EntityEquipmentSlot.MAINHAND,
    // ItemUsable.getNewStack("Minigun"));

}