Record Class SMetadata

java.lang.Object
java.lang.Record
net.lcc.sollib.api.common.data.runtime.metadata.SMetadata

public record SMetadata(com.google.gson.JsonObject condition, com.google.gson.JsonObject remaps) extends Record
Any data/resource pack file can be given additional metadata by putting a file with the same name and an added .sol next to it
For example, yourmod:random/path/awesomefile.json reads its metadata from yourmod:random/path/awesomefile.json.sol in the same pack

This metadata file allows defining things such as load conditions or dynamic remaps
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static class 
    To add load conditions to a data/resource pack file, add a "load_condition" object to its metadata

    There currently are 5 types of conditions:
    - "dependency": Takes an extra mod argument.
    static class 
     
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final SMetadata
     
  • Constructor Summary

    Constructors
    Constructor
    Description
    SMetadata(com.google.gson.JsonObject condition, com.google.gson.JsonObject remaps)
    Creates an instance of a SMetadata record class.
  • Method Summary

    Modifier and Type
    Method
    Description
    com.google.gson.JsonObject
    Returns the value of the condition record component.
    final boolean
    Indicates whether some other object is "equal to" this one.
    static SMetadata
    getFor(net.minecraft.resources.ResourceLocation id, net.minecraft.server.packs.PackResources pack, net.minecraft.server.packs.PackType type)
     
    final int
    Returns a hash code value for this object.
    com.google.gson.JsonObject
    Returns the value of the remaps record component.
    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
  • Field Details

    • EMPTY

      public static final SMetadata EMPTY
  • Constructor Details

    • SMetadata

      public SMetadata(com.google.gson.JsonObject condition, com.google.gson.JsonObject remaps)
      Creates an instance of a SMetadata record class.
      Parameters:
      condition - the value for the condition record component
      remaps - the value for the remaps record component
  • Method Details

    • getFor

      public static SMetadata getFor(net.minecraft.resources.ResourceLocation id, net.minecraft.server.packs.PackResources pack, net.minecraft.server.packs.PackType type)
    • 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.
    • condition

      public com.google.gson.JsonObject condition()
      Returns the value of the condition record component.
      Returns:
      the value of the condition record component
    • remaps

      public com.google.gson.JsonObject remaps()
      Returns the value of the remaps record component.
      Returns:
      the value of the remaps record component