package net.minecraft.client.gui.screens;

import net.minecraft.client.Options;
import net.minecraft.network.chat.FormattedText;
import com.mojang.blaze3d.systems.RenderSystem;
import com.mojang.blaze3d.vertex.PoseStack;
import net.minecraft.client.gui.components.Button;
import net.minecraft.Util;
import net.minecraft.network.chat.Component;
import net.minecraft.network.chat.TranslatableComponent;
import net.minecraft.resources.ResourceLocation;

public class DemoIntroScreen extends Screen {
    private static final ResourceLocation DEMO_BACKGROUND_LOCATION;
    
    public DemoIntroScreen() {
        super(new TranslatableComponent("demo.help.title"));
    }
    
    @Override
    protected void init() {
        final int integer2 = -16;
        this.<Button>addButton(new Button(this.width / 2 - 116, this.height / 2 + 62 - 16, 114, 20, new TranslatableComponent("demo.help.buy"), dni -> {
            dni.active = false;
            Util.getPlatform().openUri("http://www.minecraft.net/store?source=demo");
            return;
        }));
        this.<Button>addButton(new Button(this.width / 2 + 2, this.height / 2 + 62 - 16, 114, 20, new TranslatableComponent("demo.help.later"), dni -> {
            this.minecraft.setScreen(null);
            this.minecraft.mouseHandler.grabMouse();
        }));
    }
    
    @Override
    public void renderBackground(final PoseStack dhl) {
        super.renderBackground(dhl);
        RenderSystem.color4f(1.0f, 1.0f, 1.0f, 1.0f);
        this.minecraft.getTextureManager().bind(DemoIntroScreen.DEMO_BACKGROUND_LOCATION);
        final int integer3 = (this.width - 248) / 2;
        final int integer4 = (this.height - 166) / 2;
        this.blit(dhl, integer3, integer4, 0, 0, 248, 166);
    }
    
    @Override
    public void render(final PoseStack dhl, final int integer2, final int integer3, final float float4) {
        this.renderBackground(dhl);
        final int integer4 = (this.width - 248) / 2 + 10;
        int integer5 = (this.height - 166) / 2 + 8;
        this.font.draw(dhl, this.title, (float)integer4, (float)integer5, 2039583);
        integer5 += 12;
        final Options dmb8 = this.minecraft.options;
        this.font.draw(dhl, new TranslatableComponent("demo.help.movementShort", new Object[] { dmb8.keyUp.getTranslatedKeyMessage(), dmb8.keyLeft.getTranslatedKeyMessage(), dmb8.keyDown.getTranslatedKeyMessage(), dmb8.keyRight.getTranslatedKeyMessage() }), (float)integer4, (float)integer5, 5197647);
        this.font.draw(dhl, new TranslatableComponent("demo.help.movementMouse"), (float)integer4, (float)(integer5 + 12), 5197647);
        this.font.draw(dhl, new TranslatableComponent("demo.help.jump", new Object[] { dmb8.keyJump.getTranslatedKeyMessage() }), (float)integer4, (float)(integer5 + 24), 5197647);
        this.font.draw(dhl, new TranslatableComponent("demo.help.inventory", new Object[] { dmb8.keyInventory.getTranslatedKeyMessage() }), (float)integer4, (float)(integer5 + 36), 5197647);
        this.font.drawWordWrap(new TranslatableComponent("demo.help.fullWrapped"), integer4, integer5 + 68, 218, 2039583);
        super.render(dhl, integer2, integer3, float4);
    }
    
    static {
        DEMO_BACKGROUND_LOCATION = new ResourceLocation("textures/gui/demo_background.png");
    }
}
