From 49dd056c3d7076c2c16087a3ff1ba174aca02aab Mon Sep 17 00:00:00 2001 From: Colbster937 Date: Tue, 20 Oct 2026 08:04:50 -0500 Subject: [PATCH] feat: fix metallum compat --- .../meteorclient/MixinPlugin.java | 4 ++ .../mixin/metallum/MetalDeviceMixin.java | 49 +++++++++++++++++++ src/main/resources/fabric.mod.json | 3 +- .../meteor-client-metallum.mixins.json | 15 ++++++ 4 files changed, 70 insertions(+), 1 deletion(-) create mode 100644 src/main/java/meteordevelopment/meteorclient/mixin/metallum/MetalDeviceMixin.java create mode 100644 src/main/resources/meteor-client-metallum.mixins.json diff --git a/src/main/java/meteordevelopment/meteorclient/MixinPlugin.java b/src/main/java/meteordevelopment/meteorclient/MixinPlugin.java index 9e9d9da1a4d..d04e014f0af 100644 --- a/src/main/java/meteordevelopment/meteorclient/MixinPlugin.java +++ b/src/main/java/meteordevelopment/meteorclient/MixinPlugin.java @@ -24,6 +24,7 @@ public class MixinPlugin implements IMixinConfigPlugin { private static boolean isLithiumPresent; public static boolean isIrisPresent; private static boolean isBaritonePresent; + private static boolean isMetallumPresent; @Override public void onLoad(String mixinPackage) { @@ -35,6 +36,7 @@ public void onLoad(String mixinPackage) { isLithiumPresent = FabricLoader.getInstance().isModLoaded("lithium"); isIrisPresent = FabricLoader.getInstance().isModLoaded("iris"); isBaritonePresent = FabricLoader.getInstance().isModLoaded("baritone") || FabricLoader.getInstance().isModLoaded("baritone-meteor"); + isMetallumPresent = FabricLoader.getInstance().isModLoaded("metallum"); loaded = true; } @@ -58,6 +60,8 @@ public boolean shouldApplyMixin(String targetClassName, String mixinClassName) { return isLithiumPresent; } else if (mixinClassName.startsWith(mixinPackage + ".baritone")) { return isBaritonePresent; + } else if (mixinClassName.startsWith(mixinPackage + ".metallum")) { + return isMetallumPresent; } diff --git a/src/main/java/meteordevelopment/meteorclient/mixin/metallum/MetalDeviceMixin.java b/src/main/java/meteordevelopment/meteorclient/mixin/metallum/MetalDeviceMixin.java new file mode 100644 index 00000000000..73970a927ea --- /dev/null +++ b/src/main/java/meteordevelopment/meteorclient/mixin/metallum/MetalDeviceMixin.java @@ -0,0 +1,49 @@ +/* + * This file is part of the Meteor Client distribution (https://github.com/MeteorDevelopment/meteor-client). + * Copyright (c) Meteor Development. + */ + +package meteordevelopment.meteorclient.mixin.metallum; + +import com.mojang.renderpearl.backend.api.RenderPassBackend; +import meteordevelopment.meteorclient.mixininterface.IGpuDevice; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.Unique; + +@Mixin(targets = "com.metallum.render.MetalDevice", remap = false) +public abstract class MetalDeviceMixin implements IGpuDevice { + @Unique + private int x, y, width, height; + + @Unique + private boolean set; + + @Override + public void meteor$pushScissor(int x, int y, int width, int height) { + if (set) + throw new IllegalStateException("Currently there can only be one global scissor pushed"); + + this.x = x; + this.y = y; + this.width = width; + this.height = height; + + set = true; + } + + @Override + public void meteor$popScissor() { + if (!set) + throw new IllegalStateException("No scissor pushed"); + + set = false; + } + + @Deprecated + @Override + public void meteor$onCreateRenderPass(RenderPassBackend backend) { + if (set) { + backend.enableScissor(x, y, width, height); + } + } +} diff --git a/src/main/resources/fabric.mod.json b/src/main/resources/fabric.mod.json index b7f86d9697d..b01da247e8a 100644 --- a/src/main/resources/fabric.mod.json +++ b/src/main/resources/fabric.mod.json @@ -31,7 +31,8 @@ "meteor-client-baritone.mixins.json", "meteor-client-indigo.mixins.json", "meteor-client-sodium.mixins.json", - "meteor-client-lithium.mixins.json" + "meteor-client-lithium.mixins.json", + "meteor-client-metallum.mixins.json" ], "accessWidener": "meteor-client.classtweaker", "custom": { diff --git a/src/main/resources/meteor-client-metallum.mixins.json b/src/main/resources/meteor-client-metallum.mixins.json new file mode 100644 index 00000000000..97262e71527 --- /dev/null +++ b/src/main/resources/meteor-client-metallum.mixins.json @@ -0,0 +1,15 @@ +{ + "required": false, + "package": "meteordevelopment.meteorclient.mixin.metallum", + "compatibilityLevel": "JAVA_21", + "plugin": "meteordevelopment.meteorclient.MixinPlugin", + "client": [ + "MetalDeviceMixin" + ], + "injectors": { + "defaultRequire": 1 + }, + "mixinextras": { + "minVersion": "0.5.0" + } +}