Fix config comments referencing disallowed enum values. (#6542)

This commit is contained in:
ichttt authored and GitHub committed 2020-05-03 12:56:47 -07:00
1 parent 0fc1ea01d1
commit f2216f4e25
1 file changed
+1 -1
@@ -404,7 +404,7 @@ public class ForgeConfigSpec extends UnmodifiableConfigWrapper<UnmodifiableConfi
public <V extends Enum<V>> EnumValue<V> defineEnum(List<String> path, Supplier<V> defaultSupplier, EnumGetMethod converter, Predicate<Object> validator, Class<V> clazz) {
context.setClazz(clazz);
V[] allowedValues = clazz.getEnumConstants();
context.setComment(ObjectArrays.concat(context.getComment(), "Allowed Values: " + Arrays.stream(allowedValues).map(Enum::name).collect(Collectors.joining(", "))));
context.setComment(ObjectArrays.concat(context.getComment(), "Allowed Values: " + Arrays.stream(allowedValues).filter(validator).map(Enum::name).collect(Collectors.joining(", "))));
return new EnumValue<V>(this, define(path, new ValueSpec(defaultSupplier, validator, context), defaultSupplier).getPath(), defaultSupplier, converter, clazz);
}