Git Product home page Git Product logo

bansoukou's Introduction

Bansoukou

Bansōkō [絆創膏] - a simple coremod that streamlines patching of mods.

Usage

  1. Create a folder in .minecraft named bansoukou. You can do this manually or run with this mod in the instance for it to create one.
  2. In /bansoukou, here is where you can define patches, where folders will represent the jar you want to patch with the names of the folders matching the jars in mods/.

It should look something like this:

RootFolderStructure

  1. Match the jar file's directory structure, and place whatever files you want replacing in the same relative paths, such as:

InsideFolderStructure_BansoukouFolder

With the jar looking like:

InsideJarStructure

Note: If you want to delete a file from the jar, you simply place an empty file with the same relative path name and Bansoukou will detect that and remove the respective file from the jar at runtime.

Coremods: They... do not work yet (as the ClassLoader has already done its magic), but I do have a solution coming, but as I am concentrating on my own modpack I likely will not update this any time soon. It won't be as seamless and probably would need a restart.

bansoukou's People

Contributors

rongmario avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

bansoukou's Issues

[Feature Request] Bytecode splice

Please add feature to splice bytecode.

Problem

Sometimes, i need to modify only one integer or string in .class files.
Some mods with "All Rights Reserved" license forbid to distribute their .class files, so i can't use Bansoukou.
Other devs using mixins and coremods for this, but i have lack of Java knowledge.

Suggestion

Please add feature to change binary file content without providing whole binary file.
For example, it could be .json with commands that will replace bytes.

Manual example

I have ImmersiveEngineering Silo that i want to change capacity stored in int

public class TileEntitySilo
extends TileEntityMultiblockPart<TileEntitySilo>
implements IEBlockInterfaces.IComparatorOverride {
    public ItemStack identStack = ItemStack.field_190927_a;
    public int storageAmount = 0;
    static int maxStorage = 41472; // Value i want to change
    boolean lockItem = false;
    private int[] oldComps = new int[6];

When i used Bansoukou for the first time, i opened this .class file with Hex editor, found 00 00 A2 and replace it to 00 FF FF.
So now my code should looks like:

static int maxStorage = 16776960;

I saved this file into bansoukou/ folder and its work.

Feature suggestion example

What i want is to do same actions in steps above, but on MC launch.

For example, it could be .json file with arrays of instructions.
In addition to file path it could have special characters that instruct to read file as instructions instead of inject in .jar as is.
In my example, file called TileEntitySilo.class and instructions file called TileEntitySilo.class$$.json

bansoukou/ImmersiveEngineering-0.12-98/blusunrize/immersiveengineering/common/blocks/metal/TileEntitySilo.class$$.json

Instruction file could have arrays of JS-like .splice() parameters:

[
  {
    "index": 6574, // The position to add/remove bytes
    "remove": 2, // Number of bytes removed, optional
    "insert": [255, 255] // New byte(s) to be added
  }
]

When Bansoukou run, it would open .class file in binary format, and replace bytes 6574 and 6575 to FF FF and then save -patched .jar as usual.

Note:
It would be nice if "index" and "insert" values could accept strings, so i could write:

"index": "19AE",
"remove": 2,
"insert": "FF FF"

Some mods patched only after closing error window (Mod Duplicates)

Reproduce

Steps i get into issue:

  1. I updated some mods
  2. Removed all -patched.jar files and renamed .disabled back to .jar

This how my folder files looks like
explorer_UJpy6f7dpg

  1. Next, i launched game and get this error:

javaw_acEh9ctosn

  1. This how mods/ folder looks like when i see error above

explorer_XZTZGfBLAk

  1. As soon as i close MC window with error above, files renamed

image

  1. I launch game again and everything working fine

Even though I have about 20 mods modified through Bansoukou, only these two mods create the error: ImmersiveEngineering and BetterAnimalsPlus.

Logs

Logs that generated after step 5.: debug.zip

Versions

  • mixinbooter-7.1 (happens with 7.0 too)
  • _bansoukou-4.3.1

[Feature Request] JAR renaming

Rare mods require strict .jar file name, like ThaumTweaks:

This makes unable to use Bansoukou with ThaumTweaks together.

I was planned to use Bansoukou to manually fix issue with Web and researches.

Request

Please add feature to rename .jar file to custom name or skip renaming at all.

Bansoukou already renaming file to {FILENAME}-patched.jar. If i can skip renaming, and file would be modified in place, it would fix my issue with ThaumTweaks.

Also, it would be nice if I can chose file name, for example putting file __filename.txt in bansoukou/ folder, that would not be added to .jar but it contents would be used for renaming.

For example, if i want to place DankNull mod on buttom of mods/ folder i could make file ./DankNull-1.12.2-1.7.101/__filename.txt with content:

zz_DankNull-1.12.2-1.7.101.jar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.