mirror of
https://github.com/TeamMidnightDust/MidnightControls.git
synced 2025-12-14 07:35:10 +01:00
Get Fabric working again, various improvements
This commit is contained in:
@@ -10,7 +10,6 @@
|
||||
package eu.midnightdust.midnightcontrols.client.compat;
|
||||
|
||||
import me.juancarloscp52.bedrockify.client.BedrockifyClient;
|
||||
import me.juancarloscp52.bedrockify.client.BedrockifyClientSettings;
|
||||
|
||||
/**
|
||||
* Represents HQM compatibility handler.
|
||||
|
||||
@@ -19,14 +19,15 @@ public class EmotecraftCompat {
|
||||
if (client.currentScreen instanceof FastChosseScreen) {
|
||||
int x = client.getWindow().getWidth() / 2;
|
||||
int y = client.getWindow().getHeight() / 2;
|
||||
if (index == 0) InputManager.queueMousePosition(x-200, y-200);
|
||||
if (index == 1) InputManager.queueMousePosition(x, y-200);
|
||||
if (index == 2) InputManager.queueMousePosition(x+200, y-200);
|
||||
if (index == 3) InputManager.queueMousePosition(x-200, y);
|
||||
if (index == 4) InputManager.queueMousePosition(x+200, y);
|
||||
if (index == 5) InputManager.queueMousePosition(x-200, y+200);
|
||||
if (index == 6) InputManager.queueMousePosition(x, y+200);
|
||||
if (index == 7) InputManager.queueMousePosition(x+200, y+200);
|
||||
switch (index) {
|
||||
case 0, 3, 5 -> x -= 200;
|
||||
case 2, 4, 7 -> x += 200;
|
||||
}
|
||||
switch (index) {
|
||||
case 0, 1, 2 -> y -= 200;
|
||||
case 5, 6, 7 -> y += 200;
|
||||
}
|
||||
InputManager.queueMousePosition(x, y);
|
||||
|
||||
InputManager.INPUT_MANAGER.updateMousePosition(client);
|
||||
}
|
||||
|
||||
@@ -14,30 +14,37 @@ import net.minecraft.client.MinecraftClient;
|
||||
import net.minecraft.client.gui.screen.Screen;
|
||||
import net.minecraft.client.gui.screen.option.ControlsOptionsScreen;
|
||||
import net.minecraft.client.gui.screen.option.GameOptionsScreen;
|
||||
import net.minecraft.client.gui.widget.OptionListWidget;
|
||||
import net.minecraft.client.gui.widget.TextIconButtonWidget;
|
||||
import net.minecraft.client.option.GameOptions;
|
||||
import net.minecraft.text.Text;
|
||||
import net.minecraft.util.Identifier;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.Shadow;
|
||||
import org.spongepowered.asm.mixin.Unique;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Inject;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||
|
||||
/**
|
||||
* Injects the new controls settings button.
|
||||
*/
|
||||
@Mixin(ControlsOptionsScreen.class)
|
||||
public abstract class ControlsOptionsScreenMixin extends GameOptionsScreen {
|
||||
|
||||
public ControlsOptionsScreenMixin(Screen parent, GameOptions gameOptions, Text title) {
|
||||
super(parent, gameOptions, title);
|
||||
}
|
||||
@Mixin(GameOptionsScreen.class)
|
||||
public abstract class GameOptionsScreenMixin extends Screen {
|
||||
@Shadow @Nullable protected OptionListWidget body;
|
||||
@Unique TextIconButtonWidget midnightcontrols$button = TextIconButtonWidget.builder(Text.translatable("midnightcontrols.menu.title.controller"), (button -> this.client.setScreen(new MidnightControlsSettingsScreen(this, false))), true)
|
||||
.dimension(20,20).texture(Identifier.of("midnightcontrols", "icon/controller"), 20, 20).build();
|
||||
|
||||
@Override
|
||||
public void init() {
|
||||
super.init();
|
||||
this.midnightcontrols$setupButton();
|
||||
this.addDrawableChild(midnightcontrols$button);
|
||||
protected GameOptionsScreenMixin(Text title) {
|
||||
super(title);
|
||||
}
|
||||
|
||||
@Inject(method = "initTabNavigation", at = @At("HEAD"))
|
||||
public void addMidnightButton(CallbackInfo ci) {
|
||||
if (this.getClass().toString().equals(ControlsOptionsScreen.class.toString())) {
|
||||
this.midnightcontrols$setupButton();
|
||||
this.addDrawableChild(midnightcontrols$button);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -1,34 +0,0 @@
|
||||
/*
|
||||
* Copyright © 2021 LambdAurora <aurora42lambda@gmail.com>
|
||||
*
|
||||
* This file is part of midnightcontrols.
|
||||
*
|
||||
* Licensed under the MIT license. For more information,
|
||||
* see the LICENSE file.
|
||||
*/
|
||||
|
||||
package eu.midnightdust.midnightcontrols.event;
|
||||
|
||||
import eu.midnightdust.midnightcontrols.ControlsMode;
|
||||
import net.fabricmc.fabric.api.event.Event;
|
||||
import net.fabricmc.fabric.api.event.EventFactory;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
/**
|
||||
* Represents an event callback which is fired when a player changes the controls mode.
|
||||
*
|
||||
* @author LambdAurora
|
||||
* @version 1.1.0
|
||||
* @since 1.1.0
|
||||
*/
|
||||
@FunctionalInterface
|
||||
public interface PlayerChangeControlsModeCallback {
|
||||
Event<PlayerChangeControlsModeCallback> EVENT = EventFactory.createArrayBacked(PlayerChangeControlsModeCallback.class, listeners -> (player, controlsMode) -> {
|
||||
for (PlayerChangeControlsModeCallback event : listeners) {
|
||||
event.apply(player, controlsMode);
|
||||
}
|
||||
});
|
||||
|
||||
void apply(@NotNull PlayerEntity player, @NotNull ControlsMode controlsMode);
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"accessWidener": "midnightcontrols.accesswidener"
|
||||
}
|
||||
@@ -1,67 +0,0 @@
|
||||
{
|
||||
"schemaVersion": 1,
|
||||
"id": "midnightcontrols",
|
||||
"name": "MidnightControls",
|
||||
"version": "${version}",
|
||||
"description": "Adds controller support and enhanced controls overall.",
|
||||
"authors": [
|
||||
"LambdAurora",
|
||||
"Motschen"
|
||||
],
|
||||
"contributors": [
|
||||
"akemin-dayo",
|
||||
"DioEgizio",
|
||||
"dogtopus",
|
||||
"egeesin",
|
||||
"EnnuiL",
|
||||
"FlashyReese",
|
||||
"gyular",
|
||||
"Hambaka",
|
||||
"Ivanoks",
|
||||
"joaoh1",
|
||||
"KiskaUWU",
|
||||
"Madis0",
|
||||
"RaptaG",
|
||||
"ronniedude",
|
||||
"spudpiggy",
|
||||
"TrueHorse"
|
||||
],
|
||||
"contact": {
|
||||
"homepage": "https://modrinth.com/mod/midnightcontrols",
|
||||
"sources": "https://github.com/TeamMidnightDust/MidnightControls",
|
||||
"issues": "https://github.com/TeamMidnightDust/MidnightControls/issues"
|
||||
},
|
||||
"license": "MIT",
|
||||
"icon": "assets/midnightcontrols/icon.png",
|
||||
"environment": "client",
|
||||
"entrypoints": {
|
||||
"main": [
|
||||
"eu.midnightdust.midnightcontrols.MidnightControls"
|
||||
],
|
||||
"client": [
|
||||
"eu.midnightdust.midnightcontrols.client.MidnightControlsClient"
|
||||
],
|
||||
"modmenu": [
|
||||
"eu.midnightdust.midnightcontrols.client.MidnightControlsModMenu"
|
||||
]
|
||||
},
|
||||
"accessWidener": "midnightcontrols.accesswidener",
|
||||
"mixins": [
|
||||
"midnightcontrols.mixins.json",
|
||||
"midnightcontrols_compat.mixins.json"
|
||||
],
|
||||
"depends": {
|
||||
"fabricloader": ">=0.11.3",
|
||||
"fabric": ">=0.71.0",
|
||||
"minecraft": ">=1.20.5",
|
||||
"obsidianui": ">=0.2.5",
|
||||
"java": ">=17"
|
||||
},
|
||||
"suggests": {
|
||||
"kontrolo": "*"
|
||||
},
|
||||
"breaks": {
|
||||
"lambdacontrols": "*",
|
||||
"modmenu": "<1.12.2"
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,3 @@
|
||||
accessWidener v1 named
|
||||
|
||||
#accessible class net/minecraft/client/gui/widget/EntryListWidget$MoveDirection
|
||||
accessible method net/minecraft/util/Identifier <init> (Ljava/lang/String;Ljava/lang/String;)V
|
||||
#accessible class net/minecraft/client/gui/widget/EntryListWidget$MoveDirection
|
||||
@@ -6,7 +6,7 @@
|
||||
"ClickableWidgetAccessor",
|
||||
"AdvancementsScreenAccessor",
|
||||
"ClientPlayerEntityMixin",
|
||||
"ControlsOptionsScreenMixin",
|
||||
"GameOptionsScreenMixin",
|
||||
"CreativeInventoryScreenAccessor",
|
||||
"GameRendererMixin",
|
||||
"HandledScreenMixin",
|
||||
|
||||
Reference in New Issue
Block a user