Record Class ActivateAltarTrigger.Conditions
java.lang.Object
java.lang.Record
johnsmith.enchantingoverhauled.advancement.ActivateAltarTrigger.Conditions
- All Implemented Interfaces:
net.minecraft.advancements.criterion.SimpleCriterionTrigger.SimpleInstance,net.minecraft.advancements.CriterionTriggerInstance
- Enclosing class:
ActivateAltarTrigger
public static record ActivateAltarTrigger.Conditions(Optional<net.minecraft.advancements.criterion.ContextAwarePredicate> player)
extends Record
implements net.minecraft.advancements.criterion.SimpleCriterionTrigger.SimpleInstance
Defines the conditions required to trigger this advancement.
Currently, this trigger only checks the standard player predicate, as the specific activation logic is handled by the block interaction event.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final com.mojang.serialization.Codec<ActivateAltarTrigger.Conditions> The codec for serializing these conditions to and from JSON. -
Constructor Summary
ConstructorsConstructorDescriptionConditions(Optional<net.minecraft.advancements.criterion.ContextAwarePredicate> player) Creates an instance of aConditionsrecord class. -
Method Summary
Modifier and TypeMethodDescriptionfinal booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.booleanmatches()Checks if the conditions match the given player context.@NotNull Optional<net.minecraft.advancements.criterion.ContextAwarePredicate> player()Gets the player predicate associated with this condition.final StringtoString()Returns a string representation of this record class.Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface net.minecraft.advancements.criterion.SimpleCriterionTrigger.SimpleInstance
validate
-
Field Details
-
CODEC
The codec for serializing these conditions to and from JSON.
-
-
Constructor Details
-
Conditions
Creates an instance of aConditionsrecord class.- Parameters:
player- the value for theplayerrecord component
-
-
Method Details
-
player
@NotNull public @NotNull Optional<net.minecraft.advancements.criterion.ContextAwarePredicate> player()Gets the player predicate associated with this condition.- Specified by:
playerin interfacenet.minecraft.advancements.criterion.SimpleCriterionTrigger.SimpleInstance- Returns:
- An Optional containing the player predicate.
-
matches
public boolean matches()Checks if the conditions match the given player context.- Returns:
- Always true in this implementation, as the event trigger itself implies success.
-
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).
-