Class AbstractConfigTag<T extends ConfigTag>

java.lang.Object
codechicken.lib.config.AbstractConfigTag<T>
All Implemented Interfaces:
ConfigTag
Direct Known Subclasses:
ConfigCategoryImpl, ConfigValueImpl, ConfigValueListImpl

public abstract class AbstractConfigTag<T extends ConfigTag> extends Object implements ConfigTag
Created by covers1624 on 17/4/22.
  • Field Details

    • dirty

      protected boolean dirty
    • networkSynthetic

      protected boolean networkSynthetic
    • comment

      protected List<String> comment
    • syncToClient

      protected boolean syncToClient
  • Constructor Details

  • Method Details

    • getName

      public final String getName()
      Description copied from interface: ConfigTag
      Gets the name of this tag.
      Specified by:
      getName in interface ConfigTag
      Returns:
      The name.
    • getParent

      @Nullable public final @Nullable ConfigCategory getParent()
      Description copied from interface: ConfigTag
      Get the parent tag.

      This will be null for the root tag.

      Specified by:
      getParent in interface ConfigTag
      Returns:
      The parent or null.
    • setComment

      public T setComment(String comment)
      Description copied from interface: ConfigTag
      Sets the comment for this tag.
      Will be split on \n.
      Specified by:
      setComment in interface ConfigTag
      Parameters:
      comment - The comment line.
      Returns:
      The same config tag.
    • setComment

      public T setComment(String... comment)
      Description copied from interface: ConfigTag
      Sets the comment for this tag.
      Specified by:
      setComment in interface ConfigTag
      Parameters:
      comment - The comment lines.
      Returns:
      The same config tag.
    • setComment

      public T setComment(List<String> comment)
      Description copied from interface: ConfigTag
      Sets the comment for this tag.
      Specified by:
      setComment in interface ConfigTag
      Parameters:
      comment - The comment lines.
      Returns:
      The same config tag.
    • getComment

      public final List<String> getComment()
      Description copied from interface: ConfigTag
      Gets the comment for the tag.
      Specified by:
      getComment in interface ConfigTag
      Returns:
      The comment.
    • onSync

      public T onSync(ConfigCallback<T> callback)
    • syncTagToClient

      public T syncTagToClient()
      Description copied from interface: ConfigTag
      Sets this tag as requiring syncing to the client.

      Register your root tag via ConfigSyncManager.registerSync(ResourceLocation, ConfigTag).

      Specified by:
      syncTagToClient in interface ConfigTag
    • requiresClientSync

      public boolean requiresClientSync()
      Description copied from interface: ConfigTag
      Checks if this tag or any of its children require client sync.
      Specified by:
      requiresClientSync in interface ConfigTag
      Returns:
      If client sync is required.
    • runSync

      public void runSync(ConfigCallback.Reason reason)
      Description copied from interface: ConfigTag
      Triggers all registered ConfigCallback's in the tree with the specified reason.

      This method should probably not be called by anyone else.

      Specified by:
      runSync in interface ConfigTag
      Parameters:
      reason - The reason.
    • isNetworkTag

      public boolean isNetworkTag()
      Description copied from interface: ConfigTag
      Checks if this tags is a synthetic network tag.

      Synthetic network tags will exist on the client when some form of dynamic config structure is synced to the client.

      Specified by:
      isNetworkTag in interface ConfigTag
      Returns:
      If the tag is synthetic.
    • isDirty

      public boolean isDirty()
      Description copied from interface: ConfigTag
      If this ConfigTag or any of its children are dirty and requires flushing to disk.
      Specified by:
      isDirty in interface ConfigTag
      Returns:
      If the branch is dirty.
    • clearDirty

      @Internal public void clearDirty()
    • copy

      public ConfigTag copy()
      Description copied from interface: ConfigTag
      Creates a deep clone of this ConfigTag.

      If this is called on a child tag, it will split from its parent.

      Does not keep callbacks.

      Specified by:
      copy in interface ConfigTag
      Returns:
      The deep copied tag.
    • copy

      public abstract AbstractConfigTag<T> copy(@Nullable @Nullable ConfigCategoryImpl parent)