Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions src/main/java/meteordevelopment/meteorclient/MixinPlugin.java
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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;
}
Expand All @@ -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;
}


Expand Down
Original file line number Diff line number Diff line change
@@ -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);
}
}
}
3 changes: 2 additions & 1 deletion src/main/resources/fabric.mod.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down
15 changes: 15 additions & 0 deletions src/main/resources/meteor-client-metallum.mixins.json
Original file line number Diff line number Diff line change
@@ -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"
}
}
Loading