Skip to content

InternalReferenceResolver

Package: com.hypixel.hytale.server.npc.asset.builder

public class InternalReferenceResolver

Resolves 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.

public InternalReferenceResolver()
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()
@Nullable
public IntSet getRecordedDependenices()
public void stopRecordingDependencies()

Controls dependency recording mode for cycle detection.

public void addBuilder(int index, BuilderInstructionReference builder)

Registers a builder at the given index. Throws on duplicate or out-of-range indices.

public void validateInternalReferences(String configName, @Nonnull List<String> errors)

Validates that all referenced slots have builders and that no cyclic dependencies exist (via DFS).

public <T> Builder<T> getBuilder(int index, Class<?> classType)

Returns the builder at the given index. Throws IllegalArgumentException if classType is not Instruction.class.

public void optimise()

Releases the index and name maps after validation is complete.

Hydex is an independent community resource. Hytale is a trademark of Hypixel Studios. Hydex is not affiliated with or endorsed by Hypixel Studios.