package info.u_team.u_team_core.intern.discord;

import com.mojang.blaze3d.matrix.MatrixStack;

import info.u_team.u_team_core.gui.elements.ActiveButton;
import info.u_team.u_team_core.intern.config.ClientConfig;
import net.minecraft.client.gui.screen.Screen;
import net.minecraft.util.text.ITextComponent;
import net.minecraftforge.common.ForgeConfigSpec.BooleanValue;

public class DiscordConfigScreen extends Screen {
	
	private final Screen screenBefore;
	
	public DiscordConfigScreen(Screen screenBefore) {
		super(ITextComponent.getTextComponentOrEmpty("discord"));
		this.screenBefore = screenBefore;
	}
	
	@Override
	protected void init() {
		final BooleanValue discordRichPresence = ClientConfig.getInstance().discordRichPresence;
		
		final ITextComponent on = ITextComponent.getTextComponentOrEmpty("Discord connection is on");
		final ITextComponent off = ITextComponent.getTextComponentOrEmpty("Discord connection is off");
		
		final ActiveButton button = addButton(new ActiveButton(30, 50, 200, 20, discordRichPresence.get() ? on : off, 0x006442FF));
		button.setActive(discordRichPresence.get());
		button.setPressable(() -> {
			discordRichPresence.set(!discordRichPresence.get());
			button.setActive(discordRichPresence.get());
			button.setMessage(discordRichPresence.get() ? on : off);
		});
	}
	
	@Override
	public void render(MatrixStack matrixStack, int mouseX, int mouseY, float partialTicks) {
		renderBackground(matrixStack);
		super.render(matrixStack, mouseX, mouseY, partialTicks);
	}
	
	@Override
	public void closeScreen() {
		minecraft.displayGuiScreen(screenBefore);
	}
	
}

@@ -88,17 +88,16 @@
 xStack;%0A
-%0A
 import i
@@ -132,28 +132,17 @@
 lements.
-ActiveButton
+*
 ;%0Aimport
@@ -942,17 +942,42 @@
 eButton 
-b
+toggleDiscordRichPresenceB
 utton = 
@@ -1070,25 +1070,50 @@
 6442FF));%0A%09%09
-b
+toggleDiscordRichPresenceB
 utton.setAct
@@ -1146,17 +1146,42 @@
 t());%0A%09%09
-b
+toggleDiscordRichPresenceB
 utton.se
@@ -1250,33 +1250,58 @@
 ence.get());%0A%09%09%09
-b
+toggleDiscordRichPresenceB
 utton.setActive(
@@ -1331,17 +1331,42 @@
 ());%0A%09%09%09
-b
+toggleDiscordRichPresenceB
 utton.se
@@ -1419,16 +1419,135 @@
 ;%0A%09%09%7D);%0A
+%09%09%0A%09%09addButton(new UButton(30, 80, 200, 20, ITextComponent.getTextComponentOrEmpty(%22Done%22), button -%3E closeScreen()));%0A
 %09%7D%0A%09%0A%09@O

Add doen button