Files
LCE-Revelations/tools/DecompileASBody.java
itsRevela 3aa2d23fa9 feat: implement hardcore hearts with game mode lock
Display hardcore heart textures when a world is in hardcore mode,
matching Java Edition behavior. Hearts switch between normal/hardcore
across all states (poison, wither, flash) and all HUD resolutions.

C++ changes:
- IUIScene_HUD: check isHardcore() and call SetHardcoreMode() each tick
- UIScene_HUD: send hardcore boolean to Flash via Iggy, invalidate
  SetHealth dirty check on state change to force heart redraw
- CreateWorldMenu/LoadMenu: lock game mode to Survival when hardcore
- MinecraftServer: gate server.properties hardcore override behind
  MINECRAFT_SERVER_BUILD so offline worlds preserve their saved flag

SWF changes (via new Java tools):
- AddHardcoreBitmaps: adds 10 hardcore heart bitmaps to graphics SWFs
- AddHardcoreHearts: adds 10 new frames (15-24) to health sprite
- PatchHudABC: patches HUD ActionScript bytecode with SetHardcore
  method and frame offset logic (+14 normal/poison, +6 wither)

Also updates README changelog styling with consistent ### headings.
2026-03-30 13:50:29 -05:00

49 lines
1.6 KiB
Java

import com.jpexs.decompiler.flash.SWF;
import com.jpexs.decompiler.flash.exporters.modes.ScriptExportMode;
import com.jpexs.decompiler.flash.exporters.settings.ScriptExportSettings;
import com.jpexs.decompiler.flash.configuration.Configuration;
import java.io.*;
import java.util.*;
/**
* Exports all ActionScript 3 source from a SWF to a directory.
* Usage: DecompileASBody <swf-file> [output-dir]
*/
public class DecompileASBody {
public static void main(String[] args) throws Exception {
if (args.length < 1) {
System.out.println("Usage: DecompileASBody <swf-file> [output-dir]");
return;
}
Configuration.autoDeobfuscate.set(false);
String path = args[0];
String outDir = args.length > 1 ? args[1] : "as_output";
SWF swf = new SWF(new FileInputStream(path), false);
File out = new File(outDir);
out.mkdirs();
ScriptExportSettings settings = new ScriptExportSettings(ScriptExportMode.AS, false, false, false, false);
swf.exportActionScript(null, outDir, settings, false, null);
System.out.println("Export complete. Files:");
listFiles(new File(outDir), "");
}
static void listFiles(File dir, String prefix) {
File[] files = dir.listFiles();
if (files == null) return;
Arrays.sort(files);
for (File f : files) {
if (f.isDirectory()) {
listFiles(f, prefix + f.getName() + "/");
} else {
System.out.println(" " + prefix + f.getName() + " (" + f.length() + " bytes)");
}
}
}
}