Class LoadLastPreprocessor

java.lang.Object
com.blamejared.crafttweaker.impl.preprocessor.LoadLastPreprocessor
All Implemented Interfaces:
IPreprocessor, Comparator<IScriptFile>

@ZenRegister @Preprocessor public final class LoadLastPreprocessor extends Object implements IPreprocessor
  • Field Details

  • Method Details

    • name

      public String name()
      Description copied from interface: IPreprocessor
      Gets the name of the preprocessor.

      It is illegal for a preprocessor name to contain spaces. It is also customary, although not required, for the preprocessor name to be all lowercase.

      It is not allowed to specify the pound symbol as part of the name.

      Specified by:
      name in interface IPreprocessor
      Returns:
      The name of the preprocessor.
    • defaultValue

      @Nullable public String defaultValue()
      Description copied from interface: IPreprocessor
      Gets the default value of a preprocessor.

      null is allowed and means that no default value is provided.

      Specified by:
      defaultValue in interface IPreprocessor
      Returns:
      The default value of the preprocessor.
    • apply

      public boolean apply(IScriptFile file, List<String> preprocessedContents, IMutableScriptRunInfo runInfo, List<IPreprocessor.Match> matches)
      Description copied from interface: IPreprocessor
      Applies the preprocessor to the IScriptFile and the IMutableScriptRunInfo.

      Each preprocessor for which at least one match has been identified or that defines a non-null default value will be called. This method will regardless be called at most once for every file in a single script run.

      It is possible for a preprocessor to modify the file contents by acting directly on the preprocessedContents list, whereas the run information can be altered through the runInfo parameter. All other information is read-only.

      A preprocessor can also prevent loading of the file and further pre-processing by returning false in this method.

      Specified by:
      apply in interface IPreprocessor
      Parameters:
      file - The file on which the preprocessor is being invoked on.
      preprocessedContents - The contents of the file, as preprocessed by other preprocessors. If this preprocessor wants to modify the file contents, it is allowed to act directly on this list.
      runInfo - an IMutableScriptRunInfo representing information related to the run and allowing modification if desired.
      matches - A read-only list containing all preprocessor matches in the current file. The matches are guaranteed to be ordered from top to bottom.
      Returns:
      Whether the file is still eligible for loading (true) or if it should be discarded (false).
    • priority

      public int priority()
      Description copied from interface: IPreprocessor
      Gets the priority of the preprocessor.

      The higher the priority is, the earlier the preprocessor will be queried.

      Specified by:
      priority in interface IPreprocessor
      Returns:
      The priority of the preprocessor.
    • compare

      public int compare(IScriptFile a, IScriptFile b)
      Description copied from interface: IPreprocessor
      Compares the two script files, allowing the preprocessor to alter their ordering.

      This method might get called even if the current preprocessor has no matches in the file. It is thus suggested to verify the presence of the preprocessor through IScriptFile.hasMatchesFor(IPreprocessor) instead of assuming its presence.

      Specified by:
      compare in interface Comparator<IScriptFile>
      Specified by:
      compare in interface IPreprocessor
      Parameters:
      a - The first script file to compare.
      b - The second script file to compare.
      Returns:
      0 if the files are to be considered equal, -1 if a comes before b, 1 otherwise.