mirror of
https://github.com/TeamMidnightDust/MidnightControls.git
synced 2025-12-14 07:35:10 +01:00
fix: controller options button not being clickable
This commit is contained in:
@@ -86,7 +86,7 @@ public class MidnightControlsClient extends MidnightControls {
|
|||||||
int period = 1; // repeat every 0.001 sec. (1000 times a second)
|
int period = 1; // repeat every 0.001 sec. (1000 times a second)
|
||||||
Timer timer = new Timer();
|
Timer timer = new Timer();
|
||||||
timer.scheduleAtFixedRate(new TimerTask() {
|
timer.scheduleAtFixedRate(new TimerTask() {
|
||||||
public void run() { // TODO: Add a try/catch here after the alpha testing period
|
public void run() {
|
||||||
try {
|
try {
|
||||||
if (lateInitDone && client.isRunning()) {
|
if (lateInitDone && client.isRunning()) {
|
||||||
if (MidnightControlsConfig.controlsMode == ControlsMode.CONTROLLER && (client.isWindowFocused() || MidnightControlsConfig.unfocusedInput)) {
|
if (MidnightControlsConfig.controlsMode == ControlsMode.CONTROLLER && (client.isWindowFocused() || MidnightControlsConfig.unfocusedInput)) {
|
||||||
|
|||||||
@@ -33,17 +33,24 @@ import static eu.midnightdust.midnightcontrols.MidnightControls.id;
|
|||||||
@Mixin(GameOptionsScreen.class)
|
@Mixin(GameOptionsScreen.class)
|
||||||
public abstract class GameOptionsScreenMixin extends Screen {
|
public abstract class GameOptionsScreenMixin extends Screen {
|
||||||
@Shadow @Nullable protected OptionListWidget body;
|
@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)
|
@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(id("icon/controller"), 20, 20).build();
|
.dimension(20,20).texture(id("icon/controller"), 20, 20).build();
|
||||||
|
|
||||||
protected GameOptionsScreenMixin(Text title) {
|
protected GameOptionsScreenMixin(Text title) {
|
||||||
super(title);
|
super(title);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Inject(method = "init", at = @At("TAIL"))
|
@Inject(method = "initBody", at = @At("TAIL"))
|
||||||
public void midnightcontrols$addMCButton(CallbackInfo ci) {
|
public void midnightcontrols$addMCButton(CallbackInfo ci) {
|
||||||
if (this.getClass().toString().equals(ControlsOptionsScreen.class.toString())) {
|
if (this.getClass().toString().equals(ControlsOptionsScreen.class.toString())) {
|
||||||
this.midnightcontrols$setButtonPos();
|
this.midnightcontrols$setButtonPos();
|
||||||
|
this.addSelectableChild(midnightcontrols$button);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@Inject(method = "init", at = @At("TAIL"))
|
||||||
|
public void midnightcontrols$drawMCButton(CallbackInfo ci) {
|
||||||
|
if (this.getClass().toString().equals(ControlsOptionsScreen.class.toString())) {
|
||||||
this.addDrawableChild(midnightcontrols$button);
|
this.addDrawableChild(midnightcontrols$button);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user