Compare commits

..

No commits in common. "71eb10a2a06793aba541f5311bfeecc91f98e621" and "6dcd99c12a61e15db25d6785166ae874784fd9f1" have entirely different histories.

3 changed files with 21 additions and 9 deletions

View file

@ -1,7 +1,3 @@
# v1.2.4.5
* bumped OtterLib version to `0.2.1.0`
* fixed default languages files not being able to be loaded
# v1.2.4.4 # v1.2.4.4
* bumped OtterLib version to `0.2.0.0` * bumped OtterLib version to `0.2.0.0`
* now relies on OtterLib Language Reader * now relies on OtterLib Language Reader

View file

@ -13,12 +13,12 @@ yarn_mappings=1.21.6+build.1
loader_version=0.16.14 loader_version=0.16.14
# Mod Properties # Mod Properties
mod_version=1.2.4.5+1.21.6 mod_version=1.2.4.4+1.21.6
maven_group=one.oth3r maven_group=one.oth3r
file_name=sit! file_name=sit!
# Dependencies # Dependencies
fabric_version=0.127.1+1.21.6 fabric_version=0.127.1+1.21.6
modmenu_version=15.0.0-beta.1 modmenu_version=15.0.0-beta.1
otterlib_version=0.2.1.0+1.21.6-fabric otterlib_version=0.2.0.0+1.21.6-fabric
otterlib_max_version=0.3.0.0+1.21.6-fabric otterlib_max_version=0.3.0.0+1.21.6-fabric

View file

@ -2,11 +2,14 @@ package one.oth3r.sit.file;
import net.minecraft.server.network.ServerPlayerEntity; import net.minecraft.server.network.ServerPlayerEntity;
import one.oth3r.otterlib.file.LanguageReader; import one.oth3r.otterlib.file.LanguageReader;
import one.oth3r.otterlib.file.ResourceReader;
import one.oth3r.sit.Sit; import one.oth3r.sit.Sit;
import one.oth3r.sit.utl.Data; import one.oth3r.sit.utl.Data;
import one.oth3r.sit.utl.Utl; import one.oth3r.sit.utl.Utl;
import java.net.URISyntaxException;
import java.net.URL;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.HashMap; import java.util.HashMap;
@ -61,8 +64,7 @@ public class FileData {
/// the language / text system for the mod /// the language / text system for the mod
private static final LanguageReader langReader = new LanguageReader( private static final LanguageReader langReader = new LanguageReader(
new ResourceReader("assets/sit-oth3r/lang/",Sit.class.getClassLoader()), getLangPath(),Path.of(Data.CONFIG_DIR),"en_us","en_us");
new ResourceReader(Data.CONFIG_DIR),"en_us","en_us");
public static LanguageReader getLangReader() { public static LanguageReader getLangReader() {
return langReader; return langReader;
@ -91,6 +93,20 @@ public class FileData {
getServerConfig().save(); getServerConfig().save();
} }
private static Path getLangPath() {
ClassLoader classLoader = Sit.class.getClassLoader();
URL resource = classLoader.getResource("assets/sit-oth3r/lang/");
if (resource == null) {
throw new RuntimeException("Language file not found.");
}
try {
return Paths.get(resource.toURI());
} catch (URISyntaxException e) {
throw new RuntimeException(e);
}
}
public static class Defaults { public static class Defaults {
public static final ArrayList<SittingBlock> SITTING_BLOCKS = new ArrayList<>(Arrays.asList( public static final ArrayList<SittingBlock> SITTING_BLOCKS = new ArrayList<>(Arrays.asList(
new SittingBlock(new ArrayList<>(),new ArrayList<>(Arrays.asList("#minecraft:campfires")), new ArrayList<>(Arrays.asList("lit=false")),.437), new SittingBlock(new ArrayList<>(),new ArrayList<>(Arrays.asList("#minecraft:campfires")), new ArrayList<>(Arrays.asList("lit=false")),.437),