Record Class ItemSetPropertyWrapper

java.lang.Object
java.lang.Record
johnsmith.enchantmentcore.api.config.wrapper.ItemSetPropertyWrapper
Record Components:
property - The live configuration Property holding the list of items and item tags.
description - The ConfigDescription metadata identifying the configuration property.
fallbackItems - The fallback list of ItemOrItems parsed 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

    Constructors
    Constructor
    Description
    ItemSetPropertyWrapper(johnsmith.configoverhauled.api.Property<List<ItemOrItems>> property, johnsmith.configoverhauled.api.data.ConfigDescription description, List<ItemOrItems> fallbackItems)
    Creates an instance of a ItemSetPropertyWrapper record class.
  • Method Summary

    Modifier and Type
    Method
    Description
    johnsmith.configoverhauled.api.data.ConfigDescription
    Returns the value of the description record component.
    final boolean
    Indicates whether some other object is "equal to" this one.
    Returns the value of the fallbackItems record component.
    final int
    Returns a hash code value for this object.
    boolean
    Determines whether a valid configuration property is bound to this wrapper.
    johnsmith.configoverhauled.api.Property<List<ItemOrItems>>
    Returns the value of the property record component.
    net.minecraft.core.HolderSet<net.minecraft.world.item.Item>
    resolve(net.minecraft.core.HolderSet<net.minecraft.world.item.Item> vanillaFallback)
    Compiles the configured ItemOrItems entries (expanding any item tags against BuiltInRegistries.ITEM) into a direct HolderSet.
    final String
    Returns a string representation of this record class.

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • 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 a ItemSetPropertyWrapper record class.
      Parameters:
      property - the value for the property record component
      description - the value for the description record component
      fallbackItems - the value for the fallbackItems record component
  • Method Details

    • isConfigured

      public boolean isConfigured()
      Determines whether a valid configuration property is bound to this wrapper.
      Returns:
      true if property() is non-null, false otherwise.
    • resolve

      public net.minecraft.core.HolderSet<net.minecraft.world.item.Item> resolve(net.minecraft.core.HolderSet<net.minecraft.world.item.Item> vanillaFallback)
      Compiles the configured ItemOrItems entries (expanding any item tags against BuiltInRegistries.ITEM) into a direct HolderSet.

      If the property is unconfigured or its resolved entry list is empty, vanillaFallback is returned.

      Parameters:
      vanillaFallback - The baseline HolderSet to return if no configured entries are available.
      Returns:
      A HolderSet containing all resolved item holders, or vanillaFallback if empty.
    • toString

      public final String 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.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • 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.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      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 with Objects::equals(Object,Object).
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • property

      public johnsmith.configoverhauled.api.Property<List<ItemOrItems>> property()
      Returns the value of the property record component.
      Returns:
      the value of the property record component
    • description

      public johnsmith.configoverhauled.api.data.ConfigDescription description()
      Returns the value of the description record component.
      Returns:
      the value of the description record component
    • fallbackItems

      public List<ItemOrItems> fallbackItems()
      Returns the value of the fallbackItems record component.
      Returns:
      the value of the fallbackItems record component