Class EntityFilter

java.lang.Object
me.desht.pneumaticcraft.common.util.EntityFilter
All Implemented Interfaces:
Predicate<net.minecraft.world.entity.Entity>
Direct Known Subclasses:
EntityFilter.ConstantEntityFilter

public class EntityFilter extends Object implements Predicate<net.minecraft.world.entity.Entity>
  • Constructor Details

    • EntityFilter

      public EntityFilter(String filter)
      Create a new entity filter
      Parameters:
      filter - the filter specification
      Throws:
      IllegalArgumentException - if the spec is not valid
  • Method Details

    • fromProgWidget

      public static <T extends IProgWidget & IEntityProvider> EntityFilter fromProgWidget(T widget, boolean whitelist)
      Create a new entity filter from a progwidget, which has one or more text widgets attached
      Type Parameters:
      T - widget type
      Parameters:
      widget - the progwidget
      whitelist - true if this should be a whitelist (look to the widget's right) or blacklist (look to the left)
      Returns:
      an entity filter
      Throws:
      IllegalArgumentException - if any of the attached text widgets contain an invalid filter spec
    • fromString

      public static EntityFilter fromString(String s)
      Create an entity filter from string
      Parameters:
      s - the filter spec
      Returns:
      an entity filter, or null if the spec is not valid
    • fromString

      public static EntityFilter fromString(String s, EntityFilter fallback)
      Create an entity filter from string
      Parameters:
      s - the filter spec
      fallback - a fallback filter to use
      Returns:
      an entity filter, or the fallback filter if the spec is not valid
    • allow

      public static EntityFilter allow()
      An entity filter which allows everything
      Returns:
      an entity filter
    • deny

      public static EntityFilter deny()
      An entity filter which allows nothing
      Returns:
      an entity filter
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • test

      public boolean test(net.minecraft.world.entity.Entity entity)
      Specified by:
      test in interface Predicate<net.minecraft.world.entity.Entity>