Skip to content

BuilderObjectMapHelper

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

public class BuilderObjectMapHelper<K, V> extends BuilderObjectArrayHelper<Map<K, V>, V>

Reads a JSON array of builder objects and produces a Map<K, V> at build time. Each element is built, and a key is extracted from the built value using a provided Function<V, K>. Throws if duplicate keys are encountered.

ParameterDescription
KThe map key type.
VThe map value type (also the builder element type).
public BuilderObjectMapHelper(Class classType, Function<V, K> id, BuilderContext owner)
@Nullable
public Map<K, V> build(@Nonnull BuilderSupport builderSupport)

Builds each non-excluded element, extracts a key via the id function, and inserts into an ordered map. Throws IllegalArgumentException on duplicate keys.

@Nullable
public <T, U> T testEach(@Nonnull BiFunction<Builder<V>, U, T> test, @Nonnull BuilderManager builderManager, ExecutionContext executionContext, U meta, T successResult, T emptyResult, Builder<?> parentSpawnable)

Iterates over elements, applying a test function to each resolved builder. Returns the first non-success result, or the success result if all pass.

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