Record Class LootModifier
java.lang.Object
java.lang.Record
top.offsetmonkey538.loottablemodifier.common.api.resource.LootModifier
- Record Components:
actions- a list of actions to applypredicate- the predicate
- All Implemented Interfaces:
Predicate<LootModifierContext>
public record LootModifier(@NotNull @UnmodifiableView List<LootModifierAction> actions, @NotNull LootModifierPredicate predicate)
extends Record
implements Predicate<LootModifierContext>
-
Nested Class Summary
Nested Classes -
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionLootModifier(@NotNull @UnmodifiableView List<LootModifierAction> actions, @NotNull LootModifierPredicate predicate) Creates an instance of aLootModifierrecord class. -
Method Summary
Modifier and TypeMethodDescription@NotNull @UnmodifiableView List<LootModifierAction>actions()Returns the value of theactionsrecord component.intapply(@NotNull LootModifierContext context) Applied all the actions of this modifier using the provided context.static LootModifier.Builderbuilder()Creates a builder forLootModifierfinal booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.@NotNull LootModifierPredicateReturns the value of thepredicaterecord component.booleantest(@NotNull LootModifierContext context) Tests the predicate of this loot modifier against the provided context.final StringtoString()Returns a string representation of this record class.
-
Field Details
-
CODEC
-
-
Constructor Details
-
LootModifier
public LootModifier(@NotNull @NotNull @UnmodifiableView List<LootModifierAction> actions, @NotNull @NotNull LootModifierPredicate predicate) Creates an instance of aLootModifierrecord class.
-
-
Method Details
-
apply
Applied all the actions of this modifier using the provided context.- Parameters:
context- context to modify- Returns:
- highest modification level from applied actions.
LootModifierAction.MODIFIED_NONEwhen no action was applied. - See Also:
-
test
Tests the predicate of this loot modifier against the provided context.- Specified by:
testin interfacePredicate<LootModifierContext>- Parameters:
context- the context to match against- Returns:
- if the predicate of this loot modifier matched the provided context
-
builder
Creates a builder forLootModifier- Returns:
- a new
LootModifier.Builder
-
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). -
actions
Returns the value of theactionsrecord component.- Returns:
- the value of the
actionsrecord component
-
predicate
Returns the value of thepredicaterecord component.- Returns:
- the value of the
predicaterecord component
-