Record Class NumberDispatcher
java.lang.Object
java.lang.Record
net.minecraft.world.level.storage.loot.providers.number.ints.NumberDispatcher
- All Implemented Interfaces:
DispatcherProvider<ContextIntProvider>, ContextIntProvider, Validatable
public record NumberDispatcher(List<DispatcherProvider.Case<ContextIntProvider>> cases, Holder<ContextIntProvider> defaultValue)
extends Record
implements ContextIntProvider, DispatcherProvider<ContextIntProvider>
-
Nested Class Summary
Nested classes/interfaces inherited from interface DispatcherProvider
DispatcherProvider.Case<Value>, DispatcherProvider.Factory<Value,Self> -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final List<DispatcherProvider.Case<ContextIntProvider>> The field for thecasesrecord component.private final Holder<ContextIntProvider> The field for thedefaultValuerecord component.static final com.mojang.serialization.MapCodec<NumberDispatcher> -
Constructor Summary
ConstructorsConstructorDescriptionNumberDispatcher(List<DispatcherProvider.Case<ContextIntProvider>> cases, Holder<ContextIntProvider> defaultValue) Creates an instance of aNumberDispatcherrecord class. -
Method Summary
Modifier and TypeMethodDescriptioncases()Returns the value of thecasesrecord component.com.mojang.serialization.MapCodec<NumberDispatcher> codec()Returns the value of thedefaultValuerecord component.final booleanIndicates whether some other object is "equal to" this one.intgetIntUnsafe(LootContext context) final inthashCode()Returns a hash code value for this object.final StringtoString()Returns a string representation of this record class.Methods inherited from interface ContextIntProvider
getIntMethods inherited from interface DispatcherProvider
selectValue, validate
-
Field Details
-
cases
The field for thecasesrecord component. -
defaultValue
The field for thedefaultValuerecord component. -
MAP_CODEC
-
-
Constructor Details
-
NumberDispatcher
public NumberDispatcher(List<DispatcherProvider.Case<ContextIntProvider>> cases, Holder<ContextIntProvider> defaultValue) Creates an instance of aNumberDispatcherrecord class.- Parameters:
cases- the value for thecasesrecord componentdefaultValue- the value for thedefaultValuerecord component
-
-
Method Details
-
getIntUnsafe
- Specified by:
getIntUnsafein interfaceContextIntProvider
-
codec
- Specified by:
codecin interfaceContextIntProvider
-
toString
-
hashCode
-
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). -
cases
Returns the value of thecasesrecord component.- Specified by:
casesin interfaceDispatcherProvider<ContextIntProvider>- Returns:
- the value of the
casesrecord component
-
defaultValue
Returns the value of thedefaultValuerecord component.- Specified by:
defaultValuein interfaceDispatcherProvider<ContextIntProvider>- Returns:
- the value of the
defaultValuerecord component
-