ModsFinder

Dye is a Forge library that lets other mods use the JVM INVOKEDYNAMIC bytecode instruction without writing the low-level bytecode by hand.

ForgeClient or server, optionalApache License 2.0Open source1.17 – 1.20.1

What it does

Dye exposes the INVOKEDYNAMIC opcode of the Java Virtual Machine to mod developers. The first time an occurrence of the opcode runs, it is bound to a permanent CallSite, and the bootstrap method that produces that CallSite is written in plain Java. Lambdas in compiled bytecode are one example of how the opcode is used.

A transform service provided by the mod replaces ordinary method calls with calls to methods carrying a special annotation. The annotation's value names a custom bootstrap method, so a modder can attach INVOKEDYNAMIC behavior to annotated methods. The library is Forge-only and is published for 1.17 – 1.20.1, with 12 release versions covered and 0.1.2 for 1.20.1 as the latest file. Either side can run it, and neither needs it, and the code is released under the Apache License 2.0.

The mod is aimed at Forge mod authors who need dynamic call sites in their own code. Players and server owners do not need to configure it. More detail on use is in the GitHub repository, which also hosts the source code and the issue tracker.

Key features

  1. INVOKEDYNAMIC access

    Exposes the JVM INVOKEDYNAMIC opcode to modders through a ModLauncher service.

  2. Bootstrap-based call sites

    Each call site is created once by a bootstrap method written in plain Java and then reused.

  3. Annotation-driven transform

    A transform service rewrites calls to methods marked with a special annotation.

  4. Custom bootstrap per annotation

    The annotation value selects the bootstrap method, so each annotated method can use its own behavior.

Compatibility

Latest build for each game version and loader.

1.20.x2 of 2 versions with builds
1.20.10.1.2
1.200.1.2
1.19.x5 of 5 versions with builds
1.19.40.1.2
1.19.30.1.2
1.19.20.1.2
1.19.10.1.2
1.190.1.2
1.18.x3 of 3 versions with builds
1.18.20.1.2
1.18.10.1.2
1.180.1.2
1.17.x2 of 2 versions with builds
1.17.10.1.2
1.170.1.2
ReleaseBetaAlphaNot available

Only full game releases are shown. This mod publishes no snapshot builds.

Use cases

Lambda-style code generation

Mod code can emit INVOKEDYNAMIC instructions the way compiled lambdas do, with the call site set up by Java code.

Annotated dynamic calls

Methods marked with the library's annotation are rerouted through a chosen bootstrap method at load time.

Who it’s for: Forge mod developers who want to generate or reroute bytecode with INVOKEDYNAMIC. The library is a development tool and gives players no items, blocks or screens of their own.

Questions

Does Dye need to be installed on the server?

No. Either side can run it, and neither needs it, so a server can run Dye or leave it out. Installing it on one side is enough for a mod that depends on it.

Which loader and versions does Dye support?

Dye is published for Forge only, for game versions 1.17 – 1.20.1. The latest file is 0.1.2 for 1.20.1, released on 2022-08-22.

Where is the source code and how is the library used?

The source code and issue tracker are public. Usage details and examples are described in the GitHub repository linked from the project.

In the catalog

Dye is one of 3,514 Library mods on ModsFinder, and one of 1,576 Library mods for Forge. 34,764 mods support Minecraft 1.20.1.

More from noeppi-noeppi

All projects

Similar mods

What the author says

A library / modlauncher service that exposes the jvm INVOKEDYNAMIC opcode to modders. For more information on how to use it as a modder, see the GitHub. The Java Virtual Machine (JVM) has an opcode called INVOKEDYNAMIC. Each individual occurrence of that opcode in bytecode is permanently bound to a CallSite object…
noeppi-noeppi, on the Modrinth page

Official listing

Owner
noeppi-noeppi
Published
2022-08-22
Updated on Modrinth
2022-08-22
Facts verified
2026-10-15

Tags