mirror of
https://github.com/chylex/Better-Controls.git
synced 2025-05-23 07:34:04 +02:00
Add support for Mod Menu configuration button & set priority on HookOpenScreen
This commit is contained in:
parent
d28ece5759
commit
e9a339f025
@ -36,4 +36,5 @@ tasks.withType(JavaCompile) {
|
|||||||
|
|
||||||
jar {
|
jar {
|
||||||
from "LICENSE"
|
from "LICENSE"
|
||||||
|
exclude "io/github/prospector/"
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,11 @@
|
|||||||
|
package chylex.bettercontrols.compatibility;
|
||||||
|
import chylex.bettercontrols.gui.BetterControlsScreen;
|
||||||
|
import io.github.prospector.modmenu.api.ConfigScreenFactory;
|
||||||
|
import io.github.prospector.modmenu.api.ModMenuApi;
|
||||||
|
|
||||||
|
public class ModMenuSupport implements ModMenuApi{
|
||||||
|
@Override
|
||||||
|
public ConfigScreenFactory<?> getModConfigScreenFactory(){
|
||||||
|
return BetterControlsScreen::new;
|
||||||
|
}
|
||||||
|
}
|
@ -9,7 +9,7 @@ import org.spongepowered.asm.mixin.injection.At;
|
|||||||
import org.spongepowered.asm.mixin.injection.Inject;
|
import org.spongepowered.asm.mixin.injection.Inject;
|
||||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||||
|
|
||||||
@Mixin(MinecraftClient.class)
|
@Mixin(value = MinecraftClient.class, priority = 100)
|
||||||
public abstract class HookOpenScreen{
|
public abstract class HookOpenScreen{
|
||||||
@Inject(method = "openScreen(Lnet/minecraft/client/gui/screen/Screen;)V", at = @At("TAIL"))
|
@Inject(method = "openScreen(Lnet/minecraft/client/gui/screen/Screen;)V", at = @At("TAIL"))
|
||||||
private void openScreen(final Screen ignore, final CallbackInfo ci){
|
private void openScreen(final Screen ignore, final CallbackInfo ci){
|
||||||
|
@ -0,0 +1,8 @@
|
|||||||
|
package io.github.prospector.modmenu.api;
|
||||||
|
import net.minecraft.client.gui.screen.Screen;
|
||||||
|
|
||||||
|
@SuppressWarnings("unused")
|
||||||
|
@FunctionalInterface
|
||||||
|
public interface ConfigScreenFactory<S extends Screen>{
|
||||||
|
S create(Screen var1);
|
||||||
|
}
|
@ -0,0 +1,14 @@
|
|||||||
|
package io.github.prospector.modmenu.api;
|
||||||
|
import com.google.common.collect.ImmutableMap;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
@SuppressWarnings("unused")
|
||||||
|
public interface ModMenuApi{
|
||||||
|
default ConfigScreenFactory<?> getModConfigScreenFactory(){
|
||||||
|
return ignore -> null;
|
||||||
|
}
|
||||||
|
|
||||||
|
default Map<String, ConfigScreenFactory<?>> getProvidedConfigScreenFactories(){
|
||||||
|
return ImmutableMap.of();
|
||||||
|
}
|
||||||
|
}
|
@ -4,7 +4,7 @@
|
|||||||
"version": "${version}",
|
"version": "${version}",
|
||||||
|
|
||||||
"name": "Better Controls",
|
"name": "Better Controls",
|
||||||
"description": "Adds many powerful key bindings and options to control your movement.\nThe features complement vanilla mechanics without giving unfair advantages, so server use should be fine.\nTo configure the mod, open Options - Controls - Better Controls. If you want to see the vanilla Controls screen, hold Alt while opening it.",
|
"description": "Adds many powerful key bindings and options to control your movement.\nThe features complement vanilla mechanics without giving unfair advantages, so server use should be fine.",
|
||||||
"icon": "assets/bettercontrols/icon.png",
|
"icon": "assets/bettercontrols/icon.png",
|
||||||
"license": "MPL-2.0",
|
"license": "MPL-2.0",
|
||||||
|
|
||||||
@ -17,7 +17,8 @@
|
|||||||
|
|
||||||
"environment": "client",
|
"environment": "client",
|
||||||
"entrypoints": {
|
"entrypoints": {
|
||||||
"client": [ "chylex.bettercontrols.BetterControlsMod" ]
|
"client": [ "chylex.bettercontrols.BetterControlsMod" ],
|
||||||
|
"modmenu": [ "chylex.bettercontrols.compatibility.ModMenuSupport" ]
|
||||||
},
|
},
|
||||||
|
|
||||||
"mixins": [{
|
"mixins": [{
|
||||||
@ -28,9 +29,5 @@
|
|||||||
"depends": {
|
"depends": {
|
||||||
"fabricloader": ">=0.7.4",
|
"fabricloader": ">=0.7.4",
|
||||||
"minecraft": "1.16.x"
|
"minecraft": "1.16.x"
|
||||||
},
|
|
||||||
|
|
||||||
"custom": {
|
|
||||||
"modmenu:clientsideOnly": true
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user