Record Class LootDataType<T>
java.lang.Object
java.lang.Record
net.minecraft.world.level.storage.loot.LootDataType<T>
public record LootDataType<T>(ResourceKey<Registry<T>> registryKey, com.mojang.serialization.Codec<T> codec, LootDataType.Validator<T> validator, T defaultValue, com.mojang.serialization.Codec<Optional<T>> conditionalCodec, BiConsumer<T,ResourceLocation> idSetter)
extends Record
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final com.mojang.serialization.Codec<T> The field for thecodecrecord component.The field for theconditionalCodecrecord component.private final TThe field for thedefaultValuerecord component.private final BiConsumer<T, ResourceLocation> The field for theidSetterrecord component.static final LootDataType<LootItemFunction> static final LootDataType<LootItemCondition> private final ResourceKey<Registry<T>> The field for theregistryKeyrecord component.static final LootDataType<LootTable> private final LootDataType.Validator<T> The field for thevalidatorrecord component. -
Constructor Summary
ConstructorsModifierConstructorDescriptionprivateLootDataType(ResourceKey<Registry<T>> registryKey, com.mojang.serialization.Codec<T> codec, LootDataType.Validator<T> validator) Deprecated.LootDataType(ResourceKey<Registry<T>> registryKey, com.mojang.serialization.Codec<T> codec, LootDataType.Validator<T> validator, T defaultValue, com.mojang.serialization.Codec<Optional<T>> conditionalCodec, BiConsumer<T, ResourceLocation> idSetter) Creates an instance of aLootDataTyperecord class.privateLootDataType(ResourceKey<Registry<T>> registryKey, com.mojang.serialization.Codec<T> codec, LootDataType.Validator<T> validator, T defaultValue, BiConsumer<T, ResourceLocation> idSetter) -
Method Summary
Modifier and TypeMethodDescriptioncom.mojang.serialization.Codec<T> codec()Returns the value of thecodecrecord component.Returns the value of theconditionalCodecrecord component.private static LootDataType.Validator<LootTable> private static <T extends LootContextUser>
LootDataType.Validator<T> Returns the value of thedefaultValuerecord component.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.idSetter()Returns the value of theidSetterrecord component.Returns the value of theregistryKeyrecord component.voidrunValidation(ValidationContext context, ResourceKey<T> key, T value) final StringtoString()Returns a string representation of this record class.Returns the value of thevalidatorrecord component.static Stream<LootDataType<?>> values()
-
Field Details
-
registryKey
The field for theregistryKeyrecord component. -
codec
The field for thecodecrecord component. -
validator
The field for thevalidatorrecord component. -
defaultValue
The field for thedefaultValuerecord component. -
conditionalCodec
The field for theconditionalCodecrecord component. -
idSetter
The field for theidSetterrecord component. -
PREDICATE
-
MODIFIER
-
TABLE
-
-
Constructor Details
-
LootDataType
@Deprecated private LootDataType(ResourceKey<Registry<T>> registryKey, com.mojang.serialization.Codec<T> codec, LootDataType.Validator<T> validator) Deprecated.Neo: use the constructorto support conditionsinvalid reference
with a default value and id setter -
LootDataType
private LootDataType(ResourceKey<Registry<T>> registryKey, com.mojang.serialization.Codec<T> codec, LootDataType.Validator<T> validator, @Nullable T defaultValue, BiConsumer<T, ResourceLocation> idSetter) -
LootDataType
public LootDataType(ResourceKey<Registry<T>> registryKey, com.mojang.serialization.Codec<T> codec, LootDataType.Validator<T> validator, @Nullable T defaultValue, com.mojang.serialization.Codec<Optional<T>> conditionalCodec, BiConsumer<T, ResourceLocation> idSetter) Creates an instance of aLootDataTyperecord class.- Parameters:
registryKey- the value for theregistryKeyrecord componentcodec- the value for thecodecrecord componentvalidator- the value for thevalidatorrecord componentdefaultValue- the value for thedefaultValuerecord componentconditionalCodec- the value for theconditionalCodecrecord componentidSetter- the value for theidSetterrecord component
-
-
Method Details
-
runValidation
-
values
-
createSimpleValidator
-
createLootTableValidator
-
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). -
registryKey
Returns the value of theregistryKeyrecord component.- Returns:
- the value of the
registryKeyrecord component
-
codec
Returns the value of thecodecrecord component.- Returns:
- the value of the
codecrecord component
-
validator
Returns the value of thevalidatorrecord component.- Returns:
- the value of the
validatorrecord component
-
defaultValue
Returns the value of thedefaultValuerecord component.- Returns:
- the value of the
defaultValuerecord component
-
conditionalCodec
Returns the value of theconditionalCodecrecord component.- Returns:
- the value of the
conditionalCodecrecord component
-
idSetter
Returns the value of theidSetterrecord component.- Returns:
- the value of the
idSetterrecord component
-
invalid reference