Java library for remapper JARs

Overview

Pocolifo's JAR Remapper

Making remapping JARs easy, organized, and painless

Features

Remapping

  • Class remapping
  • Method remapping
  • Field remapping
  • Parameter remapping

Common Minecraft mapping formats

  • Built-in SRG/MCP mapping support
  • Built-in Yarn v1 & v2-merged mapping support

Flexible API

  • Remapping plugins
  • Automatically exclude META-INF directory from output JAR
  • Read your own mappings

Coming Soon

  • Local variable remapping
  • Built-in Proguard mapping support
  • Multithreaded remapping

Getting Started

Simply read some mappings

// mcp mappings
McpMappingReader reader = new McpMappingReader(
        new File("joined.srg"),
        new File("joined.exc"),

        new File("methods.csv"),
        new File("fields.csv"),
        new File("params.csv")
);

// yarn v1 mappings
YarnV1MappingReader reader = new YarnV1MappingReader(
    new File("mappings-1.17.1.tiny")
);

// yarn v2 merged mappings
YarnMergedV2MappingReader reader = new YarnMergedV2MappingReader(
    new File("mappings-merged-v2-1.17.1.tiny")
);

// read the mappings
JarMapping jarMapping = reader.read();

Then, remap the JAR like so

JarRemapper.newBuilder()
   // (required)
   // Set input (not remapped) JAR
   .setInputFile(new File("minecraft.jar"))
   
   // (required)
   // Read and set the mappings we will remap with
   .setJarMapping(jarMapping)
   
   // (required)
   // Set the output (remapped) JAR
   .setOutputFile(new File("minecraft-deobfuscated.jar"))
   
   // (optional)        
   // Set a remapping plugin (see SimpleProgressListener above)
   .setRemappingPlugin(new SimpleProgressListener())
   
   // (optional)
   // Exclude the META-INF directory from the output JAR
   .excludeMetaInf()
   
   // Remap the JAR!
   .remap();

Code snippets

Simple remapping plugin for tracking progress

import com.pocolifo.jarremapper.mapping.ClassMapping;
import com.pocolifo.jarremapper.plugin.IRemappingPlugin;

import java.util.zip.ZipFile;

public class SimpleProgressListener implements IRemappingPlugin {

   @Override
   public void onBeginRemap(ZipFile remappingJar) {
      System.out.println("Beginning remap");
   }

   @Override
   public void onBeforeRemapClass(ClassMapping classMapping) {
      System.out.println("Just about to remap a class...");
   }

   @Override
   public void onAfterRemapClass(ClassMapping classRemapped) {
      System.out.println("Just finished remapping a class!");
   }

   @Override
   public void onDoneRemap() {
      System.out.println("All classes remapped!");
   }

}

Develop

  1. Clone this repository
  2. Import the project into IntelliJ IDEA
  3. Run the setup Gradle task
You might also like...

Creates ASCII art in Java from Images

Creates ASCII art in Java from Images

Creates ASCII art in Java from Images. It can also save the ASCII art as image (.png) as well

Jul 12, 2022

Duck Library is a library for developers who don't want to spend their time to write same library consistently.

Duck Library is a library for developers who don't want to spend their time to write same library consistently.

Duck Library is a library for developers who don't want to spend their time to write same library consistently. It has almost every useful feature to

Jul 28, 2022

This is an automated library software built in Java Netbeans to reduce manual efforts of the librarian, students to ensure smooth functioning of library by involving RFIDs.

This is an automated library software built in Java Netbeans to reduce manual efforts of the librarian, students to ensure smooth functioning of library by involving RFIDs.

Advanced-Library-Automation-System This is an advanced automated library software built in Java Netbeans to reduce manual efforts of the librarian, st

Dec 6, 2022

Tinker is a hot-fix solution library for Android, it supports dex, library and resources update without reinstall apk.

Tinker is a hot-fix solution library for Android, it supports dex, library and resources update without reinstall apk.

Tinker Tinker is a hot-fix solution library for Android, it supports dex, library and resources update without reinstalling apk. Getting started Add t

