diff --git a/src/main/java/ru/betterend/config/IdConfig.java b/src/main/java/ru/betterend/config/IdConfig.java index 94ebfc80..5dfb6c58 100644 --- a/src/main/java/ru/betterend/config/IdConfig.java +++ b/src/main/java/ru/betterend/config/IdConfig.java @@ -3,8 +3,13 @@ package ru.betterend.config; import java.util.function.BiFunction; import org.jetbrains.annotations.Nullable; import net.minecraft.util.Identifier; +import ru.betterend.config.ConfigKeeper.BooleanEntry; import ru.betterend.config.ConfigKeeper.Entry; -import ru.betterend.config.ConfigKeeper.RangeEntry; +import ru.betterend.config.ConfigKeeper.FloatEntry; +import ru.betterend.config.ConfigKeeper.FloatRange; +import ru.betterend.config.ConfigKeeper.IntegerEntry; +import ru.betterend.config.ConfigKeeper.IntegerRange; +import ru.betterend.config.ConfigKeeper.StringEntry; public class IdConfig extends Config { @@ -22,6 +27,26 @@ public class IdConfig extends Config { return this.keyFactory.apply(id, key); } + @Nullable + public IntegerEntry getIntEntry(Identifier id, String key) { + return this.getEntry(createKey(id, key), IntegerEntry.class); + } + + @Nullable + public FloatEntry getFloatEntry(Identifier id, String key) { + return this.getEntry(createKey(id, key), FloatEntry.class); + } + + @Nullable + public BooleanEntry getBoolEntry(Identifier id, String key) { + return this.getEntry(createKey(id, key), BooleanEntry.class); + } + + @Nullable + public StringEntry getStringEntry(Identifier id, String key) { + return this.getEntry(createKey(id, key), StringEntry.class); + } + @Nullable public > E getEntry(Identifier id, String key, Class type) { return this.getEntry(createKey(id, key), type); @@ -56,8 +81,12 @@ public class IdConfig extends Config { return this.setInt(createKey(id, key), value); } - public , RE extends RangeEntry> boolean setRanged(Identifier id, String key, T value, Class type) { - return this.setRanged(createKey(id, key), value, type); + public boolean setRangedInt(Identifier id, String key, int value) { + return this.setRanged(createKey(id, key), value, IntegerRange.class); + } + + public boolean setRangedFloat(Identifier id, String key, float value) { + return this.setRanged(createKey(id, key), value, FloatRange.class); } public float getFloat(Identifier id, String key, float defaultValue) {