Skip to content

Instantly share code, notes, and snippets.

@realdirt
Last active August 27, 2022 23:24
Show Gist options
  • Save realdirt/463c11167992779c22017fd52b64ba47 to your computer and use it in GitHub Desktop.
Save realdirt/463c11167992779c22017fd52b64ba47 to your computer and use it in GitHub Desktop.
For the people who do not know that you only have to rename the classes
public static void main(String[] args) {
File origFile = new File(System.getenv("USERPROFILE") + "\\.lunarclient\\offline\\1.8\\lunar-prod-optifine.jar");
try {
JarFile jarFile = new JarFile(origFile);
JarOutputStream jarOutputStream = new JarOutputStream(new FileOutputStream("LunarClient.jar"));
Enumeration<JarEntry> enumeration = jarFile.entries();
while (enumeration.hasMoreElements()) {
JarEntry jarEntry = enumeration.nextElement();
if (jarEntry.getName().endsWith(".lclass")) {
System.out.println("Processing " + jarEntry.getName());
JarEntry jE = new JarEntry(jarEntry.getName().replace(".lclass", ".class"));
jarOutputStream.putNextEntry(jE);
} else {
System.out.println("Copying " + jarEntry.getName());
jarOutputStream.putNextEntry(jarEntry);
}
if (!jarEntry.isDirectory()) {
jarOutputStream.write(toByteArray(jarFile.getInputStream(jarEntry)));
}
jarOutputStream.closeEntry();
}
jarOutputStream.close();
} catch (IOException e) {
e.printStackTrace();
}
}
public static byte[] toByteArray(InputStream inputStream) throws IOException {
ByteArrayOutputStream buffer = new ByteArrayOutputStream();
int nRead;
byte[] data = new byte[4096];
while ((nRead = inputStream.read(data, 0, data.length)) != -1) {
buffer.write(data, 0, nRead);
}
return buffer.toByteArray();
}
@RoleXzD
Copy link

RoleXzD commented Nov 16, 2021

I cant run it idk why

@HorrorBest
Copy link

how can I run/ Compile this ????

@realdirt
Copy link
Author

@HorrorBest
@RoleXzD
You can download an executable version (with code & scripts to compile & run) here:
https://www.masterof13fps.com/forum/index.php?threads/make-lunarclient-decompilable.7729/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment