Configs
This commit is contained in:
parent
fedabca931
commit
5fdc1d8b93
4 changed files with 26 additions and 14 deletions
10
src/main/java/ru/betterend/config/CategoryConfig.java
Normal file
10
src/main/java/ru/betterend/config/CategoryConfig.java
Normal file
|
@ -0,0 +1,10 @@
|
|||
package ru.betterend.config;
|
||||
|
||||
public class CategoryConfig extends IdConfig {
|
||||
|
||||
public CategoryConfig(String group) {
|
||||
super(group, (id, category) -> {
|
||||
return new ConfigKey(id.getNamespace(), category, id.getPath());
|
||||
});
|
||||
}
|
||||
}
|
|
@ -1,18 +1,10 @@
|
|||
package ru.betterend.config;
|
||||
|
||||
public class Configs {
|
||||
public static final IdConfig ITEM_CONFIG = new IdConfig("items", (itemId, category) -> {
|
||||
return new ConfigKey(itemId.getNamespace(), category, itemId.getPath());
|
||||
});
|
||||
public static final IdConfig BLOCK_CONFIG = new IdConfig("blocks", (blockId, category) -> {
|
||||
return new ConfigKey(blockId.getNamespace(), category, blockId.getPath());
|
||||
});
|
||||
public static final IdConfig BIOME_CONFIG = new IdConfig("biomes", (biomeId, entry) -> {
|
||||
return new ConfigKey(biomeId.getNamespace(), biomeId.getPath(), entry);
|
||||
});
|
||||
public static final IdConfig ENTITY_CONFIG = new IdConfig("entities", (entityId, category) -> {
|
||||
return new ConfigKey(entityId.getNamespace(), category, entityId.getPath());
|
||||
});
|
||||
public static final IdConfig ITEM_CONFIG = new CategoryConfig("items");
|
||||
public static final IdConfig BLOCK_CONFIG = new CategoryConfig("blocks");
|
||||
public static final IdConfig ENTITY_CONFIG = new CategoryConfig("entities");
|
||||
public static final IdConfig BIOME_CONFIG = new EntryConfig("biomes");
|
||||
public static final SimpleConfig GENERATOR_CONFIG = new SimpleConfig("generator");
|
||||
|
||||
public static void saveConfigs() {
|
||||
|
|
10
src/main/java/ru/betterend/config/EntryConfig.java
Normal file
10
src/main/java/ru/betterend/config/EntryConfig.java
Normal file
|
@ -0,0 +1,10 @@
|
|||
package ru.betterend.config;
|
||||
|
||||
public class EntryConfig extends IdConfig {
|
||||
|
||||
public EntryConfig(String group) {
|
||||
super(group, (id, entry) -> {
|
||||
return new ConfigKey(id.getNamespace(), id.getPath(), entry);
|
||||
});
|
||||
}
|
||||
}
|
|
@ -11,7 +11,7 @@ import ru.betterend.config.ConfigKeeper.IntegerRange;
|
|||
|
||||
public class IdConfig extends Config {
|
||||
|
||||
private final BiFunction<Identifier, String, ConfigKey> keyFactory;
|
||||
protected final BiFunction<Identifier, String, ConfigKey> keyFactory;
|
||||
|
||||
public IdConfig(String group, BiFunction<Identifier, String, ConfigKey> keyFactory) {
|
||||
super(group);
|
||||
|
@ -21,7 +21,7 @@ public class IdConfig extends Config {
|
|||
@Override
|
||||
protected void registerEntries() {}
|
||||
|
||||
private ConfigKey createKey(Identifier id, String key) {
|
||||
protected ConfigKey createKey(Identifier id, String key) {
|
||||
return this.keyFactory.apply(id, key);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue