mirror of
https://github.com/GTNewHorizons/StructureLib.git
synced 2026-11-17 02:45:11 +00:00
Add option to related to hologram projection
Also made clear what's public api and what's not.
This commit is contained in:
1 parent
c4eb372cfb
commit
68c5436496
19 files changed
+457
-75
No files matched your search
@@ -0,0 +1,44 @@
|
||||
package com.gtnewhorizon.structurelib;
|
||||
|
||||
import net.minecraftforge.common.config.Configuration;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.Arrays;
|
||||
import java.util.Objects;
|
||||
|
||||
enum ConfigurationVersion {
|
||||
V1 {
|
||||
@Override
|
||||
protected void step(Configuration c) {
|
||||
}
|
||||
};
|
||||
|
||||
private static final ConfigurationVersion[] VALUES = values();
|
||||
|
||||
private final String versionMarker;
|
||||
|
||||
ConfigurationVersion() {
|
||||
this.versionMarker = name();
|
||||
}
|
||||
|
||||
public static void migrateToLatest(Configuration c) {
|
||||
for (int i = identify(c).ordinal() + 1; i < VALUES.length; i++) {
|
||||
VALUES[i].step(c);
|
||||
}
|
||||
}
|
||||
|
||||
public static ConfigurationVersion latest() {
|
||||
return VALUES[VALUES.length - 1];
|
||||
}
|
||||
|
||||
public static ConfigurationVersion identify(Configuration c) {
|
||||
return Arrays.stream(VALUES).filter(v -> Objects.equals(c.getLoadedConfigVersion(), v.getVersionMarker())).findFirst().orElse(V1);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public String getVersionMarker() {
|
||||
return versionMarker;
|
||||
}
|
||||
|
||||
protected abstract void step(Configuration c);
|
||||
}
|
||||
Reference in new issue
Block a user