Skip to content

MiracleLoader 1.5.0: redirecting a new

Choose a tag to compare

@Hronosin Hronosin released this 03 Oct 20:19

RGCT can now redirect a new. Mods for 1.4 work as they are.

rgct.target("net.minecraft.client.renderer.LevelRenderer")
    .method("extractSectionDrawGroups")
    .redirect(DynamicGpuData.ChunkSectionInfo::new, MyMod::info);   // a factory instead of a new object

Every new Foo(...) in the method goes to a factory that takes the same arguments. The factory can return an object it already has, a recycled one, or a subclass, and costs the same as an ordinary redirect: it's bound once, and the JIT inlines it. super(...) and this(...) calls are left alone. The replacement may take wider types and may return Object, which is cast back.

Also includes 1.4.1: the loader no longer loads mods twice when it's both a -javaagent and the main class.

Checked

  • test.sh: 495 of 495, and the same as a Java agent. That includes a redirected new on the obfuscated fake game.
  • Real client 26.3 with Ultra Somnia 0.4, which redirects three news in the chunk renderer.