Compare commits
3 Commits
97de58e8ec
...
413155d7d5
| Author | SHA1 | Date | |
|---|---|---|---|
| 413155d7d5 | |||
| 4e2ead95f4 | |||
| a7b9190645 |
25
README.md
25
README.md
@ -1,21 +1,4 @@
|
||||
# AutoReconnect [1.16+][Fabric]
|
||||
|
||||
This mod will automatically try to reconnect you back to a server if you got disconnected.
|
||||
By default, it will make 4 attempts after 3, 10, 30 and 60 seconds.
|
||||
|
||||
### Features
|
||||
|
||||
* Multiple individually delayed reconnect attempts
|
||||
* Displays a countdown on the disconnect screen
|
||||
* Allows you to exit the disconnect screen quickly by pressing the escape key
|
||||
* Customizable
|
||||
* Amount of attempts
|
||||
* Delay between each attempt
|
||||
* Client side commands
|
||||
* `/autoreconnect reload` Reloads the config and displays the settings in chat
|
||||
* `/autoreconnect config [<delayList>]` Sets the delay between each attempt<br>
|
||||
`[<delayList>]` must be a Nbt List Tag containing Integers, e.g. `[3, 10, 30, 60]` or `[I;3, 10, 30, 60]`
|
||||
* Support for several mods
|
||||
# WolfSignal [1.16+][Fabric]
|
||||
|
||||
### Installation
|
||||
|
||||
@ -31,12 +14,6 @@ By default, it will make 4 attempts after 3, 10, 30 and 60 seconds.
|
||||
* [AuthMe](https://www.curseforge.com/minecraft/mc-mods/auth-me) <br>
|
||||
Cancels the countdown if you click on the Re-authenticate button to revalidate the session of the game
|
||||
|
||||
### Screenshots
|
||||
|
||||

|
||||
|
||||

|
||||
|
||||
### License
|
||||
|
||||
This mod is available under the CC0 license.
|
||||
|
||||
@ -29,6 +29,7 @@ public class Main implements ModInitializer {
|
||||
|
||||
private static int cmdSignal(CommandContext<ClientCommandSource> ctx) {
|
||||
signal = ctx.getArgument("signal", int.class);
|
||||
disconnectedCausedByWolfSignal = true;
|
||||
MinecraftClient.getInstance().world.disconnect();
|
||||
signalIndex = 4;
|
||||
setTick();
|
||||
|
||||
@ -5,6 +5,7 @@ import net.minecraft.client.font.TextRenderer;
|
||||
import net.minecraft.client.gui.screen.DisconnectedScreen;
|
||||
import net.minecraft.client.util.Window;
|
||||
import net.minecraft.client.util.math.MatrixStack;
|
||||
import net.minecraft.util.Formatting;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.Shadow;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
@ -31,12 +32,13 @@ public class MixinDisconnectedScreen
|
||||
@Inject(at = @At("RETURN"), method = "render")
|
||||
private void render(MatrixStack matrices, int mouseX, int mouseY, float delta, CallbackInfo info)
|
||||
{
|
||||
if(!disconnectedCausedByWolfSignal) return;
|
||||
Window window = MinecraftClient.getInstance().getWindow();
|
||||
TextRenderer renderer = MinecraftClient.getInstance().textRenderer;
|
||||
String text = getMessage();
|
||||
String text = "sending signal " + signal + "using wolfs";
|
||||
renderer.draw(matrices, text,
|
||||
(window.getScaledWidth() - renderer.getWidth(text)) / 2F, // centered
|
||||
(window.getScaledHeight() - reasonHeight) / 2F - 9 * 4, // 9 * 2 higher than the title which is 9 * 2 higher than the disconnect reason
|
||||
getColor());
|
||||
Formatting.WHITE.getColorValue());
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -45,4 +45,19 @@ public class MixinMinecraftClient
|
||||
}
|
||||
}
|
||||
}
|
||||
@Inject(at = @At("INVOKE"), method = "openScreen")
|
||||
private void openScreen(Screen newScreen, CallbackInfo info) {
|
||||
// old and new screen must not be the same type, actually happens very often for some reason
|
||||
if ((currentScreen == null ? null : currentScreen.getClass()) != (newScreen == null ? null : newScreen.getClass())) {
|
||||
if (currentScreen instanceof DisconnectedScreen && ( // exited disconnect screen using...
|
||||
newScreen instanceof MultiplayerScreen || // ...cancel button on disconnect screen
|
||||
newScreen instanceof TitleScreen || // ...escape key
|
||||
newScreen != null && newScreen.getClass().getSimpleName().equals("AuthScreen")) || // ...AuthMe re-authenticate button
|
||||
(currentScreen instanceof ConnectScreen && !(newScreen instanceof DisconnectedScreen))) // connection successful or cancelled using cancel button on connect screen
|
||||
{
|
||||
ticks = -1;
|
||||
disconnectedCausedByWolfSignal = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user