InternalReferenceResolver
Package: com.hypixel.hytale.server.npc.asset.builder
public class InternalReferenceResolverResolves local (internal) builder references within a single NPC role file. When a component uses "Local": true with a "Reference", the reference points to another component defined in the same file rather than an external file. This resolver maintains a name-to-index map and a list of builder instruction references, and validates that no cyclic dependencies exist.
Currently only supports Instruction type references.
Constructor
Section titled “Constructor”public InternalReferenceResolver()Methods
Section titled “Methods”getOrCreateIndex
Section titled “getOrCreateIndex”public int getOrCreateIndex(String name)Returns the index for the named reference, creating a new slot if necessary. If dependency recording is active, the index is recorded.
setRecordDependencies / getRecordedDependenices / stopRecordingDependencies
Section titled “setRecordDependencies / getRecordedDependenices / stopRecordingDependencies”public void setRecordDependencies()@Nullablepublic IntSet getRecordedDependenices()public void stopRecordingDependencies()Controls dependency recording mode for cycle detection.
addBuilder
Section titled “addBuilder”public void addBuilder(int index, BuilderInstructionReference builder)Registers a builder at the given index. Throws on duplicate or out-of-range indices.
validateInternalReferences
Section titled “validateInternalReferences”public void validateInternalReferences(String configName, @Nonnull List<String> errors)Validates that all referenced slots have builders and that no cyclic dependencies exist (via DFS).
getBuilder
Section titled “getBuilder”public <T> Builder<T> getBuilder(int index, Class<?> classType)Returns the builder at the given index. Throws IllegalArgumentException if classType is not Instruction.class.
optimise
Section titled “optimise”public void optimise()Releases the index and name maps after validation is complete.
Related Types
Section titled “Related Types”- BuilderObjectReferenceHelper — uses this for local references
- BuilderValidationHelper — carries this resolver