Skip to content

Commit

Permalink
v1.7.1-pre.1?
Browse files Browse the repository at this point in the history
- Добавлена поддержка 23w13a_or_b, поддержка Луны
- Убран CurseForge из ссылок ModMenu
- Добавлена поддержка FastLoad
- Добавлена возможность изменять ID приложения, добавлена вариант иконок ~urls при использовании кастомного ID приложения
- Добавелны моды которые ломают работу мода
  - CraftPresence
  - Simple Discord RPC
  - Amitojs-Minecraft-RPC-Fabric
- Мелкие исправления

English
- Added support for 23w13a_or_b, support for moon
- Removed CurseForge from ModMenu links
- Added FastLoad support
- Added ability to change application ID, added option for ~urls icons when using custom application ID
- Added mods in fabric.mod.json that break mods work
  - CraftPresence
  - Simple Discord RPC
  - Amitojs-Minecraft-RPC-Fabric
- Small fixes
  • Loading branch information
Kel committed Apr 19, 2023
1 parent 103b2ba commit 49cea70
Show file tree
Hide file tree
Showing 20 changed files with 175 additions and 39 deletions.
3 changes: 2 additions & 1 deletion build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
plugins {
id 'com.github.johnrengelman.shadow' version '7.1.2'
id 'fabric-loom' version '1.0-SNAPSHOT'
id 'maven-publish'
}
Expand Down Expand Up @@ -47,6 +46,8 @@ dependencies {
modImplementation "maven.modrinth:plasmo-voice:${project.plasmovoice}"
// Support Simple Voice chat
modImplementation "maven.modrinth:simple-voice-chat:${project.svc}"
// Support Fast Load
modImplementation "maven.modrinth:fastload:${project.fastload}"
}

