added 1.16.1 support by changing some code (still works for 1.16.2)
fixed timer resetting so reconnecting can be canceled and works multiple times fixed typo in .gitignore added icon
This commit is contained in:
2
.gitignore
vendored
2
.gitignore
vendored
@ -27,4 +27,4 @@ bin/
|
|||||||
# fabric
|
# fabric
|
||||||
|
|
||||||
run/
|
run/
|
||||||
log/
|
logs/
|
||||||
|
|||||||
@ -11,12 +11,12 @@ version = project.mod_version
|
|||||||
group = project.maven_group
|
group = project.maven_group
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
minecraft "com.mojang:minecraft:1.16.2"
|
minecraft "com.mojang:minecraft:1.16.1"
|
||||||
mappings "net.fabricmc:yarn:1.16.2+build.43:v2"
|
mappings "net.fabricmc:yarn:1.16.1+build.21:v2"
|
||||||
modImplementation "net.fabricmc:fabric-loader:0.9.2+build.206"
|
modImplementation "net.fabricmc:fabric-loader:0.9.3+build.207"
|
||||||
|
|
||||||
//Fabric api
|
//Fabric api
|
||||||
modImplementation "net.fabricmc.fabric-api:fabric-api:0.19.0+build.398-1.16"
|
modImplementation "net.fabricmc.fabric-api:fabric-api:0.18.0+build.387-1.16.1"
|
||||||
}
|
}
|
||||||
|
|
||||||
processResources {
|
processResources {
|
||||||
|
|||||||
@ -3,9 +3,9 @@ org.gradle.jvmargs=-Xmx1G
|
|||||||
|
|
||||||
# Fabric Properties
|
# Fabric Properties
|
||||||
# check these on https://fabricmc.net/use
|
# check these on https://fabricmc.net/use
|
||||||
minecraft_version=1.16.2
|
minecraft_version=1.16.1
|
||||||
yarn_mappings=1.16.2+build.43
|
yarn_mappings=1.16.1+build.21
|
||||||
loader_version=0.9.2+build.206
|
loader_version=0.9.3+build.207
|
||||||
|
|
||||||
# Mod Properties
|
# Mod Properties
|
||||||
mod_version = 1.0.0
|
mod_version = 1.0.0
|
||||||
@ -14,4 +14,4 @@ org.gradle.jvmargs=-Xmx1G
|
|||||||
|
|
||||||
# Dependencies
|
# Dependencies
|
||||||
# currently not on the main fabric site, check on the maven: https://maven.fabricmc.net/net/fabricmc/fabric-api/fabric-api
|
# currently not on the main fabric site, check on the maven: https://maven.fabricmc.net/net/fabricmc/fabric-api/fabric-api
|
||||||
fabric_version=0.19.0+build.398-1.16
|
fabric_version=0.18.0+build.387-1.16.1
|
||||||
@ -47,6 +47,7 @@ public class AutoReconnect implements ModInitializer
|
|||||||
cancel();
|
cancel();
|
||||||
attempt = 0;
|
attempt = 0;
|
||||||
connect = false;
|
connect = false;
|
||||||
|
System.out.println("reset");
|
||||||
}
|
}
|
||||||
|
|
||||||
public static int getCountdown()
|
public static int getCountdown()
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
package net.autoreconnect.mixin;
|
package net.autoreconnect.mixin;
|
||||||
|
|
||||||
import net.minecraft.client.MinecraftClient;
|
import net.minecraft.client.MinecraftClient;
|
||||||
import net.minecraft.client.gui.DrawableHelper;
|
import net.minecraft.client.font.TextRenderer;
|
||||||
import net.minecraft.client.gui.screen.DisconnectedScreen;
|
import net.minecraft.client.gui.screen.DisconnectedScreen;
|
||||||
import net.minecraft.client.util.Window;
|
import net.minecraft.client.util.Window;
|
||||||
import net.minecraft.client.util.math.MatrixStack;
|
import net.minecraft.client.util.math.MatrixStack;
|
||||||
@ -27,11 +27,11 @@ public class MixinDisconnectedScreen
|
|||||||
private void render(MatrixStack matrices, int mouseX, int mouseY, float delta, CallbackInfo info)
|
private void render(MatrixStack matrices, int mouseX, int mouseY, float delta, CallbackInfo info)
|
||||||
{
|
{
|
||||||
Window window = MinecraftClient.getInstance().getWindow();
|
Window window = MinecraftClient.getInstance().getWindow();
|
||||||
DrawableHelper.drawCenteredString(matrices,
|
TextRenderer renderer = MinecraftClient.getInstance().textRenderer;
|
||||||
MinecraftClient.getInstance().textRenderer,
|
String text = attempt == -1 ? "Can not reconnect!" : "Reconnecting in " + getCountdown() + "...";
|
||||||
attempt == -1 ? "Can not reconnect!" : "Reconnecting in " + getCountdown() + "...",
|
renderer.draw(matrices, text,
|
||||||
window.getScaledWidth() / 2,
|
(window.getScaledWidth() - renderer.getWidth(text)) / 2F,
|
||||||
window.getScaledHeight() / 4,
|
(window.getScaledHeight() - renderer.fontHeight) / 3F,
|
||||||
0xFF4422);
|
0xFF4422);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -30,6 +30,7 @@ public class MixinMinecraftClient
|
|||||||
{
|
{
|
||||||
System.out.println(screen == null ? null : screen.getClass().getSimpleName());
|
System.out.println(screen == null ? null : screen.getClass().getSimpleName());
|
||||||
//TODO interpret disconnect reason
|
//TODO interpret disconnect reason
|
||||||
|
//TODO revalidate session if needed
|
||||||
if (screen instanceof DisconnectedScreen)
|
if (screen instanceof DisconnectedScreen)
|
||||||
{
|
{
|
||||||
if (attempt < 0) return;
|
if (attempt < 0) return;
|
||||||
@ -53,6 +54,7 @@ public class MixinMinecraftClient
|
|||||||
}
|
}
|
||||||
else if (screen instanceof MultiplayerScreen || MinecraftClient.getInstance().player != null)
|
else if (screen instanceof MultiplayerScreen || MinecraftClient.getInstance().player != null)
|
||||||
{
|
{
|
||||||
|
System.out.println(screen == null ? null : screen.getClass().getSimpleName());
|
||||||
//TODO find better conditions to reset
|
//TODO find better conditions to reset
|
||||||
reset();
|
reset();
|
||||||
}
|
}
|
||||||
@ -72,7 +74,7 @@ public class MixinMinecraftClient
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
mc.disconnect();
|
mc.disconnect();
|
||||||
mc.openScreen(new ConnectScreen(new TitleScreen(), mc, lastServerEntry));
|
mc.openScreen(new ConnectScreen(new MultiplayerScreen(new TitleScreen()), mc, lastServerEntry));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
BIN
src/main/resources/assets/icon.png
Normal file
BIN
src/main/resources/assets/icon.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 9.9 KiB |
Reference in New Issue
Block a user