Record Class ItemSetPropertyWrapper
java.lang.Object
java.lang.Record
johnsmith.enchantmentcore.api.config.wrapper.ItemSetPropertyWrapper
- Record Components:
property- The live configurationPropertyholding the list of items and item tags.description- TheConfigDescriptionmetadata identifying the configuration property.fallbackItems- The fallback list ofItemOrItemsparsed from the datapack JSON definition.
public record ItemSetPropertyWrapper(johnsmith.configoverhauled.api.Property<List<ItemOrItems>> property, johnsmith.configoverhauled.api.data.ConfigDescription description, List<ItemOrItems> fallbackItems)
extends Record
Binds a dynamic configuration property containing
ItemOrItems entries to an enchantment's
supported_items or primary_items definition, resolving them into a HolderSet at runtime.-
Constructor Summary
ConstructorsConstructorDescriptionItemSetPropertyWrapper(johnsmith.configoverhauled.api.Property<List<ItemOrItems>> property, johnsmith.configoverhauled.api.data.ConfigDescription description, List<ItemOrItems> fallbackItems) Creates an instance of aItemSetPropertyWrapperrecord class. -
Method Summary
Modifier and TypeMethodDescriptionjohnsmith.configoverhauled.api.data.ConfigDescriptionReturns the value of thedescriptionrecord component.final booleanIndicates whether some other object is "equal to" this one.Returns the value of thefallbackItemsrecord component.final inthashCode()Returns a hash code value for this object.booleanDetermines whether a valid configuration property is bound to this wrapper.johnsmith.configoverhauled.api.Property<List<ItemOrItems>> property()Returns the value of thepropertyrecord component.net.minecraft.core.HolderSet<net.minecraft.world.item.Item> resolve(net.minecraft.core.HolderSet<net.minecraft.world.item.Item> vanillaFallback) Compiles the configuredItemOrItemsentries (expanding any item tags againstBuiltInRegistries.ITEM) into a directHolderSet.final StringtoString()Returns a string representation of this record class.
-
Constructor Details
-
ItemSetPropertyWrapper
public ItemSetPropertyWrapper(johnsmith.configoverhauled.api.Property<List<ItemOrItems>> property, johnsmith.configoverhauled.api.data.ConfigDescription description, List<ItemOrItems> fallbackItems) Creates an instance of aItemSetPropertyWrapperrecord class.- Parameters:
property- the value for thepropertyrecord componentdescription- the value for thedescriptionrecord componentfallbackItems- the value for thefallbackItemsrecord component
-
-
Method Details
-
isConfigured
public boolean isConfigured()Determines whether a valid configuration property is bound to this wrapper.- Returns:
trueifproperty()is non-null,falseotherwise.
-
resolve
public net.minecraft.core.HolderSet<net.minecraft.world.item.Item> resolve(net.minecraft.core.HolderSet<net.minecraft.world.item.Item> vanillaFallback) Compiles the configuredItemOrItemsentries (expanding any item tags againstBuiltInRegistries.ITEM) into a directHolderSet.If the property is unconfigured or its resolved entry list is empty,
vanillaFallbackis returned.- Parameters:
vanillaFallback- The baselineHolderSetto return if no configured entries are available.- Returns:
- A
HolderSetcontaining all resolved item holders, orvanillaFallbackif empty.
-
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). -
property
-
description
public johnsmith.configoverhauled.api.data.ConfigDescription description()Returns the value of thedescriptionrecord component.- Returns:
- the value of the
descriptionrecord component
-
fallbackItems
Returns the value of thefallbackItemsrecord component.- Returns:
- the value of the
fallbackItemsrecord component
-