processResources {
Expand Down
3 changes: 2 additions & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ yarn_mappings=1.19.4+build.2
loader_version=0.14.19

# Mod Properties
mod_version=1.7.1-b3
mod_version=1.7.1-pre.1
maven_group=ru.simplykel
archives_base_name=simplystatus
# Dependencies
Expand All @@ -21,6 +21,7 @@ cloth_config=10.0.96
replaymod=1.19.4-2.6.12
plasmovoice=fabric-1.19.4-2.0.3
svc=fabric-1.19.4-2.4.4
fastload=3.3.7
# Not Minecraft Libs
JSON=20230227

Empty file modified gradlew
100644 → 100755
Empty file.
8 changes: 6 additions & 2 deletions src/main/java/ru/simplykel/simplystatus/Client.java
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ public void onInitializeClient() {
STARTED_TIME_GAME = System.currentTimeMillis() / 1000;
UserConfig.load();
Main.useAnotherID = UserConfig.USE_ANOTHER_ID;
Main.useCustomID = UserConfig.USE_CUSTOM_APP_ID;
KeyBinding openConfigKeyBind;
openConfigKeyBind = KeyBindingHelper.registerKeyBinding(new KeyBinding(
"simplystatus.key.openConfig",
Expand All @@ -86,11 +87,13 @@ public void onInitializeClient() {
}
});
ClientLifecycleEvents.CLIENT_STOPPING.register(client -> {
Client.LOG.info("Bay =-=");
Client.LOG.info(Main.prefixLog+"Bay =-=");
LIB.Discord_Shutdown();
});
if(UserConfig.USE_ANOTHER_ID) APPLICATION_ID = ModConfig.mineID;
if(UserConfig.USE_CUSTOM_APP_ID && !UserConfig.CUSTOM_APP_ID.isBlank()) APPLICATION_ID = UserConfig.CUSTOM_APP_ID;
else if(UserConfig.USE_ANOTHER_ID) APPLICATION_ID = ModConfig.mineID;
else APPLICATION_ID = ModConfig.baseID;
Main.customID = APPLICATION_ID;
HANDLERS.ready = (user) -> {
LOG.debug("The mod has been connected to Discord");
USER = user;
Expand Down Expand Up @@ -148,6 +151,7 @@ private void updatePresence(){
if(!CONNECTED_DISCORD) return;
UserConfig.load();
ASSETS = new AssetsConfig();
if(UserConfig.USE_CUSTOM_APP_ID) ASSETS = ModConfig.defaultUrlsAssets;
if(UserConfig.USE_CUSTOM_ASSETS) ASSETS.loadUserAssets();
MinecraftClient CLIENT = MinecraftClient.getInstance();
if(UserConfig.ENABLE_RPC){
Expand Down
5 changes: 4 additions & 1 deletion src/main/java/ru/simplykel/simplystatus/Main.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,19 @@

public class Main implements ModInitializer {
public static boolean isLoadingConfigs = true;
public static boolean isDevBuild = false;
public static boolean isDevBuild = true;
public static boolean configWarn = false;
public static boolean useAnotherID = false;
public static boolean useCustomID = false;
public static String customID = "";
public static String prefixLog = "[SimplyStatus] ";
public static DecimalFormat DF = new DecimalFormat("#.#");
public static boolean clothConfig = FabricLoader.getInstance().getModContainer("cloth-config").isPresent();
public static Boolean replayMod = FabricLoader.getInstance().getModContainer("replaymod").isPresent();
public static Boolean musicPlayer = FabricLoader.getInstance().getModContainer("musicplayer").isPresent();
public static Boolean svc = FabricLoader.getInstance().getModContainer("voicechat").isPresent();
public static Boolean plasmo = FabricLoader.getInstance().getModContainer("plasmovoice").isPresent();
public static Boolean fastload = FabricLoader.getInstance().getModContainer("fastload").isPresent();
public static Boolean isVoiceModsEnable = (svc || plasmo);
@Override
public void onInitialize() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,10 @@ public class AssetsConfig {
* The End
*/
public String world_the_end = "";
/**
* The End
*/
public String world_moon = "";

/**
* Music
Expand All @@ -55,7 +59,6 @@ public class AssetsConfig {
* PlasmoVoice or Simple Voice Chat
*/
public String voice = "";

/**
* Неизвестный мир
*/
Expand Down Expand Up @@ -136,6 +139,7 @@ public AssetsConfig(){
world = assets.world;
world_nether = assets.world_nether;
world_the_end = assets.world_the_end;
world_moon = assets.world_moon;

replaymod = assets.replaymod;
voice = assets.voice;
Expand Down Expand Up @@ -164,6 +168,8 @@ public AssetsConfig(JSONObject jsonAssets, boolean isLoadingResources){
else world_nether = jsonAssets.getString("world_nether");
if(jsonAssets.isNull("world_the_end")) world_the_end = nullAsset(isLoadingResources, assets.world_the_end);
else world_the_end = jsonAssets.getString("world_the_end");
if(jsonAssets.isNull("world_moon")) world_moon = nullAsset(isLoadingResources, assets.world_moon);
else world_moon = jsonAssets.getString("world_moon");

if(jsonAssets.isNull("replaymod")) replaymod = nullAsset(isLoadingResources, assets.replaymod);
else replaymod = jsonAssets.getString("replaymod");
Expand Down
7 changes: 7 additions & 0 deletions src/main/java/ru/simplykel/simplystatus/config/ModConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@ public class ModConfig {
* default иконки для GUI конфигов
*/
public static AssetsConfig defaultAssets;
/**
* default иконки для GUI конфигов с использованием ссылок
*/
public static AssetsConfig defaultUrlsAssets;
/**
*
*/
Expand Down Expand Up @@ -47,6 +51,9 @@ public ModConfig() throws Exception {
if(config.getJSONObject("assets").isNull("default")) {
throw new Exception("Не найдены стандартные иконки, который требуется для запуска мода!");
} else defaultAssets = new AssetsConfig(config.getJSONObject("assets").getJSONObject("default"), true);
if(config.getJSONObject("assets").isNull("~urls")) {
throw new Exception("Не найдены стандартные ссылки на иконки, который требуется для запуска мода!");
} else defaultUrlsAssets = new AssetsConfig(config.getJSONObject("assets").getJSONObject("~urls"), true);
if(config.isNull("assets_list")) assetsList = new String[]{"Default"};
else assetsList = jsonArrayToStringArray(config.getJSONArray("assets_list"));
MOD_CONFIG_STRING = config.toString();
Expand Down
13 changes: 12 additions & 1 deletion src/main/java/ru/simplykel/simplystatus/config/UserConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ public class UserConfig {
public static boolean SHOW_ITEMS = true;
public static boolean ENABLE_TIME_CYCLE = true;
public static boolean ENABLE_WORLD = true;
public static boolean USE_CUSTOM_APP_ID = false;
public static String CUSTOM_APP_ID = "";

/**
* Сохранение конфигурации
Expand All @@ -49,7 +51,9 @@ public static void save(){
.put("USE_ANOTHER_ID", USE_ANOTHER_ID)
.put("SHOW_ITEMS", SHOW_ITEMS)
.put("ENABLE_TIME_CYCLE", ENABLE_TIME_CYCLE)
.put("ENABLE_WORLD", ENABLE_WORLD);
.put("ENABLE_WORLD", ENABLE_WORLD)
.put("USE_CUSTOM_APP_ID", USE_CUSTOM_APP_ID)
.put("CUSTOM_APP_ID", CUSTOM_APP_ID);
try {
Files.createDirectories(configFile.getParent());
Files.writeString(configFile, jsonConfig.toString());
Expand Down Expand Up @@ -103,6 +107,13 @@ public static void load(){
if(!jsonConfig.isNull("ENABLE_WORLD")) ENABLE_WORLD = jsonConfig.getBoolean("ENABLE_WORLD");
else ENABLE_WORLD = true;


if(!jsonConfig.isNull("USE_CUSTOM_APP_ID")) USE_CUSTOM_APP_ID = jsonConfig.getBoolean("USE_CUSTOM_APP_ID");
else USE_CUSTOM_APP_ID = false;
if(!jsonConfig.isNull("CUSTOM_APP_ID")) CUSTOM_APP_ID = jsonConfig.getString("CUSTOM_APP_ID");
else CUSTOM_APP_ID = "";


} catch (Exception e){
e.printStackTrace();
save();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package ru.simplykel.simplystatus.config.gui;

import com.mojang.authlib.yggdrasil.response.User;
import me.shedaniel.clothconfig2.api.ConfigBuilder;
import net.minecraft.client.MinecraftClient;
import net.minecraft.client.gui.screen.Screen;
Expand All @@ -23,6 +24,8 @@ public static Screen buildScreen (Screen currentScreen) {
.setTransparentBackground(true)
.setSavingRunnable(ConfigScreen::save);
new MainConfigs().getCategory(builder);
new LocalizationsConfig().getCategory(builder);
if(UserConfig.USE_CUSTOM_ASSETS) new AssetsConfigs().getCategory(builder);
new AddonsConfigs().getCategory(builder);
if(!CLIENT.isInSingleplayer() && CLIENT.getCurrentServerEntry() != null) {
new ServerConfigs().getCategory(builder);
Expand All @@ -33,23 +36,35 @@ public static Screen buildScreen (Screen currentScreen) {
if(Main.musicPlayer && UserConfig.VIEW_MUSIC_LISTENER){
new MusicPlayerConfigs().getCategory(builder);
}
new AssetsConfigs().getCategory(builder);
new LocalizationsConfig().getCategory(builder);
return builder.build();
}
private static void save(){
MinecraftClient CLIENT = MinecraftClient.getInstance();
Client.LOG.info(Main.prefixLog+"Save user configs...");
UserConfig.save();
Client.ASSETS.saveUserAssets();
if(Main.useAnotherID != UserConfig.USE_ANOTHER_ID){
if((Main.useAnotherID != UserConfig.USE_ANOTHER_ID) && (!UserConfig.USE_CUSTOM_APP_ID)){
Main.useAnotherID = UserConfig.USE_ANOTHER_ID;
String APPLICATION_ID = "";
if(UserConfig.USE_ANOTHER_ID) APPLICATION_ID = ModConfig.mineID;
else APPLICATION_ID = ModConfig.baseID;

Client.LIB.Discord_Shutdown();
Client.LIB.Discord_Initialize(APPLICATION_ID, Client.HANDLERS, Client.AUTO_REGISTER, Client.STEAM_ID);
} else if(UserConfig.USE_CUSTOM_APP_ID && !Main.customID.equals(UserConfig.CUSTOM_APP_ID)){
String APPLICATION_ID = UserConfig.CUSTOM_APP_ID;
Client.LIB.Discord_Shutdown();
Client.LIB.Discord_Initialize(APPLICATION_ID, Client.HANDLERS, Client.AUTO_REGISTER, Client.STEAM_ID);

} else {
String APPLICATION_ID = UserConfig.CUSTOM_APP_ID;
if(APPLICATION_ID.isBlank()){
APPLICATION_ID = ModConfig.baseID;
UserConfig.CUSTOM_APP_ID = APPLICATION_ID;
}
Client.LIB.Discord_Shutdown();;
Client.LIB.Discord_Initialize(APPLICATION_ID, Client.HANDLERS, Client.AUTO_REGISTER, Client.STEAM_ID);
}
UserConfig.save();
if(!CLIENT.isInSingleplayer() && CLIENT.getCurrentServerEntry() != null){
Client.LOG.info(Main.prefixLog+"Save server configs...");
ServerConfig.save();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,9 @@
import me.shedaniel.clothconfig2.api.ConfigBuilder;
import me.shedaniel.clothconfig2.api.ConfigCategory;
import me.shedaniel.clothconfig2.api.ConfigEntryBuilder;
import net.minecraft.text.MutableText;
import net.minecraft.text.Text;
import net.minecraft.text.TranslatableTextContent;
import ru.simplykel.simplystatus.Main;
import ru.simplykel.simplystatus.config.Localization;
import ru.simplykel.simplystatus.config.ModConfig;
import ru.simplykel.simplystatus.config.UserConfig;

public class AddonsConfigs {
Expand All @@ -29,11 +27,38 @@ public ConfigCategory getCategory(ConfigBuilder builder){
.setDefaultValue(false)
.setSaveConsumer(newValue -> UserConfig.VIEW_MUSIC_LISTENER = newValue)
.build());
// 1.7.1
//
category.addEntry(entryBuilder.startBooleanToggle(Localization.getText("simplystatus.config.client.show_items"), UserConfig.SHOW_ITEMS)
.setDefaultValue(true)
.setSaveConsumer(newValue -> UserConfig.SHOW_ITEMS = newValue)
.build());
//
category.addEntry(entryBuilder.startBooleanToggle(Localization.getText("simplystatus.config.client.enable_time_cycle"), UserConfig.ENABLE_TIME_CYCLE)
.setDefaultValue(true)
.setSaveConsumer(newValue -> UserConfig.ENABLE_TIME_CYCLE = newValue)
.build());
//
category.addEntry(entryBuilder.startBooleanToggle(Localization.getText("simplystatus.config.client.enable_world"), UserConfig.ENABLE_WORLD)
.setDefaultValue(true)
.setSaveConsumer(newValue -> UserConfig.ENABLE_WORLD = newValue)
.build());
//
category.addEntry(entryBuilder.startBooleanToggle(Localization.getText("simplystatus.config.addons.use_custom_assets"), UserConfig.USE_CUSTOM_ASSETS)
.setDefaultValue(false)
.setSaveConsumer(newValue -> UserConfig.USE_CUSTOM_ASSETS = newValue)
.build());

//
category.addEntry(entryBuilder.startBooleanToggle(Localization.getText("simplystatus.config.client.use_custom_app_id"), UserConfig.USE_CUSTOM_APP_ID)
.setDefaultValue(false)
.setSaveConsumer(newValue -> UserConfig.USE_CUSTOM_APP_ID = newValue)
.build());
//
category.addEntry(entryBuilder.startStrField(Localization.getText("simplystatus.config.addons.custom_app_id"), UserConfig.CUSTOM_APP_ID)
.setDefaultValue(ModConfig.baseID)
.setSaveConsumer(newValue -> UserConfig.CUSTOM_APP_ID = newValue)
.build());
return category;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
import me.shedaniel.clothconfig2.api.ConfigBuilder;
import me.shedaniel.clothconfig2.api.ConfigCategory;
import me.shedaniel.clothconfig2.api.ConfigEntryBuilder;
import net.minecraft.SharedConstants;
import net.minecraft.client.MinecraftClient;
import net.minecraft.text.MutableText;
import net.minecraft.text.Text;
import net.minecraft.text.TranslatableTextContent;
Expand All @@ -28,10 +30,6 @@ public ConfigCategory getCategory(ConfigBuilder builder){
.setSaveConsumer(newValue -> Localization.setLocalization("mainmenu.state", newValue))
.build());
//
if(UserConfig.VIEW_MUSIC_LISTENER){

}
//
category.addEntry(entryBuilder.startStrField(
Localization.getText("simplystatus.config.localization.death.one"),
Localization.getLocalization("death.one", false))
Expand Down Expand Up @@ -165,6 +163,15 @@ public ConfigCategory getCategory(ConfigBuilder builder){
.setSaveConsumer(newValue -> Localization.setLocalization("world.the_end", newValue))
.build());
//
if(SharedConstants.getGameVersion().getName().equals("23w13a_or_b")){
category.addEntry(entryBuilder.startStrField(
Localization.getText("simplystatus.config.localization.world.moon"),
Localization.getLocalization("world.moon", false))
.setDefaultValue(Localization.getLcnDefault("world.moon"))
.setSaveConsumer(newValue -> Localization.setLocalization("world.moon", newValue))
.build());
}
//
category.addEntry(entryBuilder.startStrField(
Localization.getText("simplystatus.config.localization.singleplayer"),
Localization.getLocalization("singleplayer", false))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,21 +57,6 @@ public ConfigCategory getCategory(ConfigBuilder builder){
.setDefaultValue(true)
.setSaveConsumer(newValue -> UserConfig.VIEW_PLAYER_NAME = newValue)
.build());
// 1.7.1
//
category.addEntry(entryBuilder.startBooleanToggle(Localization.getText("simplystatus.config.client.show_items"), UserConfig.SHOW_ITEMS)
.setDefaultValue(true)
.setSaveConsumer(newValue -> UserConfig.SHOW_ITEMS = newValue)
.build());
//
category.addEntry(entryBuilder.startBooleanToggle(Localization.getText("simplystatus.config.client.enable_time_cycle"), UserConfig.ENABLE_TIME_CYCLE)
.setDefaultValue(true)
.setSaveConsumer(newValue -> UserConfig.ENABLE_TIME_CYCLE = newValue)
.build());
category.addEntry(entryBuilder.startBooleanToggle(Localization.getText("simplystatus.config.client.enable_world"), UserConfig.ENABLE_WORLD)
.setDefaultValue(true)
.setSaveConsumer(newValue -> UserConfig.ENABLE_WORLD = newValue)
.build());

return category;
}
Expand Down
19 changes: 18 additions & 1 deletion src/main/java/ru/simplykel/simplystatus/info/Game.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
package ru.simplykel.simplystatus.info;
import io.github.bumblesoftware.fastload.client.BuildingTerrainScreen;
import net.minecraft.client.MinecraftClient;
import net.minecraft.client.gui.screen.*;
import ru.simplykel.simplystatus.Main;

public class Game {

private static final MinecraftClient CLIENT = MinecraftClient.getInstance();
Expand All @@ -23,7 +26,9 @@ public static void setGameState(int newGameState) {
gameState = newGameState;
}
public static void tick() {
if (CLIENT.currentScreen != null) screenTick();
if (CLIENT.currentScreen != null) {
if(Main.fastload) screenTickFastLoad(); else screenTick();
};
if (lastScreen != CLIENT.currentScreen) {
if (lastScreen != null) screenChange(lastScreen);
lastScreen = CLIENT.currentScreen;
Expand All @@ -44,6 +49,18 @@ private static void screenTick() {
}
setUpdated(true);
}
private static void screenTickFastLoad() {
if (CLIENT.currentScreen instanceof LevelLoadingScreen || CLIENT.currentScreen instanceof BuildingTerrainScreen) {
setGameState(1);
} else if (CLIENT.currentScreen instanceof ProgressScreen || CLIENT.currentScreen instanceof ConnectScreen || CLIENT.currentScreen instanceof DownloadingTerrainScreen) {
setGameState(2);
} else if (CLIENT.currentScreen instanceof DisconnectedScreen) {
setGameState(3);
} else {
setGameState(0);
}
setUpdated(true);
}

private static void screenChange(Screen lastScreen) {
// var api = BetterTaskbarAPI.getInstance();
Expand Down
2 changes: 2 additions & 0 deletions src/main/java/ru/simplykel/simplystatus/info/World.java
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ public static String getCodeName(){
public static String getAssets(){
MinecraftClient CLIENT = MinecraftClient.getInstance();
String world = CLIENT.player.world.getRegistryKey().getValue().toString();
if(world.equals("minecraft:the_moon")) return Client.ASSETS.world_moon;
if(world.equals("minecraft:the_end")) return Client.ASSETS.world_the_end;
if(world.equals("minecraft:the_nether")) return Client.ASSETS.world_nether;
if(world.equals("minecraft:overworld")) return Client.ASSETS.world;
Expand All @@ -43,6 +44,7 @@ public static String getAssets(){
public static String getName(){
MinecraftClient CLIENT = MinecraftClient.getInstance();
String world = CLIENT.player.world.getRegistryKey().getValue().toString();
if(world.equals("minecraft:the_moon")) return Localization.getLocalization("world.moon", true);
if(world.equals("minecraft:the_end")) return Localization.getLocalization("world.the_end", true);
if(world.equals("minecraft:the_nether")) return Localization.getLocalization("world.nether", true);
if(world.equals("minecraft:overworld")) return Localization.getLocalization("world.overworld", true);
Expand Down
Loading

0 comments on commit 49cea70

Please sign in to comment.