Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prevent the ViaFabricPlus settings button overlapping with ours in the multiplayer menu. #4605

Merged
merged 2 commits into from
May 25, 2024
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
5 changes: 5 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,10 @@ repositories {
name = "vram"
url = "https://maven.vram.io//"
}
maven {
name = "ViaVersion"
url = "https://repo.viaversion.com"
}
mavenCentral()
}

Expand Down Expand Up @@ -58,6 +62,7 @@ dependencies {
modCompileOnly("maven.modrinth:iris:${project.iris_version}") { transitive = false }
//modCompileOnly("io.vram:canvas-fabric-mc119:1.0.+") { transitive = false } // TODO: 1.19.3
modCompileOnly("maven.modrinth:indium:${project.indium_version}") { transitive = false }
modCompileOnly("de.florianmichael:ViaFabricPlus:${project.viafabricplus_version}") { transitive = false }

// Baritone (https://github.com/MeteorDevelopment/baritone)
modCompileOnly "meteordevelopment:baritone:${project.baritone_version}-SNAPSHOT"
Expand Down
3 changes: 3 additions & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -42,3 +42,6 @@ reflections_version=0.10.2

# Netty (https://github.com/netty/netty)
netty_version=4.1.90.Final

# ViaFabricPlus (https://github.com/ViaVersion/ViaFabricPlus)
viafabricplus_version=3.2.1
5 changes: 5 additions & 0 deletions src/main/java/meteordevelopment/meteorclient/MixinPlugin.java
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ public class MixinPlugin implements IMixinConfigPlugin {
private static boolean isLithiumPresent;
public static boolean isIrisPresent;
private static boolean isIndiumPresent;
private static boolean isVFPPresent;

@Override
public void onLoad(String mixinPackage) {
Expand Down Expand Up @@ -74,6 +75,7 @@ public void onLoad(String mixinPackage) {
isLithiumPresent = FabricLoader.getInstance().isModLoaded("lithium");
isIrisPresent = FabricLoader.getInstance().isModLoaded("iris");
isIndiumPresent = FabricLoader.getInstance().isModLoaded("indium");
isVFPPresent = FabricLoader.getInstance().isModLoaded("viafabricplus");

loaded = true;
}
Expand Down Expand Up @@ -106,6 +108,9 @@ else if (mixinClassName.startsWith(mixinPackage + ".lithium")) {
else if (mixinClassName.startsWith(mixinPackage + ".indium")) {
return isIndiumPresent;
}
else if (mixinClassName.startsWith(mixinPackage + ".viafabricplus")) {
return isVFPPresent;
}


return true;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
/*
* This file is part of the Meteor Client distribution (https://github.com/MeteorDevelopment/meteor-client).
* Copyright (c) Meteor Development.
*/

package meteordevelopment.meteorclient.mixin.viafabricplus;

import com.llamalad7.mixinextras.injector.ModifyExpressionValue;
import de.florianmichael.viafabricplus.settings.impl.GeneralSettings;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;

@Mixin(GeneralSettings.class)
public class GeneralSettingsMixin {
// specifies the '2' value on this line:
// public final ModeSetting multiplayerScreenButtonOrientation = new ModeSetting(this, Text.translatable("general_settings.viafabricplus.multiplayer_screen_button_orientation"), 2, ORIENTATION_OPTIONS);
@ModifyExpressionValue(method = "<init>", at = @At(value = "CONSTANT", args = "intValue=2", ordinal = 1), remap = false)
private int modifyDefaultPosition(int original) {
return 4;
}
}
3 changes: 2 additions & 1 deletion src/main/resources/fabric.mod.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@
"meteor-client-sodium.mixins.json",
"meteor-client-canvas.mixins.json",
"meteor-client-lithium.mixins.json",
"meteor-client-indium.mixins.json"
"meteor-client-indium.mixins.json",
"meteor-client-viafabricplus.mixins.json"
],
"accessWidener": "meteor-client.accesswidener",
"custom": {
Expand Down
12 changes: 12 additions & 0 deletions src/main/resources/meteor-client-viafabricplus.mixins.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"required": false,
"package": "meteordevelopment.meteorclient.mixin.viafabricplus",
"compatibilityLevel": "JAVA_21",
"plugin": "meteordevelopment.meteorclient.MixinPlugin",
"client": [
"GeneralSettingsMixin"
],
"injectors": {
"defaultRequire": 1
}
}
Loading