Dec 30, 2022

Diff Utils library is an OpenSource library for performing the comparison / diff operations between texts or some kind of data: computing diffs

Diff Utils library is an OpenSource library for performing the comparison / diff operations between texts or some kind of data: computing diffs, applying patches, generating unified diffs or parsing them, generating diff output for easy future displaying (like side-by-side view) and so on.

Jan 5, 2023

Microserver is a Java 8 native, zero configuration, standards based, battle hardened library to run Java Rest Microservices via a standard Java main class. Supporting pure Microservice or Micro-monolith styles.

Microserver is a Java 8 native, zero configuration, standards based, battle hardened library to run Java Rest Microservices via a standard Java main class. Supporting pure Microservice or Micro-monolith styles.

Microserver A convenient modular engine for Microservices. Microserver plugins offer seamless integration with Spring (core), Jersey, Guava, Tomcat, G

Dec 19, 2022

Microserver is a Java 8 native, zero configuration, standards based, battle hardened library to run Java Rest Microservices via a standard Java main class. Supporting pure Microservice or Micro-monolith styles.

Microserver is a Java 8 native, zero configuration, standards based, battle hardened library to run Java Rest Microservices via a standard Java main class. Supporting pure Microservice or Micro-monolith styles.

Microserver is a Java 8 native, zero configuration, standards based, battle hardened library to run Java Rest Microservices via a standard Java main class. Supporting pure Microservice or Micro-monolith styles.

Dec 19, 2022

Spoon is a metaprogramming library to analyze and transform Java source code (up to Java 15). :spoon: is made with :heart:, :beers: and :sparkles:. It parses source files to build a well-designed AST with powerful analysis and transformation API.

Spoon Spoon is an open-source library to analyze, rewrite, transform, transpile Java source code. It parses source files to build a well-designed AST

Dec 29, 2022

A Java serialization/deserialization library to convert Java Objects into JSON and back

Gson Gson is a Java library that can be used to convert Java Objects into their JSON representation. It can also be used to convert a JSON string to a

Jan 8, 2023

Java Statistical Analysis Tool, a Java library for Machine Learning

Java Statistical Analysis Tool JSAT is a library for quickly getting started with Machine Learning problems. It is developed in my free time, and made

Dec 20, 2022

A modular and portable open source XMPP client library written in Java for Android and Java (SE) VMs

Smack About Smack is an open source, highly modular, easy to use, XMPP client library written in Java for Java SE compatible JVMs and Android. A pure

Dec 28, 2022

A Java library that implements a ByteChannel interface over SSLEngine, enabling easy-to-use (socket-like) TLS for Java applications.

TLS Channel TLS Channel is a library that implements a ByteChannel interface over a TLS (Transport Layer Security) connection. It delegates all crypto

Dec 31, 2022

A Java architecture test library, to specify and assert architecture rules in plain Java

A Java architecture test library, to specify and assert architecture rules in plain Java

ArchUnit is a free, simple and extensible library for checking the architecture of your Java code. That is, ArchUnit can check dependencies between pa

Jan 2, 2023

icecream-java is a Java port of the icecream library for Python.

icecream-java is a Java port of the icecream library for Python.

Apr 7, 2022

JPassport works like Java Native Access (JNA) but uses the Foreign Linker API instead of JNI. Similar to JNA, you declare a Java interface that is bound to the external C library using method names.

JPassport works like Java Native Access (JNA) but uses the Foreign Linker API instead of JNI. Similar to JNA, you declare a Java interface that is bound to the external C library using method names.

JPassport works like Java Native Access (JNA) but uses the Foreign Linker API instead of JNI. Similar to JNA, you declare a Java interface t

Dec 30, 2022

Trust-java - Test Results Verification library for Java

TRUST - Test Results Verification library for Java The TRUST's primary goal is to provide the simple way of different test results verification. Gener

Nov 19, 2017

A universal types-preserving Java serialization library that can convert arbitrary Java Objects into JSON and back

