-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
18 changed files
with
157 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
56 changes: 56 additions & 0 deletions
56
common/src/main/java/top/vmctcn/vmtranslationupdate/modpack/ModpackInfo.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
package top.vmctcn.vmtranslationupdate.modpack; | ||
|
||
public class ModpackInfo { | ||
private Modpack modpack; | ||
|
||
public Modpack getModpack() { | ||
return modpack; | ||
} | ||
|
||
public static class Modpack { | ||
private String name; | ||
private String version; | ||
private Translation translation; | ||
|
||
public String getName() { | ||
return name; | ||
} | ||
|
||
public String getVersion() { | ||
return version; | ||
} | ||
|
||
public Translation getTranslation() { | ||
return translation; | ||
} | ||
} | ||
|
||
public static class Translation { | ||
private String url; | ||
private String language; | ||
private String version; | ||
private String updateCheckUrl; | ||
private String resourcePackName; | ||
|
||
public String getUrl() { | ||
return url; | ||
} | ||
|
||
public String getLanguage() { | ||
return language; | ||
} | ||
|
||
public String getVersion() { | ||
return version; | ||
} | ||
|
||
public String getUpdateCheckUrl() { | ||
return updateCheckUrl; | ||
} | ||
|
||
public String getResourcePackName() { | ||
return resourcePackName; | ||
} | ||
} | ||
} | ||
|
31 changes: 31 additions & 0 deletions
31
common/src/main/java/top/vmctcn/vmtranslationupdate/modpack/ModpackInfoReader.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
package top.vmctcn.vmtranslationupdate.modpack; | ||
|
||
import com.google.gson.Gson; | ||
import top.vmctcn.vmtranslationupdate.VMTranslationUpdate; | ||
import top.vmctcn.vmtucore.ModPlatform; | ||
|
||
import java.io.FileReader; | ||
import java.io.Reader; | ||
import java.nio.file.Path; | ||
|
||
public class ModpackInfoReader { | ||
private static final Gson GSON = new Gson(); | ||
private static ModpackInfo modpackInfo; | ||
private static final Path gamePath = ModPlatform.INSTANCE.getGameDir(); | ||
|
||
static { | ||
init(); | ||
} | ||
|
||
public static void init() { | ||
try (Reader reader = new FileReader(gamePath.resolve("modpackinfo.json").toString())) { | ||
modpackInfo = GSON.fromJson(reader, ModpackInfo.class); | ||
} catch (Exception e) { | ||
VMTranslationUpdate.LOGGER.warn("Error getting index: " + e); | ||
} | ||
} | ||
|
||
public static ModpackInfo getModpackInfo() { | ||
return modpackInfo; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...nslationupdate/verlayer/ScreenHelper.java → ...ranslationupdate/screen/ScreenHelper.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 13 additions & 0 deletions
13
neoforge/src/main/java/top/vmctcn/vmtranslationupdate/neoforge/NeoHelper.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
package top.vmctcn.vmtranslationupdate.neoforge; | ||
|
||
import net.minecraft.client.gui.screen.Screen; | ||
import net.neoforged.fml.ModContainer; | ||
import net.neoforged.neoforge.client.gui.IConfigScreenFactory; | ||
|
||
import java.util.function.Function; | ||
|
||
public class NeoHelper { | ||
public static void registerConfigScreen(ModContainer modContainer, Function<Screen, Screen> screenFunction) { | ||
modContainer.registerExtensionPoint(IConfigScreenFactory.class, (client, screen) -> screenFunction.apply(screen)); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters