Skip to content

Commit

Permalink
fix bad decompiled code
Browse files Browse the repository at this point in the history
  • Loading branch information
boubou19 committed Oct 11, 2022
1 parent 5ea7297 commit 0d1e6b6
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 25 deletions.
6 changes: 3 additions & 3 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ developmentEnvironmentUserName = Developer
# The string's content will be replaced with your mod's version when compiled. You should use this to specify your mod's
# version in @Mod([...], version = VERSION, [...])
# Leave these properties empty to skip individual token replacements
replaceGradleTokenInFile = Tags.java
replaceGradleTokenInFile = IDExtender.java
gradleTokenModId = GRADLETOKEN_MODID
gradleTokenModName = GRADLETOKEN_MODNAME
gradleTokenVersion = GRADLETOKEN_VERSION
Expand All @@ -59,7 +59,7 @@ mixinsPackage =
# Specify the core mod entry class if you use a core mod. This class must implement IFMLLoadingPlugin!
# This parameter is for legacy compatibility only
# Example value: coreModClass = asm.FMLPlugin + modGroup = com.myname.mymodid -> com.myname.mymodid.asm.FMLPlugin
coreModClass =
coreModClass = IEPlugin
# If your project is only a consolidation of mixins or a core mod and does NOT contain a 'normal' mod ( = some class
# that is annotated with @Mod) you want this to be true. When in doubt: leave it on false!
containsMixinsAndOrCoreModOnly = false
Expand Down Expand Up @@ -111,4 +111,4 @@ curseForgeRelations =
# Uncomment this to disable spotless checks
# This should only be uncommented to keep it easier to sync with upstream/other forks.
# That is, if there is no other active fork/upstream, NEVER change this.
# disableSpotless = true
# disableSpotless = true
20 changes: 11 additions & 9 deletions src/main/java/ru/fewizz/idextender/IEPlugin.java
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
package ru.fewizz.idextender;

import cpw.mods.fml.relauncher.*;
import java.io.*;
import java.util.*;
import ru.fewizz.idextender.asm.*;
import cpw.mods.fml.relauncher.IFMLLoadingPlugin;
import cpw.mods.fml.relauncher.IFMLLoadingPlugin.MCVersion;
import cpw.mods.fml.relauncher.IFMLLoadingPlugin.TransformerExclusions;
import java.io.File;
import java.util.Map;
import ru.fewizz.idextender.asm.IETransformer;

@IFMLLoadingPlugin.MCVersion("1.7.10")
@IFMLLoadingPlugin.TransformerExclusions({"ru.fewizz.idextender.asm"})
@MCVersion("1.7.10")
@TransformerExclusions({"ru.fewizz.idextender.asm"})
public class IEPlugin implements IFMLLoadingPlugin {
public String[] getASMTransformerClass() {
return new String[] {IETransformer.class.getName()};
Expand All @@ -20,9 +22,9 @@ public String getSetupClass() {
return null;
}

public void injectData(final Map<String, Object> data) {
IEConfig.init(data.get("coremodLocation"));
IETransformer.isObfuscated = data.get("runtimeDeobfuscationEnabled");
public void injectData(Map<String, Object> data) {
IEConfig.init((File) data.get("coremodLocation"));
IETransformer.isObfuscated = (Boolean) data.get("runtimeDeobfuscationEnabled");
}

public String getAccessTransformerClass() {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,26 +1,28 @@
package ru.fewizz.idextender.asm.transformer;

import java.util.*;
import org.objectweb.asm.tree.*;
import ru.fewizz.idextender.asm.*;
import java.util.ListIterator;
import org.objectweb.asm.tree.AbstractInsnNode;
import org.objectweb.asm.tree.ClassNode;
import org.objectweb.asm.tree.InsnList;
import org.objectweb.asm.tree.LdcInsnNode;
import org.objectweb.asm.tree.MethodNode;
import ru.fewizz.idextender.asm.AsmUtil;
import ru.fewizz.idextender.asm.IClassNodeTransformer;

public class WorldEditBaseBlock implements IClassNodeTransformer {
@Override
public void transform(final ClassNode cn, final boolean obfuscated) {
final MethodNode method = AsmUtil.findMethod(cn, "internalSetId", true);
if (method == null) {
return;
}
public void transform(ClassNode cn, boolean obfuscated) {
MethodNode method = AsmUtil.findMethod(cn, "internalSetId", true);
if (method == null) return;
AsmUtil.transformInlinedSizeMethod(cn, method, 4095, 32767);
final InsnList code = method.instructions;
for (final AbstractInsnNode insn : code) {
InsnList code = method.instructions;
for (ListIterator<AbstractInsnNode> iterator = code.iterator(); iterator.hasNext(); ) {
AbstractInsnNode insn = iterator.next();
if (insn.getType() == 9 && ((LdcInsnNode) insn).cst instanceof String) {
final String string = (String) ((LdcInsnNode) insn).cst;
String string = (String) ((LdcInsnNode) insn).cst;
if (string.contains("4095")) {
((LdcInsnNode) insn).cst = string.replace("4095", Integer.toString(32767));
break;
}
continue;
}
}
}
Expand Down

0 comments on commit 0d1e6b6

Please sign in to comment.