Record Class EntityPredicate

java.lang.Object
java.lang.Record
net.minecraft.advancements.critereon.EntityPredicate

public record EntityPredicate(Optional<EntityTypePredicate> entityType, Optional<DistancePredicate> distanceToPlayer, Optional<MovementPredicate> movement, EntityPredicate.LocationWrapper location, Optional<MobEffectsPredicate> effects, Optional<NbtPredicate> nbt, Optional<EntityFlagsPredicate> flags, Optional<EntityEquipmentPredicate> equipment, Optional<EntitySubPredicate> subPredicate, Optional<Integer> periodicTick, Optional<EntityPredicate> vehicle, Optional<EntityPredicate> passenger, Optional<EntityPredicate> targetedEntity, Optional<String> team, Optional<SlotsPredicate> slots) extends Record
  • Field Details

  • Constructor Details

  • Method Details

    • wrap

      public static ContextAwarePredicate wrap(EntityPredicate.Builder p_298222_)
    • wrap

      public static Optional<ContextAwarePredicate> wrap(Optional<EntityPredicate> p_298604_)
    • wrap

      public static List<ContextAwarePredicate> wrap(EntityPredicate.Builder... p_298584_)
    • wrap

      public static ContextAwarePredicate wrap(EntityPredicate p_286570_)
    • matches

      public boolean matches(ServerPlayer p_36612_, @Nullable Entity p_36613_)
    • matches

      public boolean matches(ServerLevel p_36608_, @Nullable Vec3 p_36609_, @Nullable Entity p_36610_)
    • createContext

      public static LootContext createContext(ServerPlayer p_36617_, Entity p_36618_)
    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared with Objects::equals(Object,Object).
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • entityType

      public Optional<EntityTypePredicate> entityType()
      Returns the value of the entityType record component.
      Returns:
      the value of the entityType record component
    • distanceToPlayer

      public Optional<DistancePredicate> distanceToPlayer()
      Returns the value of the distanceToPlayer record component.
      Returns:
      the value of the distanceToPlayer record component
    • movement

      public Optional<MovementPredicate> movement()
      Returns the value of the movement record component.
      Returns:
      the value of the movement record component
    • location

      Returns the value of the location record component.
      Returns:
      the value of the location record component
    • effects

      public Optional<MobEffectsPredicate> effects()
      Returns the value of the effects record component.
      Returns:
      the value of the effects record component
    • nbt

      public Optional<NbtPredicate> nbt()
      Returns the value of the nbt record component.
      Returns:
      the value of the nbt record component
    • flags

      public Optional<EntityFlagsPredicate> flags()
      Returns the value of the flags record component.
      Returns:
      the value of the flags record component
    • equipment

      public Optional<EntityEquipmentPredicate> equipment()
      Returns the value of the equipment record component.
      Returns:
      the value of the equipment record component
    • subPredicate

      public Optional<EntitySubPredicate> subPredicate()
      Returns the value of the subPredicate record component.
      Returns:
      the value of the subPredicate record component
    • periodicTick

      public Optional<Integer> periodicTick()
      Returns the value of the periodicTick record component.
      Returns:
      the value of the periodicTick record component
    • vehicle

      public Optional<EntityPredicate> vehicle()
      Returns the value of the vehicle record component.
      Returns:
      the value of the vehicle record component
    • passenger

      public Optional<EntityPredicate> passenger()
      Returns the value of the passenger record component.
      Returns:
      the value of the passenger record component
    • targetedEntity

      public Optional<EntityPredicate> targetedEntity()
      Returns the value of the targetedEntity record component.
      Returns:
      the value of the targetedEntity record component
    • team

      public Optional<String> team()
      Returns the value of the team record component.
      Returns:
      the value of the team record component
    • slots

      public Optional<SlotsPredicate> slots()
      Returns the value of the slots record component.
      Returns:
      the value of the slots record component