Mixin Context
The object handed to a Mixin injection callback. It is the live link between the running Minecraft method and the script: read the receiver and arguments, cancel the call, or substitute its return value.
import { Mixin } from 'ratph6.tessera.api';
// Stop the player from ever taking fall damage.
Mixin.inject("net.minecraft.world.entity.LivingEntity", "causeFallDamage", "HEAD", (ctx) => {
ctx.cancel(); // skip the original method body
});
// Force a method that returns a boolean to always return true.
Mixin.inject("net.minecraft.client.player.LocalPlayer", "isSprinting", "RETURN", (ctx) => {
ctx.setReturnValue(true);
});The self receiver and the boxed args mirror the target method's signature (primitive arguments arrive boxed, e.g. an int becomes a java.lang.Integer). args is read-only — mutating elements does not change the values the original method sees.
The field-access surface (cancelled, returnValue, hasReturnOverride) is read directly by the bytecode Tessera injects into the target method, so the names and descriptors here are an ABI — keep them in sync with MixinTransformer.
Constructors
Properties
True once setReturnValue has been called — tells the injected bytecode to use returnValue.
At a RETURN injection this starts as the method's actual return value; setReturnValue replaces it.
Functions
Substitute the method's return value. At a HEAD injection this also cancels the original body; at a RETURN injection it replaces the value about to be returned. The value must be assignable to the method's declared return type (an unbox/checkcast happens in the injected bytecode).