blob: 99a59f9d2eebdb439009c9e37b1a3dac69e7c186 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
package club.eviltransgenders.autoreconnect.mixin;
import net.minecraft.client.gui.components.Button;
import net.minecraft.client.gui.layouts.LinearLayout;
import net.minecraft.client.gui.screens.DisconnectedScreen;
import net.minecraft.network.chat.Component;
import org.spongepowered.asm.mixin.Final;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
@Mixin(DisconnectedScreen.class)
public abstract class DisconnectedScreenMixin {
@Shadow
@Final
private LinearLayout layout;
@Inject(at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/layouts/LinearLayout;visitWidgets(Ljava/util/function/Consumer;)V"), method = "init")
private void addAutoReconnectButtons(CallbackInfo ci) {
Button reconnectButton = Button.builder(Component.translatable("gui.autoreconnect.reconnect"), btn -> {}).width(200).build();
this.layout.addChild(reconnectButton);
this.layout.arrangeElements();
}
}
|