A universal types-preserving Java serialization library that can convert arbitrary Java Objects into JSON and back, with a transparent support of any kind of self-references and with a full Java 9 compatibility.

Dec 30, 2021

Library for converting from one Java class to a dissimilar Java class with similar names based on the Bean convention

Library for converting from one Java class to a dissimilar Java class with similar names based on the Bean convention

Beanmapper Beanmapper is a Java library for mapping dissimilar Java classes with similar names. The use cases for Beanmapper are the following: mappin

Nov 15, 2022

Create a Music Playlist Library -Core JAVA, JAVA Swing, AWT

Project Specifications Manage Everything about a basic Music Playlist Application in Java A Music Library for Listing, Replaying, Navigating between c

Nov 8, 2022
Comments
  • Add ability to manipulate class bytes in a Remapping Plugin

    Add ability to manipulate class bytes in a Remapping Plugin

    Add a method that takes in a byte array for the class bytes after it's been remapper and have that same method return a byte array. The returned byte array will be written to the JAR.

    enhancement 
    opened by YoungerMax 0
  • Merge two or more JarMappings together

    Merge two or more JarMappings together

    What this is

    This is a new feature that has the potential to eliminate the need to remap a JAR multiple times if you want to use multiple mappings to remap a JAR.

    High level

    At a high level, this feature would take unseen source mappings in the merging JAR mappings and add them to the current JAR mapping.

    enhancement 
    opened by YoungerMax 0
Releases(2.0.2)
  • 2.0.2(Mar 19, 2022)

  • 2.0.1(Dec 24, 2021)

    Bug fix

    • MCP Mapping Reader throws exception when class mapping in .exc file cannot be found

    Internal

    • Now using JARRemapperDev Gradle plugin
    • Published to repository
    Source code(tar.gz)
    Source code(zip)
  • 2.0.0(Dec 19, 2021)

    CHANGES MADE (in summary)

    New

    • Remapping Engines

    Updated

    • Tiny Mapping Readers so you can use specific namespaces
    • You can now "reverse" a mapping

    Removed

    • Old remapping API. This change was for Remapping Engines.
    Source code(tar.gz)
    Source code(zip)
Owner
null
Thumbnailator - a thumbnail generation library for Java

March 11, 2021: Thumbnailator 0.4.14 has been released! See Changes for details. Thumbnailator is now available through Maven! What is Thumbnailator?

Chris Kroells 4.5k Jan 5, 2023
ZXing ("Zebra Crossing") barcode scanning library for Java, Android

Project in Maintenance Mode Only The project is in maintenance mode, meaning, changes are driven by contributed patches. Only bug fixes and minor enha

ZXing Project 30.5k Jan 4, 2023
Roman Beskrovnyi 250 Jan 9, 2023
A Java Visualization Library based on Apache ECharts.

ECharts Java "We bring better visualization into Java with ECharts" ?? Introduction ECharts Java is a lightweight but comprehensive library for Java d

ECharts Java Open Source Project 171 Dec 31, 2022
Fast computer vision library for SFM, calibration, fiducials, tracking, image processing, and more.

Table of Contents Introduction Cloning Repository Quick Start Gradle and Maven Building from Source Dependencies Help/Contact Introduction BoofCV is a

Peter Abeles 916 Jan 6, 2023
Java interface to OpenCV, FFmpeg, and more

JavaCV Commercial support: Introduction JavaCV uses wrappers from the JavaCPP Presets of commonly used libraries by researchers in the field of comput

Bytedeco 6.4k Jan 4, 2023
Java JNA wrapper for Tesseract OCR API

Tess4J A Java JNA wrapper for Tesseract OCR API. Tess4J is released and distributed under the Apache License, v2.0. Features The library provides opti

Quan Nguyen 1.3k Dec 28, 2022
TwelveMonkeys ImageIO: Additional plug-ins and extensions for Java's ImageIO

About TwelveMonkeys ImageIO is a collection of plugins and extensions for Java's ImageIO. These plugins extend the number of image file formats suppor

Harald Kuhr 1.6k Jan 5, 2023