forked from Meldexun/RLTweaker
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Use ASM instead of event handler - Add config option to control which files to clear - Add different cleaning modes
- Loading branch information
Showing
7 changed files
with
191 additions
and
158 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
30 changes: 30 additions & 0 deletions
30
src/main/java/com/charles445/rltweaker/asm/patch/PatchCleanStructureFiles.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
package com.charles445.rltweaker.asm.patch; | ||
|
||
import org.objectweb.asm.ClassWriter; | ||
import org.objectweb.asm.Opcodes; | ||
import org.objectweb.asm.tree.ClassNode; | ||
import org.objectweb.asm.tree.MethodInsnNode; | ||
import org.objectweb.asm.tree.MethodNode; | ||
import org.objectweb.asm.tree.VarInsnNode; | ||
|
||
import com.charles445.rltweaker.asm.util.ASMUtil; | ||
import com.charles445.rltweaker.asm.util.TransformUtil; | ||
|
||
public class PatchCleanStructureFiles extends PatchManager { | ||
|
||
public PatchCleanStructureFiles() { | ||
super("Patch Clean Structure Files"); | ||
|
||
this.add(new Patch(this, "net.minecraft.world.WorldServer", ClassWriter.COMPUTE_FRAMES) { | ||
@Override | ||
public void patch(ClassNode clazzNode) { | ||
MethodNode m_saveLevel = this.findMethod(clazzNode, "saveLevel"); | ||
|
||
TransformUtil.insertBeforeFirst(m_saveLevel, ASMUtil.listOf( | ||
new VarInsnNode(Opcodes.ALOAD, 0), | ||
new MethodInsnNode(Opcodes.INVOKESTATIC, "com/charles445/rltweaker/hook/HookMinecraft", "preSaveWorld", "(Lnet/minecraft/world/WorldServer;)V", false))); | ||
} | ||
}); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.