Record Class EntityPredicate
java.lang.Object
java.lang.Record
net.minecraft.advancements.critereon.EntityPredicate
public record EntityPredicate(Optional<EntityTypePredicate> entityType, Optional<DistancePredicate> distanceToPlayer, Optional<LocationPredicate> location, Optional<LocationPredicate> steppingOnLocation, Optional<MobEffectsPredicate> effects, Optional<NbtPredicate> nbt, Optional<EntityFlagsPredicate> flags, Optional<EntityEquipmentPredicate> equipment, Optional<EntitySubPredicate> subPredicate, Optional<EntityPredicate> vehicle, Optional<EntityPredicate> passenger, Optional<EntityPredicate> targetedEntity, Optional<String> team)
extends Record
-
Nested Class Summary
-
Field Summary
Modifier and TypeFieldDescriptionstatic final com.mojang.serialization.Codec<EntityPredicate>
private final Optional<DistancePredicate>
The field for thedistanceToPlayer
record component.private final Optional<MobEffectsPredicate>
The field for theeffects
record component.private final Optional<EntityTypePredicate>
The field for theentityType
record component.private final Optional<EntityEquipmentPredicate>
The field for theequipment
record component.private final Optional<EntityFlagsPredicate>
The field for theflags
record component.private final Optional<LocationPredicate>
The field for thelocation
record component.private final Optional<NbtPredicate>
The field for thenbt
record component.private final Optional<EntityPredicate>
The field for thepassenger
record component.private final Optional<LocationPredicate>
The field for thesteppingOnLocation
record component.private final Optional<EntitySubPredicate>
The field for thesubPredicate
record component.private final Optional<EntityPredicate>
The field for thetargetedEntity
record component.The field for theteam
record component.private final Optional<EntityPredicate>
The field for thevehicle
record component. -
Constructor Summary
ConstructorDescriptionEntityPredicate
(Optional<EntityTypePredicate> entityType, Optional<DistancePredicate> distanceToPlayer, Optional<LocationPredicate> location, Optional<LocationPredicate> steppingOnLocation, Optional<MobEffectsPredicate> effects, Optional<NbtPredicate> nbt, Optional<EntityFlagsPredicate> flags, Optional<EntityEquipmentPredicate> equipment, Optional<EntitySubPredicate> subPredicate, Optional<EntityPredicate> vehicle, Optional<EntityPredicate> passenger, Optional<EntityPredicate> targetedEntity, Optional<String> team) Creates an instance of aEntityPredicate
record class. -
Method Summary
Modifier and TypeMethodDescriptionstatic LootContext
createContext
(ServerPlayer p_36617_, Entity p_36618_) Returns the value of thedistanceToPlayer
record component.effects()
Returns the value of theeffects
record component.Returns the value of theentityType
record component.final boolean
Indicates whether some other object is "equal to" this one.Returns the value of theequipment
record component.flags()
Returns the value of theflags
record component.private static Optional<ContextAwarePredicate>
fromElement
(String p_286569_, DeserializationContext p_286821_, com.google.gson.JsonElement p_286582_) static Optional<EntityPredicate>
fromJson
(com.google.gson.JsonElement p_297667_) static Optional<ContextAwarePredicate>
fromJson
(com.google.gson.JsonObject p_300195_, String p_297866_, DeserializationContext p_301262_) static List<ContextAwarePredicate>
fromJsonArray
(com.google.gson.JsonObject p_286850_, String p_286682_, DeserializationContext p_286876_) final int
hashCode()
Returns a hash code value for this object.location()
Returns the value of thelocation
record component.boolean
matches
(ServerLevel p_36608_, Vec3 p_36609_, Entity p_36610_) boolean
matches
(ServerPlayer p_36612_, Entity p_36613_) nbt()
Returns the value of thenbt
record component.Returns the value of thepassenger
record component.com.google.gson.JsonElement
Returns the value of thesteppingOnLocation
record component.Returns the value of thesubPredicate
record component.Returns the value of thetargetedEntity
record component.team()
Returns the value of theteam
record component.final String
toString()
Returns a string representation of this record class.vehicle()
Returns the value of thevehicle
record component.static Optional<ContextAwarePredicate>
wrap
(Optional<EntityPredicate> p_300980_) static ContextAwarePredicate
wrap
(EntityPredicate p_286570_) static ContextAwarePredicate
wrap
(EntityPredicate.Builder p_298584_) static List<ContextAwarePredicate>
wrap
(EntityPredicate.Builder... p_299692_)
-
Field Details
-
entityType
The field for theentityType
record component. -
distanceToPlayer
The field for thedistanceToPlayer
record component. -
location
The field for thelocation
record component. -
steppingOnLocation
The field for thesteppingOnLocation
record component. -
effects
The field for theeffects
record component. -
nbt
The field for thenbt
record component. -
flags
The field for theflags
record component. -
equipment
The field for theequipment
record component. -
subPredicate
The field for thesubPredicate
record component. -
vehicle
The field for thevehicle
record component. -
passenger
The field for thepassenger
record component. -
targetedEntity
The field for thetargetedEntity
record component. -
team
The field for theteam
record component. -
CODEC
-
-
Constructor Details
-
EntityPredicate
public EntityPredicate(Optional<EntityTypePredicate> entityType, Optional<DistancePredicate> distanceToPlayer, Optional<LocationPredicate> location, Optional<LocationPredicate> steppingOnLocation, Optional<MobEffectsPredicate> effects, Optional<NbtPredicate> nbt, Optional<EntityFlagsPredicate> flags, Optional<EntityEquipmentPredicate> equipment, Optional<EntitySubPredicate> subPredicate, Optional<EntityPredicate> vehicle, Optional<EntityPredicate> passenger, Optional<EntityPredicate> targetedEntity, Optional<String> team) Creates an instance of aEntityPredicate
record class.- Parameters:
entityType
- the value for theentityType
record componentdistanceToPlayer
- the value for thedistanceToPlayer
record componentlocation
- the value for thelocation
record componentsteppingOnLocation
- the value for thesteppingOnLocation
record componenteffects
- the value for theeffects
record componentnbt
- the value for thenbt
record componentflags
- the value for theflags
record componentequipment
- the value for theequipment
record componentsubPredicate
- the value for thesubPredicate
record componentvehicle
- the value for thevehicle
record componentpassenger
- the value for thepassenger
record componenttargetedEntity
- the value for thetargetedEntity
record componentteam
- the value for theteam
record component
-
-
Method Details
-
fromJson
public static Optional<ContextAwarePredicate> fromJson(com.google.gson.JsonObject p_300195_, String p_297866_, DeserializationContext p_301262_) -
fromJsonArray
public static List<ContextAwarePredicate> fromJsonArray(com.google.gson.JsonObject p_286850_, String p_286682_, DeserializationContext p_286876_) -
fromElement
private static Optional<ContextAwarePredicate> fromElement(String p_286569_, DeserializationContext p_286821_, @Nullable com.google.gson.JsonElement p_286582_) -
wrap
-
wrap
-
wrap
-
wrap
-
matches
-
matches
-
fromJson
-
serializeToJson
public com.google.gson.JsonElement serializeToJson() -
createContext
-
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. -
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. -
equals
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 withObjects::equals(Object,Object)
. -
entityType
Returns the value of theentityType
record component.- Returns:
- the value of the
entityType
record component
-
distanceToPlayer
Returns the value of thedistanceToPlayer
record component.- Returns:
- the value of the
distanceToPlayer
record component
-
location
Returns the value of thelocation
record component.- Returns:
- the value of the
location
record component
-
steppingOnLocation
Returns the value of thesteppingOnLocation
record component.- Returns:
- the value of the
steppingOnLocation
record component
-
effects
Returns the value of theeffects
record component.- Returns:
- the value of the
effects
record component
-
nbt
Returns the value of thenbt
record component.- Returns:
- the value of the
nbt
record component
-
flags
Returns the value of theflags
record component.- Returns:
- the value of the
flags
record component
-
equipment
Returns the value of theequipment
record component.- Returns:
- the value of the
equipment
record component
-
subPredicate
Returns the value of thesubPredicate
record component.- Returns:
- the value of the
subPredicate
record component
-
vehicle
Returns the value of thevehicle
record component.- Returns:
- the value of the
vehicle
record component
-
passenger
Returns the value of thepassenger
record component.- Returns:
- the value of the
passenger
record component
-
targetedEntity
Returns the value of thetargetedEntity
record component.- Returns:
- the value of the
targetedEntity
record component
-
team
Returns the value of theteam
record component.- Returns:
- the value of the
team
record component
-