Files
saturnclient/src/main/java/org/saturnclient/impl/mixins/MatrixStackMixin.java
T
selimaj-devandclaude 09bc223b8b Implement the Ref interfaces explicitly in their mixins
Several mixins implemented a Ref method only through a vanilla method
of the same name. Released jars rename vanilla methods to intermediary
names, so those Ref methods had no implementation there and threw
AbstractMethodError: the armour display's durability, the status
effects' icon and infinite checks, the SVG texture size and the
pre-1.21.6 matrix stack's push and pop. With Mojang's names the same
happens in development (1.21.4 crashed on the title screen).

Each mixin now shadows the vanilla method and implements the Ref
method by calling it. Points common at the Ref renames this needs.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-09-30 17:42:48 +02:00

80 lines
2.1 KiB
Java

package org.saturnclient.impl.mixins;
import com.mojang.blaze3d.vertex.PoseStack;
import org.spongepowered.asm.mixin.Mixin;
//? if <1.21.6 {
/*import org.saturnclient.common.ref.render.MatrixStackRef;
//? if >=1.21.5
import org.joml.Quaternionfc;
//? if <1.21.5
//import org.joml.Quaternionf;
import org.spongepowered.asm.mixin.Shadow;
import com.mojang.math.Axis;
*///?}
/**
* Makes MatrixStack a MatrixStackRef, for GUI drawing before 1.21.6. From 1.21.6 the GUI uses a 2D
* Matrix3x2fStack (Matrix3x2fStackRef) instead, so this mixin is empty but stays registered, keeping
* impl.mixins.json the same for every version.
*/
@Mixin(PoseStack.class)
//? if <1.21.6 {
/*public abstract class MatrixStackMixin implements MatrixStackRef {
@Shadow
public abstract void pushPose();
@Shadow
public abstract void popPose();
@Shadow
public abstract void translate(float x, float y, float z);
@Shadow
public abstract void scale(float x, float y, float z);
@Shadow
//? if >=1.21.5
public abstract void mulPose(Quaternionfc quaternion);
//? if <1.21.5
//public abstract void mulPose(Quaternionf quaternion);
@Shadow
//? if >=1.21.5
public abstract void rotateAround(Quaternionfc quaternion, float originX, float originY, float originZ);
//? if <1.21.5
//public abstract void rotateAround(Quaternionf quaternion, float originX, float originY, float originZ);
// MatrixStackRef's methods delegate to PoseStack's, whose names production renames.
@Override
public void push() {
pushPose();
}
@Override
public void pop() {
popPose();
}
@Override
public void translate(float x, float y) {
translate(x, y, 0);
}
@Override
public void scale(float x, float y) {
scale(x, y, 1.0f);
}
@Override
public void rotate(float angle, float originX, float originY, float originZ) {
rotateAround(Axis.ZN.rotationDegrees(angle), originX, originY, originZ);
}
@Override
public void rotate(float angle) {
mulPose(Axis.ZN.rotationDegrees(angle));
}
}
*///?} else
public abstract class MatrixStackMixin {}