Record Class ArmyPopulationTrigger.ArmyPopulationTriggerInstance
java.lang.Object
java.lang.Record
com.minecolonies.api.advancements.ArmyPopulationTrigger.ArmyPopulationTriggerInstance
- All Implemented Interfaces:
net.minecraft.advancements.critereon.SimpleCriterionTrigger.SimpleInstance,net.minecraft.advancements.CriterionTriggerInstance
- Enclosing class:
ArmyPopulationTrigger
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final com.mojang.serialization.Codec<ArmyPopulationTrigger.ArmyPopulationTriggerInstance> -
Constructor Summary
ConstructorsConstructorDescriptionArmyPopulationTriggerInstance(Optional<net.minecraft.advancements.critereon.ContextAwarePredicate> player, int populationCount) Creates an instance of aArmyPopulationTriggerInstancerecord class. -
Method Summary
Modifier and TypeMethodDescriptionstatic net.minecraft.advancements.Criterion<ArmyPopulationTrigger.ArmyPopulationTriggerInstance> armyPopulation(int populationCount) Registers a deserialized advancement trigger with this criterion conditionfinal booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.Optional<net.minecraft.advancements.critereon.ContextAwarePredicate> player()Returns the value of theplayerrecord component.intReturns the value of thepopulationCountrecord component.booleantest(int populationCount) Perform the check comparing the current population to the advancement conditionfinal 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.critereon.SimpleCriterionTrigger.SimpleInstance
validate
-
Field Details
-
CODEC
public static final com.mojang.serialization.Codec<ArmyPopulationTrigger.ArmyPopulationTriggerInstance> CODEC
-
-
Constructor Details
-
ArmyPopulationTriggerInstance
public ArmyPopulationTriggerInstance(Optional<net.minecraft.advancements.critereon.ContextAwarePredicate> player, int populationCount) Creates an instance of aArmyPopulationTriggerInstancerecord class.- Parameters:
player- the value for theplayerrecord componentpopulationCount- the value for thepopulationCountrecord component
-
-
Method Details
-
armyPopulation
public static net.minecraft.advancements.Criterion<ArmyPopulationTrigger.ArmyPopulationTriggerInstance> armyPopulation(int populationCount) Registers a deserialized advancement trigger with this criterion condition- Parameters:
populationCount- the current army size
-
test
public boolean test(int populationCount) Perform the check comparing the current population to the advancement condition- Parameters:
populationCount- the current population- Returns:
- whether the check passed
-
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. Reference components are compared withObjects::equals(Object,Object); primitive components are compared with '=='. -
player
Returns the value of theplayerrecord component.- Specified by:
playerin interfacenet.minecraft.advancements.critereon.SimpleCriterionTrigger.SimpleInstance- Returns:
- the value of the
playerrecord component
-
populationCount
public int populationCount()Returns the value of thepopulationCountrecord component.- Returns:
- the value of the
populationCountrecord component
-