BuilderObjectReferenceHelper
Package: com.hypixel.hytale.server.npc.asset.builder
public class BuilderObjectReferenceHelper<T> extends BuilderObjectHelper<T>The primary helper for resolving a single builder reference from JSON. Handles three modes of resolution:
- Inline builder — the JSON object contains a type tag and is read directly by the factory.
- File reference — the JSON object contains a
"Reference"key pointing to another builder by name, optionally with a"Modify"block. - Internal (local) reference — the JSON object contains
"Reference"and"Local": true, resolving via the InternalReferenceResolver.
Supports nullable references ("Nullable": true), interface matching ("Interfaces"), and modifier application with scope merging and state export.
Type Parameters
Section titled “Type Parameters”| Parameter | Description |
|---|---|
T | The runtime type produced by the resolved builder. |
Constants
Section titled “Constants”| Constant | Value |
|---|---|
KEY_REFERENCE | "Reference" |
KEY_LOCAL | "Local" |
KEY_INTERFACE_LIST | "Interfaces" |
KEY_NULLABLE | "Nullable" |
NULL_COMPONENT | "$Null" |
KEY_LABEL | "$Label" |
Methods
Section titled “Methods”@Nullable@Overridepublic T build(@Nonnull BuilderSupport builderSupport)Resolves the builder (inline, file reference, or internal), applies any modifier scope and state mapping, validates features and instruction context, and calls Builder.build().
validate
Section titled “validate”@Overridepublic boolean validate(String configName, NPCLoadTimeValidationHelper loadTimeValidationHelper, @Nonnull BuilderManager manager, @Nonnull ExecutionContext context, Scope globalScope, @Nonnull List<String> errors)Validates the resolved builder with scope and modifier application.
readConfig
Section titled “readConfig”public void readConfig(@Nonnull JsonElement data, @Nonnull BuilderFactory<T> factory, @Nonnull BuilderManager builderManager, @Nonnull BuilderParameters builderParameters, @Nonnull BuilderValidationHelper builderValidationHelper)Reads the JSON element. Determines whether it is an inline builder, file reference, or internal reference, and reads accordingly.
getBuilder
Section titled “getBuilder”@Nullablepublic Builder<T> getBuilder(@Nonnull BuilderManager builderManager, ExecutionContext context, @Nullable Builder<?> parentSpawnable)Resolves the builder from the cache, internal resolver, or inline instance.
isPresent / isFinal
Section titled “isPresent / isFinal”@Overridepublic boolean isPresent()public boolean isFinal()isPresent() returns true if a builder is inline or a reference is set. isFinal() returns true only for inline builders.
excludeFromRegularBuild
Section titled “excludeFromRegularBuild”public boolean excludeFromRegularBuild()Delegates to builder.excludeFromRegularBuilding().
Related Types
Section titled “Related Types”- BuilderObjectHelper — parent class
- BuilderObjectStaticHelper — variant that forbids references
- BuilderModifier — applied during reference resolution
- InternalReferenceResolver — resolves local references
- BuilderFactory — creates inline builders