Skip to content

Commit

Permalink
Make the button open the config screen instead of reconnecting
Browse files Browse the repository at this point in the history
  • Loading branch information
Gaming32 committed Sep 23, 2023
1 parent 193ffe0 commit 298b64c
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 4 deletions.
2 changes: 1 addition & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
plugins {
// `kotlin-dsl`
id("xyz.deftu.gradle.preprocess-root") version "0.4.1"
id("xyz.wagyourtail.unimined") version "1.0.6-SNAPSHOT" apply false
id("xyz.wagyourtail.unimined") version "1.1.0-SNAPSHOT" apply false
}

repositories {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
package io.github.gaming32.worldhost.gui.widget;

import io.github.gaming32.worldhost.WorldHost;
import io.github.gaming32.worldhost.gui.screen.WorldHostConfigScreen;
import io.github.gaming32.worldhost.mixin.PlainTextButtonAccessor;
import io.github.gaming32.worldhost.versions.Components;
import net.minecraft.ChatFormatting;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.Font;
import net.minecraft.client.gui.screens.Screen;
import net.minecraft.network.chat.Component;
import net.minecraft.network.chat.ComponentUtils;
import net.minecraft.network.chat.Style;
Expand Down Expand Up @@ -46,8 +49,13 @@ public class OnlineStatusButton extends PlainTextButton {

public OnlineStatusButton(int alignedX, int y, int height, boolean rightAlign, Font font) {
super(alignedX, y, 0, height, generateStatusComponent(), b -> {
if (getStatus() != 1) {
WorldHost.reconnect(true, true);
if (Screen.hasShiftDown()) {
if (getStatus() != 1) {
WorldHost.reconnect(true, true);
}
} else {
final Minecraft minecraft = Minecraft.getInstance();
minecraft.setScreen(new WorldHostConfigScreen(minecraft.screen));
}
}, font);
this.alignedX = alignedX;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ private void toastRender(float partialTicks, long nanoTime, boolean renderLevel,
//#else
new GuiGraphics(minecraft, renderBuffers.bufferSource()),
//#endif
mouseX, mouseY, partialTicks
mouseX, mouseY, minecraft.getFrameTime()
);
}
//#endif
Expand Down

0 comments on commit 298b64c

Please sign in to comment.