Class OnlyIfPreprocessor
- All Implemented Interfaces:
IPreprocessor,Comparator<IScriptFile>
-
Nested Class Summary
Nested classes/interfaces inherited from interface com.blamejared.crafttweaker.api.zencode.IPreprocessor
IPreprocessor.Match -
Field Summary
FieldsFields inherited from interface com.blamejared.crafttweaker.api.zencode.IPreprocessor
PREPROCESSOR_LOGGER, PREPROCESSOR_PATTERN -
Method Summary
Modifier and TypeMethodDescriptionvoidaddParameter(OnlyIfParameter parameter) booleanapply(IScriptFile file, List<String> preprocessedContents, IMutableScriptRunInfo runInfo, List<IPreprocessor.Match> matches) Applies the preprocessor to theIScriptFileand theIMutableScriptRunInfo.Gets the default value of a preprocessor.name()Gets the name of the preprocessor.Gets the name of the preprocessor that marks the end of a preprocessor block.intpriority()Gets the priority of the preprocessor.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface java.util.Comparator
equals, reversed, thenComparing, thenComparing, thenComparing, thenComparingDouble, thenComparingInt, thenComparingLongMethods inherited from interface com.blamejared.crafttweaker.api.zencode.IPreprocessor
compare
-
Field Details
-
INSTANCE
-
NAME
- See Also:
-
-
Method Details
-
addParameter
-
name
Description copied from interface:IPreprocessorGets 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:
namein interfaceIPreprocessor- Returns:
- The name of the preprocessor.
-
preprocessorEndMarker
Description copied from interface:IPreprocessorGets the name of the preprocessor that marks the end of a preprocessor block.A preprocessor block is identified as a group of file lines, which can be either other preprocessor instructions or lines of code, contained between a "begin" marker and an "end" marker. It is up to the preprocessor to determine the begin and end markers. It is also up to the preprocessor to manage nesting of blocks if such a behavior is desired.
- Specified by:
preprocessorEndMarkerin interfaceIPreprocessor- Returns:
- The name of the instruction that closes the block, or
IPreprocessor.name()if no block is desired.
-
defaultValue
Description copied from interface:IPreprocessorGets the default value of a preprocessor.nullis allowed and means that no default value is provided.- Specified by:
defaultValuein interfaceIPreprocessor- 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:IPreprocessorApplies the preprocessor to theIScriptFileand theIMutableScriptRunInfo.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
preprocessedContentslist, whereas the run information can be altered through therunInfoparameter. All other information is read-only.A preprocessor can also prevent loading of the file and further pre-processing by returning
falsein this method.- Specified by:
applyin interfaceIPreprocessor- 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- anIMutableScriptRunInforepresenting 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:IPreprocessorGets the priority of the preprocessor.The higher the priority is, the earlier the preprocessor will be queried.
- Specified by:
priorityin interfaceIPreprocessor- Returns:
- The priority of the preprocessor.
-