fix
This commit is contained in:
parent
1047d4ade9
commit
5da14fcb3f
@ -28,7 +28,6 @@ import net.minecraft.util.text.ITextComponent;
|
|||||||
|
|
||||||
import java.awt.*;
|
import java.awt.*;
|
||||||
import java.lang.reflect.Field;
|
import java.lang.reflect.Field;
|
||||||
import java.lang.reflect.Parameter;
|
|
||||||
import java.lang.reflect.ParameterizedType;
|
import java.lang.reflect.ParameterizedType;
|
||||||
import java.lang.reflect.Type;
|
import java.lang.reflect.Type;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
@ -30,7 +30,8 @@ import java.lang.reflect.ParameterizedType;
|
|||||||
import java.lang.reflect.Type;
|
import java.lang.reflect.Type;
|
||||||
import java.nio.file.Files;
|
import java.nio.file.Files;
|
||||||
import java.nio.file.Path;
|
import java.nio.file.Path;
|
||||||
import java.util.*;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.function.Consumer;
|
import java.util.function.Consumer;
|
||||||
import java.util.function.Function;
|
import java.util.function.Function;
|
||||||
@ -131,7 +132,7 @@ public class SettingsUtil {
|
|||||||
throw new IllegalStateException("No setting by that name");
|
throw new IllegalStateException("No setting by that name");
|
||||||
}
|
}
|
||||||
Class intendedType = setting.getValueClass();
|
Class intendedType = setting.getValueClass();
|
||||||
Parser ioMethod = Parser.getParser(setting.getType());
|
ISettingParser ioMethod = Parser.getParser(setting.getType());
|
||||||
Object parsed = ioMethod.parse(new ParserContext(setting), settingValue);
|
Object parsed = ioMethod.parse(new ParserContext(setting), settingValue);
|
||||||
if (!intendedType.isInstance(parsed)) {
|
if (!intendedType.isInstance(parsed)) {
|
||||||
throw new IllegalStateException(ioMethod + " parser returned incorrect type, expected " + intendedType + " got " + parsed + " which is " + parsed.getClass());
|
throw new IllegalStateException(ioMethod + " parser returned incorrect type, expected " + intendedType + " got " + parsed + " which is " + parsed.getClass());
|
||||||
@ -176,16 +177,15 @@ public class SettingsUtil {
|
|||||||
),
|
),
|
||||||
BLOCK(
|
BLOCK(
|
||||||
Block.class,
|
Block.class,
|
||||||
BlockUtils::stringToBlockRequired,
|
str -> BlockUtils.stringToBlockRequired(str.trim()),
|
||||||
BlockUtils::blockToString
|
BlockUtils::blockToString
|
||||||
),
|
),
|
||||||
ITEM(
|
ITEM(
|
||||||
Item.class,
|
Item.class,
|
||||||
Item::getByNameOrId,
|
str -> Item.getByNameOrId(str.trim()),
|
||||||
item -> Item.REGISTRY.getNameForObject(item).toString()
|
item -> Item.REGISTRY.getNameForObject(item).toString()
|
||||||
),
|
),
|
||||||
LIST() {
|
LIST() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Object parse(ParserContext context, String raw) {
|
public Object parse(ParserContext context, String raw) {
|
||||||
Type type = ((ParameterizedType) context.getSetting().getType()).getActualTypeArguments()[0];
|
Type type = ((ParameterizedType) context.getSetting().getType()).getActualTypeArguments()[0];
|
||||||
|
Loading…
Reference in New Issue
Block a user