Skip to content

BuilderCodecObjectHelper

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

public class BuilderCodecObjectHelper<T>

A helper class that reads a JSON element into a typed value using a Codec<T> and optionally validates it. Used by builders that embed codec-decoded configuration objects (such as combat configs and interaction variables).

ParameterDescription
TThe decoded value type.
FieldTypeDescription
codecCodec<T>The codec used to decode JSON to BSON to the target type.
classTypeClass<?>The class of the decoded type.
validatorValidator<T>Optional codec-level validator.
valueTThe decoded value, or null if not yet read.
public BuilderCodecObjectHelper(Class<?> classType, Codec<T> codec, Validator<T> validator)
@Nullable
public T build()

Returns the decoded value.

public void readConfig(@Nonnull JsonElement data, @Nonnull ExtraInfo extraInfo)

Decodes the JSON element via the codec (translating JSON to BSON first), runs the validator if present, and processes validation results.

public boolean hasValue()

Returns true if a value has been decoded.

public Class<?> getClassType()

Returns the class type.

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