forked from Clones/Controlify
joystick support
This commit is contained in:
@ -0,0 +1,18 @@
|
||||
package dev.isxander.controlify.mixins.core;
|
||||
|
||||
import com.mojang.blaze3d.platform.GLX;
|
||||
import org.lwjgl.glfw.GLFW;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Inject;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
|
||||
|
||||
import java.util.function.LongSupplier;
|
||||
|
||||
@Mixin(value = GLX.class, remap = false)
|
||||
public class GLXMixin {
|
||||
@Inject(method = "_initGlfw", at = @At(value = "INVOKE", target = "Lorg/lwjgl/glfw/GLFW;glfwInit()Z", shift = At.Shift.BEFORE))
|
||||
private static void addInitHints(CallbackInfoReturnable<LongSupplier> cir) {
|
||||
GLFW.glfwInitHint(GLFW.GLFW_JOYSTICK_HAT_BUTTONS, GLFW.GLFW_FALSE);
|
||||
}
|
||||
}
|
@ -25,9 +25,16 @@ public abstract class MinecraftMixin {
|
||||
|
||||
@Shadow public abstract ToastComponent getToasts();
|
||||
|
||||
@ModifyExpressionValue(method = "<init>", at = @At(value = "INVOKE", target = "Lnet/minecraft/server/packs/resources/ReloadableResourceManager;createReload(Ljava/util/concurrent/Executor;Ljava/util/concurrent/Executor;Ljava/util/concurrent/CompletableFuture;Ljava/util/List;)Lnet/minecraft/server/packs/resources/ReloadInstance;"))
|
||||
private ReloadInstance onInputInitialized(ReloadInstance resourceReload) {
|
||||
// Controllers need to be initialized extremely late due to the data-driven nature of controllers.
|
||||
resourceReload.done().thenRun(() -> Controlify.instance().initializeControllers());
|
||||
return resourceReload;
|
||||
}
|
||||
|
||||
@Inject(method = "<init>", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/KeyboardHandler;setup(J)V", shift = At.Shift.AFTER))
|
||||
private void onInputInitialized(CallbackInfo ci) {
|
||||
Controlify.instance().onInitializeInput();
|
||||
Controlify.instance().initializeControlify();
|
||||
}
|
||||
|
||||
@Inject(method = "runTick", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/MouseHandler;turnPlayer()V"))
|
||||
|
Reference in New Issue
Block a user