Record Class TradeProductionRules

java.lang.Object
java.lang.Record
forgottentowns.mod.api.TradeProductionRules
Record Components:
woodcutting - whether present woodcuttable features supply their basic drops freely
gathering - whether present gatherable features supply their basic drops freely
digging - whether biome digging drops are free inputs
collections - ordered infrastructure rules granting free collection inputs

public record TradeProductionRules(boolean woodcutting, boolean gathering, boolean digging, List<TradeProductionRules.CollectionInput> collections) extends Record
Legacy production assumptions retained for compiled mod-core compatibility. Settlement supply now uses completed packing records and ignores these assumptions.
  • Constructor Details

    • TradeProductionRules

      public TradeProductionRules(boolean woodcutting, boolean gathering, boolean digging, List<TradeProductionRules.CollectionInput> collections)
      Copies and bounds the authored collection rules.
      Parameters:
      woodcutting - allow naturally present woodcutting drops
      gathering - allow naturally present gathering drops
      digging - allow biome digging drops
      collections - ordered infrastructure rules
      Throws:
      IllegalArgumentException - if more than 64 rules are provided or resources repeat
      NullPointerException - if the list or an entry is null
  • Method Details

    • read

      public static TradeProductionRules read(Object value)
      Parses a manifest-captured JSON object, rejecting misspelled fields.
      Parameters:
      value - captured table returned by the mod context
      Returns:
      validated estimation policy
      Throws:
      IllegalArgumentException - if the table is malformed
      NullPointerException - if an entry contains a null identifier
    • validate

      public void validate(RegistryAccess registries)
      Validates resource and placeable references against the composed registries.
      Parameters:
      registries - published content snapshot
      Throws:
      IllegalArgumentException - if a referenced definition is missing
    • 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. Reference components are compared with Objects::equals(Object,Object); primitive components are compared with '=='.
      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.
    • woodcutting

      public boolean woodcutting()
      Returns the value of the woodcutting record component.
      Returns:
      the value of the woodcutting record component
    • gathering

      public boolean gathering()
      Returns the value of the gathering record component.
      Returns:
      the value of the gathering record component
    • digging

      public boolean digging()
      Returns the value of the digging record component.
      Returns:
      the value of the digging record component
    • collections

      Returns the value of the collections record component.
      Returns:
      the value of the collections record component