Skip to content

MiracleLoader 1.7.0: calls Java won't name, animations that decide

Latest

Choose a tag to compare

@Hronosin Hronosin released this 10 Oct 10:15

1.7.0 removes two more known limits. Mods for 1.x work as they are.

Redirecting calls Java won't let you name

A method reference can't name a private method of the game, or a super call. Now they're named by strings, like a target:

.method("updateTitle")
.redirect(Rgct.call("net.minecraft.client.Minecraft", "createTitle", "()Ljava/lang/String;"), MyMod::title)
.and()
.method("updateIsUnderwater")      // in LocalPlayer: super.updateIsUnderwater()
.redirect(Rgct.superCall("net.minecraft.world.entity.player.Player", "updateIsUnderwater", "()Z"), MyMod::dry)
  • Matching follows how javac writes calls. Private calls are invokevirtual (nestmates), and only super calls are invokespecial (26.3 has 8840 of the first, 3477 of the second), so the two never mix.
  • The class you name must have the method, declared or inherited. A misnamed one matches nothing, and the log says why.
  • A replacement that doesn't fit stops the game on the first call, saying what it takes and what the call passes.
  • miracle bake translates the three strings for obfuscated versions.

Animations that decide for themselves

  • Animation controllers, Blockbench's animation_controllers/<name>.animation_controllers.json:

    • states with weighted animations;
    • transitions on Molang conditions;
    • on_entry/on_exit;
    • crossfades.

    With them, the controllers decide what plays.

  • Molang with variables:

    • statements and assignments (v.panics = v.panics + 1;), with variables kept per entity;
    • new queries: is_on_ground, is_in_water, is_moving, health, attack_time, is_alive and more.
  • Your own queries: .query("is_burning", h -> h.isOnFire() ? 1 : 0) makes q.is_burning, worked out on each client from what the entity syncs.

  • Rites.play(entity, "recoil") (or Animations.play) plays an animation from code. From the server, everyone nearby sees it.

  • -Dmiracle.animations=trace logs every state move and rite.

Hallelujah's heretic shows all of it. It panics when it burns (a controller reading q.is_burning) and recoils from holy water (Rites.play).

Checked

  • test.sh: 556 of 556, and the same as a Java agent:
    • private and super redirects on the plain and the obfuscated fake game;
    • controllers, variables, blending and rites in the library's self-test.
  • Real clients 26.3 and 1.21.11:
    • Minecraft#createTitle and super.updateIsUnderwater redirected;
    • the heretic's controllers, its query and Rites.play, traced and on screen.