Babbaj doesn't know how to convert imperative shitcode into a regex

and leijurv doesn't know how to verify that the regex reflects the original behavior
im literally raging
This commit is contained in:
Brady 2019-04-20 17:26:41 -05:00
parent 0b8fa3ffe3
commit 1047d4ade9
No known key found for this signature in database
GPG Key ID: 73A788379A197567

View File

@ -43,7 +43,7 @@ import static net.minecraft.client.Minecraft.getMinecraft;
public class SettingsUtil { public class SettingsUtil {
private static final Path SETTINGS_PATH = getMinecraft().gameDir.toPath().resolve("baritone").resolve("settings.txt"); private static final Path SETTINGS_PATH = getMinecraft().gameDir.toPath().resolve("baritone").resolve("settings.txt");
private static final Pattern SETTING_PATTERN = Pattern.compile("^(?<setting>[^ ]+) +(?<value>[^ ]+)"); // 2 words separated by spaces private static final Pattern SETTING_PATTERN = Pattern.compile("^(?<setting>[^ ]+) +(?<value>.+)"); // key and value split by the first space
private static boolean isComment(String line) { private static boolean isComment(String line) {
return line.startsWith("#") || line.startsWith("//"); return line.startsWith("#") || line.startsWith("//");
@ -176,12 +176,12 @@ public class SettingsUtil {
), ),
BLOCK( BLOCK(
Block.class, Block.class,
str -> BlockUtils.stringToBlockRequired(str.trim()), BlockUtils::stringToBlockRequired,
BlockUtils::blockToString BlockUtils::blockToString
), ),
ITEM( ITEM(
Item.class, Item.class,
str -> Item.getByNameOrId(str.trim()), Item::getByNameOrId,
item -> Item.REGISTRY.getNameForObject(item).toString() item -> Item.REGISTRY.getNameForObject(item).toString()
), ),
LIST() { LIST() {