From 23ae134a980697270e980c72c483043313f74d9a Mon Sep 17 00:00:00 2001 From: BlayTheNinth <1933180+BlayTheNinth@users.noreply.github.com> Date: Mon, 18 Mar 2024 10:12:31 +0100 Subject: [PATCH] fix: Fix Balm not accepting integers for float config properties https://github.com/TwelveIterationMods/Waystones/issues/816 --- .../net/blay09/mods/balm/forge/config/ForgeBalmConfig.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/forge/src/main/java/net/blay09/mods/balm/forge/config/ForgeBalmConfig.java b/forge/src/main/java/net/blay09/mods/balm/forge/config/ForgeBalmConfig.java index bd853bec..b8cb0196 100644 --- a/forge/src/main/java/net/blay09/mods/balm/forge/config/ForgeBalmConfig.java +++ b/forge/src/main/java/net/blay09/mods/balm/forge/config/ForgeBalmConfig.java @@ -114,6 +114,8 @@ private void readConfigValues(String parentPath, T instance, ModConfig confi field.set(instance, doubleValue.floatValue()); } else if (value instanceof Float floatValue) { field.set(instance, floatValue); + } else if (value instanceof Integer integerValue) { + field.set(instance, integerValue.floatValue()); } else { logger.error("Invalid config value for " + path + ", expected " + type.getName() + " but got " + value.getClass()); } @@ -123,6 +125,8 @@ private void readConfigValues(String parentPath, T instance, ModConfig confi field.set(instance, doubleValue); } else if (value instanceof Float floatValue) { field.set(instance, floatValue.doubleValue()); + } else if (value instanceof Integer integerValue) { + field.set(instance, integerValue.doubleValue()); } else { logger.error("Invalid config value for " + path + ", expected " + type.getName() + " but got " + value.getClass()); }