Начинающий
- Статус
- Оффлайн
- Регистрация
- 11 Май 2024
- Сообщения
- 297
- Реакции
- 4
Короче ребятки вижу что вам не дали нормальный автокфг так что сливаю вам упрощенную версию
Берете класс ConfigStorage
У меня он такой
далее ищете строку
this.loadConfiguration("autocfg");
У вас вместо autocfg скорее всего будет system поменяеете на autocfg или как вам удобнее
Далее переходим в класс Minecraft и ищем метод shutdownMinecraftApplet
И туда прописываем
На этом гайд окончен всем удачки
Берете класс ConfigStorage
У меня он такой
ConfigStorage:
/*
* Decompiled with CFR 0.153-SNAPSHOT (d6f6758-dirty).
*/
package ru.karatel.client.config;
import com.google.gson.GsonBuilder;
import com.google.gson.JsonElement;
import com.google.gson.JsonObject;
import com.google.gson.JsonParser;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;
import net.minecraft.client.Minecraft;
public class ConfigStorage {
public final Logger logger = Logger.getLogger(ConfigStorage.class.getName());
public final File CONFIG_DIR;
public final File AUTOCFG_DIR;
public final JsonParser jsonParser;
public ConfigStorage() {
this.CONFIG_DIR = new File(Minecraft.getInstance().gameDir, "\\Delight\\configs");
this.AUTOCFG_DIR = new File(this.CONFIG_DIR, "");
this.jsonParser = new JsonParser();
}
public void init() throws IOException {
this.setupFolder();
}
public void setupFolder() {
if (!this.CONFIG_DIR.exists()) {
this.CONFIG_DIR.mkdirs();
} else if (this.AUTOCFG_DIR.exists()) {
this.loadConfiguration("autocfg");
this.logger.log(Level.SEVERE, "Load system configuration...");
} else {
this.logger.log(Level.SEVERE, "Creating system configuration...");
try {
this.AUTOCFG_DIR.createNewFile();
this.logger.log(Level.SEVERE, "Created!");
} catch (IOException e) {
this.logger.log(Level.SEVERE, "Failed to create system configuration file", e);
}
}
}
public boolean isEmpty() {
return this.getConfigs().isEmpty();
}
public List<Config> getConfigs() {
ArrayList<Config> configs = new ArrayList<Config>();
File[] configFiles = this.CONFIG_DIR.listFiles();
if (configFiles != null) {
for (File configFile : configFiles) {
String configName;
Config config;
if (!configFile.isFile() || !configFile.getName().endsWith(".cfg") || (config = this.findConfig(configName = configFile.getName().replace(".cfg", ""))) == null) continue;
configs.add(config);
}
}
return configs;
}
public void loadConfiguration(String configuration) {
Config config = this.findConfig(configuration);
if (config == null) {
this.logger.log(Level.WARNING, "Config '" + configuration + "' not found – skipping load.");
return;
}
try (FileReader reader = new FileReader(config.getFile())) {
// Parse and validate JSON content safely
JsonElement element = this.jsonParser.parse(reader);
if (element != null && element.isJsonObject()) {
config.loadConfig(element.getAsJsonObject());
} else {
this.logger.log(Level.WARNING, "Config file '" + config.getFile().getName() + "' is empty or not a valid JSON object – skipping load.");
}
} catch (FileNotFoundException e) {
this.logger.log(Level.WARNING, "Config file not found!", e);
} catch (IOException e) {
this.logger.log(Level.WARNING, "I/O error while loading config!", e);
} catch (Exception e) {
this.logger.log(Level.WARNING, "Unexpected error while loading config!", e);
}
}
public void saveConfiguration(String configuration) {
Config config = new Config(configuration);
String contentPrettyPrint = new GsonBuilder().setPrettyPrinting().create().toJson(config.saveConfig());
try {
FileWriter writer = new FileWriter(config.getFile());
writer.write(contentPrettyPrint);
writer.close();
} catch (IOException e) {
this.logger.log(Level.WARNING, "File not found!", e);
} catch (NullPointerException e) {
this.logger.log(Level.WARNING, "Fatal Error in Config!", e);
}
}
public Config findConfig(String configName) {
if (configName == null) {
return null;
}
if (new File(this.CONFIG_DIR, configName + ".cfg").exists()) {
return new Config(configName);
}
return null;
}
}
this.loadConfiguration("autocfg");
У вас вместо autocfg скорее всего будет system поменяеете на autocfg или как вам удобнее
Далее переходим в класс Minecraft и ищем метод shutdownMinecraftApplet
И туда прописываем
mega autocfg:
ConfigStorage configStorage = new ConfigStorage();
configStorage.saveConfiguration("autocfg");

