Rename SimplyCompatExpectPlatform to SimplyCompatPlatform and update references
This commit is contained in:
parent
b614dc85a3
commit
877d5a2fec
8 changed files with 303 additions and 303 deletions
|
@ -1,19 +0,0 @@
|
||||||
package cc.toph.simplycompat;
|
|
||||||
|
|
||||||
import dev.architectury.injectables.annotations.ExpectPlatform;
|
|
||||||
import java.nio.file.Path;
|
|
||||||
|
|
||||||
public class SimplyCompatExpectPlatform {
|
|
||||||
|
|
||||||
@ExpectPlatform
|
|
||||||
public static Path getConfigDirectory() {
|
|
||||||
// Content will be replaced by platform (forge,fabric) implementation at runtime.
|
|
||||||
throw new AssertionError("This should never run");
|
|
||||||
}
|
|
||||||
|
|
||||||
@ExpectPlatform
|
|
||||||
public static String getVersion() {
|
|
||||||
// Content will be replaced by platform (forge,fabric) implementation at runtime.
|
|
||||||
throw new AssertionError("This should never run");
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -0,0 +1,20 @@
|
||||||
|
package cc.toph.simplycompat;
|
||||||
|
|
||||||
|
import dev.architectury.injectables.annotations.ExpectPlatform;
|
||||||
|
|
||||||
|
import java.nio.file.Path;
|
||||||
|
|
||||||
|
public class SimplyCompatPlatform {
|
||||||
|
|
||||||
|
@ExpectPlatform
|
||||||
|
public static Path getConfigDirectory() {
|
||||||
|
// Content will be replaced by platform (forge,fabric) implementation at runtime.
|
||||||
|
throw new AssertionError("This should never run");
|
||||||
|
}
|
||||||
|
|
||||||
|
@ExpectPlatform
|
||||||
|
public static String getVersion() {
|
||||||
|
// Content will be replaced by platform (forge,fabric) implementation at runtime.
|
||||||
|
throw new AssertionError("This should never run");
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,6 +1,6 @@
|
||||||
package cc.toph.simplycompat.config;
|
package cc.toph.simplycompat.config;
|
||||||
|
|
||||||
import cc.toph.simplycompat.SimplyCompatExpectPlatform;
|
import cc.toph.simplycompat.SimplyCompatPlatform;
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
|
||||||
|
@ -11,7 +11,7 @@ public class ConfigProvider implements SimpleConfig.DefaultConfig {
|
||||||
## Simply Compat Config
|
## Simply Compat Config
|
||||||
## Version: %s
|
## Version: %s
|
||||||
|
|
||||||
""", SimplyCompatExpectPlatform.getVersion());
|
""", SimplyCompatPlatform.getVersion());
|
||||||
|
|
||||||
public ConfigProvider(String namespace) {
|
public ConfigProvider(String namespace) {
|
||||||
this.namespace = namespace;
|
this.namespace = namespace;
|
||||||
|
|
|
@ -22,7 +22,7 @@ package cc.toph.simplycompat.config;
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import cc.toph.simplycompat.SimplyCompat;
|
import cc.toph.simplycompat.SimplyCompat;
|
||||||
import cc.toph.simplycompat.SimplyCompatExpectPlatform;
|
import cc.toph.simplycompat.SimplyCompatPlatform;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
@ -82,7 +82,7 @@ public class SimpleConfig {
|
||||||
// File
|
// File
|
||||||
// Path path = SimplyCompatExpectPlatform.getConfigDirectory().resolve(filename + FILE_EXTENSION);
|
// Path path = SimplyCompatExpectPlatform.getConfigDirectory().resolve(filename + FILE_EXTENSION);
|
||||||
// Folder
|
// Folder
|
||||||
Path path = SimplyCompatExpectPlatform.getConfigDirectory().resolve(String.format("%s/%s%s", SimplyCompat.MOD_ID, filename, FILE_EXTENSION));
|
Path path = SimplyCompatPlatform.getConfigDirectory().resolve(String.format("%s/%s%s", SimplyCompat.MOD_ID, filename, FILE_EXTENSION));
|
||||||
return new ConfigRequest(path.toFile(), filename);
|
return new ConfigRequest(path.toFile(), filename);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,25 +0,0 @@
|
||||||
package cc.toph.simplycompat.fabric;
|
|
||||||
|
|
||||||
import cc.toph.simplycompat.SimplyCompat;
|
|
||||||
import cc.toph.simplycompat.SimplyCompatExpectPlatform;
|
|
||||||
import net.fabricmc.loader.api.FabricLoader;
|
|
||||||
|
|
||||||
import java.nio.file.Path;
|
|
||||||
|
|
||||||
public class SimplyCompatExpectPlatformImpl {
|
|
||||||
/**
|
|
||||||
* Implementation of {@link SimplyCompatExpectPlatform#getConfigDirectory()}.
|
|
||||||
*/
|
|
||||||
public static Path getConfigDirectory() {
|
|
||||||
return FabricLoader.getInstance().getConfigDir();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Implementation of {@link SimplyCompatExpectPlatform#getConfigDirectory()}.
|
|
||||||
*/
|
|
||||||
public static String getVersion() {
|
|
||||||
return FabricLoader.getInstance().getModContainer(SimplyCompat.MOD_ID).get().getMetadata().getVersion().toString();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
|
@ -0,0 +1,25 @@
|
||||||
|
package cc.toph.simplycompat.fabric;
|
||||||
|
|
||||||
|
import cc.toph.simplycompat.SimplyCompat;
|
||||||
|
import cc.toph.simplycompat.SimplyCompatPlatform;
|
||||||
|
import net.fabricmc.loader.api.FabricLoader;
|
||||||
|
|
||||||
|
import java.nio.file.Path;
|
||||||
|
|
||||||
|
public class SimplyCompatPlatformImpl {
|
||||||
|
/**
|
||||||
|
* Implementation of {@link SimplyCompatPlatform#getConfigDirectory()}.
|
||||||
|
*/
|
||||||
|
public static Path getConfigDirectory() {
|
||||||
|
return FabricLoader.getInstance().getConfigDir();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Implementation of {@link SimplyCompatPlatform#getConfigDirectory()}.
|
||||||
|
*/
|
||||||
|
public static String getVersion() {
|
||||||
|
return FabricLoader.getInstance().getModContainer(SimplyCompat.MOD_ID).get().getMetadata().getVersion().toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -1,27 +0,0 @@
|
||||||
package cc.toph.simplycompat.forge;
|
|
||||||
|
|
||||||
import cc.toph.simplycompat.SimplyCompat;
|
|
||||||
import cc.toph.simplycompat.SimplyCompatExpectPlatform;
|
|
||||||
import net.minecraftforge.fml.ModList;
|
|
||||||
import net.minecraftforge.fml.loading.FMLPaths;
|
|
||||||
|
|
||||||
import java.nio.file.Path;
|
|
||||||
|
|
||||||
public class SimplyCompatExpectPlatformImpl {
|
|
||||||
/**
|
|
||||||
* Implementation of {@link SimplyCompatExpectPlatform#getConfigDirectory()}.
|
|
||||||
*/
|
|
||||||
public static Path getConfigDirectory() {
|
|
||||||
return FMLPaths.CONFIGDIR.get();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Implementation of {@link SimplyCompatExpectPlatform#getConfigDirectory()}.
|
|
||||||
*/
|
|
||||||
public static String getVersion() {
|
|
||||||
return ModList.get().getModContainerById(SimplyCompat.MOD_ID).map(it -> it.getModInfo().getVersion().toString()).orElseThrow();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
|
@ -0,0 +1,26 @@
|
||||||
|
package cc.toph.simplycompat.forge;
|
||||||
|
|
||||||
|
import cc.toph.simplycompat.SimplyCompat;
|
||||||
|
import cc.toph.simplycompat.SimplyCompatPlatform;
|
||||||
|
import net.minecraftforge.fml.ModList;
|
||||||
|
import net.minecraftforge.fml.loading.FMLPaths;
|
||||||
|
|
||||||
|
import java.nio.file.Path;
|
||||||
|
|
||||||
|
public class SimplyCompatPlatformImpl {
|
||||||
|
/**
|
||||||
|
* Implementation of {@link SimplyCompatPlatform#getConfigDirectory()}.
|
||||||
|
*/
|
||||||
|
public static Path getConfigDirectory() {
|
||||||
|
return FMLPaths.CONFIGDIR.get();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Implementation of {@link SimplyCompatPlatform#getConfigDirectory()}.
|
||||||
|
*/
|
||||||
|
public static String getVersion() {
|
||||||
|
return ModList.get().getModContainerById(SimplyCompat.MOD_ID).map(it -> it.getModInfo().getVersion().toString()).orElseThrow();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
Loading…
Add table
Reference in a new issue