Deobfuscation Fix Task — Instructions
Your Goal
Fix compilation errors in GregTech Java source files by editing
Python fix modules in recreate_sources/gregtech/. Errors come from leftover obfuscated
field/method names that the automated deobfuscator couldn't resolve.
How the Pipeline Works
-
recreate_sources/gregtech/deobfuscate.pyruns first — it uses MCP mapping files to rename obfuscated
classes, fields, and methods. Do not modify this file..It replaces modified files with its output so previous pipeline runs have no effect on future runs.
It does not handle all cases, and does only partial deobfuscation.Pipeline can't apply processing twice no matter what. It always works with fresh files on input.
-
Per-file fix modules (
.pyfiles) run second — each one opens a specific
.javafile, appliesvr()/vrx()/ai()fixes, and writes it back.CRITICAL: If ANY
vr()orvrx()replacement warns (text not found), the pipeline
ABORTS before compilation. All modules finish processing first, then warnings are
checked — if any exist, compilation is skipped. You MUST fix all warnings before
compilation can run. Disabling this behavior or bypassing warnings is FORBIDDEN. recompile.batruns last — located in project root.
Compilation filters out all warnings; only errors are shown.
Run everything with:
What You Can Modify
Only the per-file fix modules under these directories.
ALL fix modules already exist as stub files. You do NOT need to create new ones.
Every .java file already has a corresponding .py fix module registered in
fix_registry.py. Just open the existing file and add vr()/vrx()/ai() calls
inside the fix() function.
For anonymous inner class files ($1.java, $2.java, etc.), fix them by adding
code to the parent class's fix module. Example: GT_ModHandler$1.java errors
are fixed inside recreate_sources/gregtech/common/GT_ModHandler.py.
Fix modules go directly inside recreate_sources/gregtech/, mirroring the Java
package structure. Example:
What You Cannot Modify
| File | Reason |
|---|---|
deobfuscate.py |
Correct, do not touch |
fix_registry.py |
Correct, do not touch |
fix_shared.py |
Shared helpers, changing it breaks everything |
gregtech_fix_pipeline.py |
The orchestrator, do not change |
run_pi_cycle.py |
Batch runner for pi iterations |
run_pi_cycle.bat |
Windows wrapper for the batch runner |
Any .java file |
Fixes go in the Python modules, not the Java source |
Do not create new pipeline scripts, LAST_fix.py, FINAL_patch.py, or anything
similar. Do not add wrapper scripts. Do NOT create new fix module .py files — all
fix modules already exist, just modify them. All fixes belong in the per-file modules.
Fix Module Anatomy
Fix Module Template (already exists for every file)
Every fix module starts as a stub that just reads, does nothing, and writes back.
Your job is to add vr()/vrx()/ai() calls in the marked section:
Available Helpers
| Helper | What it does |
|---|---|
r(path) |
Read file, records path for warnings |
w(path, content) |
Write content to file |
ai(c, import_str) |
Add import import_str; if missing |
vr(c, old, new, ctx) |
Replace literal old with new. Warns and ABORTS pipeline if old not found. |
vrx(c, pattern, replacement, ctx) |
Regex replace. Warns and ABORTS pipeline if pattern not found. |
Use vr() for exact text and vrx() for regex patterns. The ctx string is
shown in warnings to identify which replacement failed.
Work Cycle
1. Run the pipeline
2. Read the first error
The Java compiler shows only the last 100 errors in its output. There are
many errors total. As you fix errors, new ones become visible.
Do not use total error count as a progress metric — it stays at ~100 no matter
how many you fix. Always read the exact error you intend to fix.
Example error output:
3. Open the corresponding fix module
Match the Java file path to the fix module path. The fix module already exists —
just add vr()/vrx()/ai() calls inside its fix() function:
For anonymous inner class files ($1.java, $2.java), use the parent class's
fix module. The fix() function can read and write multiple files:
4. Diagnose the obfuscated name
The Java source at src/minecraft/gregtechmod/ may still contain obfuscated names that
the deobfuscator didn't catch. Use your knowledge of Minecraft 1.4.7 MCP mappings
to figure out the correct deobfuscated name.
Common patterns (approximate — verify against MCP mappings when unsure):
obj.c→obj.itemID(ItemStack field)obj.cm→obj.blockID(Block field)obj.d()→obj.getMaxStackSize()(ItemStack method)obj.a()→ varies widely (check method signature and parameters)obj.animationsToGo()→obj.getItem()(ItemStack method)this.k→this.worldObj(TileEntity field)this.l, this.m, this.n→this.xCoord, this.yCoord, this.zCoordobj.b()→obj.getItem()(ItemStack method).a()on collection →.getStackInSlot(),.isItemEqual(), etc.- Raw collection iteration → needs explicit
Object+ cast
5. Add the fix
Insert the fix call inside fix() before w(full_path, c):
Or for patterns:
For missing imports:
6. Verify the fix
Run the pipeline again:
The pipeline ABORTS immediately if any vr()/vrx() warning triggers — meaning
the text you tried to replace wasn't found (the code is different than expected).
You CANNOT proceed to compilation until all warnings are fixed.
If the pipeline reaches compilation and your error is gone, the fix worked.
7. Tracking progress
The compiler only shows the last 100 errors out of many total.
The total error count will remain at ~100 even as you fix errors — it is NOT a
progress metric. Instead:
- Pick one specific error from the output, fix it, verify it's gone.
- Move to the next error shown.
- When all 100 visible errors are fixed, the next batch of 100 appears.
Important Rules
- Do not modify:
deobfuscate.py,fix_shared.py,fix_registry.py
gregtech_fix_pipeline.py, any.javafiles, or the pipeline's batch
files. Only edit per-file fix modules. - Do not create new fix modules. All fix modules already exist as stub files
inrecreate_sources/gregtech/.fix_registry.pyalready lists every module.
Just open the existing file and add your fixes. - Do not leave this project directory. Everything needed is here.
- Do not use git. No commits, branches, or repository operations.
- Do not create alternative pipelines. No
LAST_fix.py,ending_touches.py,
final_round.py, or similar scripts. Fixes go in the per-file modules only. - Do not assume you are close to finishing. The project has many errors.
There is no "last" or "final" step. Just keep fixing one error at a time. - Assume
deobfuscate.pyis correct. Do not second-guess its output or try
to improve it. Fix only leftover obfuscated names in the per-file modules. - Preserve the existing structure. Keep modules in their mirrored directory
layout. Keep onefix()function per module.
Best Practices
- ALWAYS Prefer using single line replacements
vr()overvrx()where applicable - Don't try replacing multiline content => use multiple single
vr() - Process only one file at a time => It's easier to track problems and resolve them this way
- No conditional fixes, just use
vr(). - Verify your fix by re-running
gregtech_fix_pipeline.pyafter fix - Do NOT try to fix whole file at once. Do 1 to 2 small fixes.
Autonomy Rules
You are in an unattended batch run. No user is watching.
- Do NOT ask for clarification, confirmation, or input.
- If something is unclear, make a reasonable assumption and proceed.
- Fix 100 errors, then stop.
- After fixing, run the pipeline once:
python recreate_sources/gregtech/gregtech_fix_pipeline.py - Write a brief report with this exact format:
REPORT
File fixed: path
Error fixed: what the obfuscated name was and what you changed it to
Pipeline result: success or what error remains
END REPORT
- After the report, output ONLY the word DONE on its own line.
Do NOT make any more tool calls. Do NOT output anything else.
No more reading, editing, or bash commands. Just DONE and stop.
FAILURE MODE: If you do anything after DONE, the run will be killed.
Fix one file, write the report, say DONE, then stop completely.