feat: extract bundled cloud assets to config dir on init
Add ZenClient.extractCloudAssets() that copies panel.png, ptr.png, lie.wav and truth.wav from /assets/zen/cloud_assets/ on the classpath into ConfigManager.CONFIG_DIR (~/.zen/configs). Existing files are left untouched so user-replaced assets stick around. Called from init() right after ConfigManager is constructed, since LieDetector's TextureUtil/SoundUtil look up these files there. Co-Authored-By: Claude Opus 4.7 <[email protected]>
This commit is contained in:
1 parent
b2fc280118
commit
7659ec3bc2
2 files changed
+30
-32
No files matched your search
@@ -3,6 +3,10 @@ package shit.zen;
|
||||
import asm.patchify.loader.PatchAgent;
|
||||
import asm.patchify.loader.PatchRegistry;
|
||||
import java.io.File;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
import java.lang.reflect.Field;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
@@ -55,6 +59,8 @@ public class ZenClient extends ClientBase {
|
||||
public static String configDir = System.getProperty("user.home") + File.separator + ".zen";
|
||||
public static String username = "";
|
||||
|
||||
private static final String[] CLOUD_ASSET_NAMES = { "panel.png", "ptr.png", "lie.wav", "truth.wav" };
|
||||
|
||||
private EventBus eventBus;
|
||||
private RotationHandler rotationHandler;
|
||||
private ModuleManager moduleManager;
|
||||
@@ -87,6 +93,7 @@ public class ZenClient extends ClientBase {
|
||||
this.hudManager = new HudManager();
|
||||
this.commandManager = new CommandManager();
|
||||
this.configManager = new ConfigManager();
|
||||
this.extractCloudAssets();
|
||||
this.lagManager = new LagManager();
|
||||
this.targetManager = new TargetManager();
|
||||
this.eventBus.register(this.hudManager);
|
||||
@@ -140,6 +147,29 @@ public class ZenClient extends ClientBase {
|
||||
}
|
||||
}
|
||||
|
||||
private void extractCloudAssets() {
|
||||
File targetDir = ConfigManager.CONFIG_DIR;
|
||||
if (!targetDir.exists() && !targetDir.mkdirs()) {
|
||||
logger.warn("Failed to create config directory at {}", targetDir);
|
||||
return;
|
||||
}
|
||||
for (String name : CLOUD_ASSET_NAMES) {
|
||||
File outFile = new File(targetDir, name);
|
||||
if (outFile.exists()) continue;
|
||||
try (InputStream in = ZenClient.class.getResourceAsStream("/assets/zen/cloud_assets/" + name)) {
|
||||
if (in == null) {
|
||||
logger.warn("Cloud asset missing on classpath: {}", name);
|
||||
continue;
|
||||
}
|
||||
try (OutputStream out = new FileOutputStream(outFile)) {
|
||||
in.transferTo(out);
|
||||
}
|
||||
} catch (IOException ioException) {
|
||||
logger.error("Failed to extract cloud asset {}", name, ioException);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static void registerPatches() {
|
||||
PatchRegistry.register(MinecraftPatch.class);
|
||||
PatchRegistry.register(LocalPlayerPatch.class);
|
||||
|
||||
Reference in new issue
Block a user