mirror of
https://github.com/AutismDevelopment/Autism-Client.git
synced 2026-10-28 22:59:46 +00:00
Release the tag update
This commit is contained in:
commit
9e00f40996
977 changed files with 219163 additions and 0 deletions
|
|
@ -0,0 +1,67 @@
|
|||
package autismclient.api.module;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public final class RegistryListSetting extends ListSetting<RegistryListSetting> {
|
||||
private RegistryListSetting(Kind kind, String name, String title, String defaultValue) {
|
||||
super(registryKindOrDefault(kind), name, title, parseDefault(defaultValue));
|
||||
}
|
||||
|
||||
public static RegistryListSetting items(String name, String title) {
|
||||
return items(name, title, "");
|
||||
}
|
||||
|
||||
public static RegistryListSetting items(String name, String title, String defaultValue) {
|
||||
return new RegistryListSetting(Kind.ITEM_LIST, name, title, defaultValue);
|
||||
}
|
||||
|
||||
public static RegistryListSetting blocks(String name, String title) {
|
||||
return blocks(name, title, "");
|
||||
}
|
||||
|
||||
public static RegistryListSetting blocks(String name, String title, String defaultValue) {
|
||||
return new RegistryListSetting(Kind.BLOCK_LIST, name, title, defaultValue);
|
||||
}
|
||||
|
||||
public static RegistryListSetting entityTypes(String name, String title) {
|
||||
return entityTypes(name, title, "");
|
||||
}
|
||||
|
||||
public static RegistryListSetting entityTypes(String name, String title, String defaultValue) {
|
||||
return new RegistryListSetting(Kind.ENTITY_TYPE_LIST, name, title, defaultValue);
|
||||
}
|
||||
|
||||
public static RegistryListSetting soundEvents(String name, String title) {
|
||||
return soundEvents(name, title, "");
|
||||
}
|
||||
|
||||
public static RegistryListSetting soundEvents(String name, String title, String defaultValue) {
|
||||
return new RegistryListSetting(Kind.SOUND_EVENT_LIST, name, title, defaultValue);
|
||||
}
|
||||
|
||||
public static RegistryListSetting storages(String name, String title) {
|
||||
return storages(name, title, "");
|
||||
}
|
||||
|
||||
public static RegistryListSetting storages(String name, String title, String defaultValue) {
|
||||
return new RegistryListSetting(Kind.STORAGE_LIST, name, title, defaultValue);
|
||||
}
|
||||
|
||||
private static List<String> parseDefault(String raw) {
|
||||
if (raw == null || raw.isBlank()) return List.of();
|
||||
List<String> out = new ArrayList<>();
|
||||
for (String part : raw.split("\\|")) {
|
||||
String trimmed = part.trim();
|
||||
if (!trimmed.isEmpty()) out.add(trimmed);
|
||||
}
|
||||
return List.copyOf(out);
|
||||
}
|
||||
|
||||
private static Kind registryKindOrDefault(Kind kind) {
|
||||
return switch (kind == null ? Kind.ITEM_LIST : kind) {
|
||||
case ITEM_LIST, BLOCK_LIST, ENTITY_TYPE_LIST, SOUND_EVENT_LIST, STORAGE_LIST -> kind;
|
||||
default -> Kind.ITEM_LIST;
|
||||
};
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue