Class NBTMapNormalizer
java.lang.Object
io.github.projectunified.craftitem.nbt.NBTMapNormalizer
Normalizes maps and converts them to the right types for SNBT.
Recursively converts map and list values to properly typed values. Supports custom string
translators for dynamic substitution and forced-value maps using $type and $value keys.
Example:
Map<String, Object> map = Map.of(
"$type", "float",
"$value", "123.45"
);
Object result = NBTMapNormalizer.normalize(map); // Returns 123.45f
-
Method Summary
-
Method Details
-
normalize
Normalizes a value by resolving forced-value maps and applying translator- Parameters:
value- The value to normalize- Returns:
- Normalized value (can be a Map, primitive, or array)
- Throws:
IllegalArgumentException- if forced-value map is invalid
-
normalize
Normalizes a value by resolving forced-value maps and applying translator- Parameters:
value- The value to normalizetranslator- Custom string translator for values- Returns:
- Normalized value (can be a Map, primitive, or array)
- Throws:
IllegalArgumentException- if forced-value map is invalid
-