|
@@ -12,8 +12,6 @@ import org.spongepowered.configurate.serialize.TypeSerializerCollection;
|
|
|
import java.lang.reflect.Type;
|
|
|
import java.util.Map;
|
|
|
|
|
|
-import static java.util.Objects.requireNonNull;
|
|
|
-
|
|
|
public final class ClothConfigClientExtension implements ClientExtension {
|
|
|
|
|
|
@Override
|
|
@@ -27,9 +25,18 @@ public final class ClothConfigClientExtension implements ClientExtension {
|
|
|
|
|
|
@Override
|
|
|
public ModifierKeyCode deserialize(Type type, ConfigurationNode node) throws SerializationException {
|
|
|
- if(!node.isMap()) throw new SerializationException(node, type, "Node must be of type map");
|
|
|
+ if(!node.isMap()) throw new SerializationException("Node must be of type map");
|
|
|
var map = node.childrenMap();
|
|
|
- var key = InputUtil.fromTranslationKey(requireNonNull(map.get("keyCode"), "keyCode").getString());
|
|
|
+ String keyCode = map.get("keyCode").getString();
|
|
|
+ if(keyCode == null) {
|
|
|
+ throw new SerializationException("keyCode entry is missing or has invalid type");
|
|
|
+ }
|
|
|
+ InputUtil.Key key;
|
|
|
+ try {
|
|
|
+ key = InputUtil.fromTranslationKey(keyCode);
|
|
|
+ } catch(Exception e) {
|
|
|
+ throw new SerializationException(e);
|
|
|
+ }
|
|
|
if (key == InputUtil.UNKNOWN_KEY) {
|
|
|
return ModifierKeyCode.unknown();
|
|
|
}
|