|  | 
|  | 1 | +package me.juancarloscp52.bedrockify.client.gui; | 
|  | 2 | + | 
|  | 3 | +import me.juancarloscp52.bedrockify.client.gui.bedrockMenus.BedrockifyIconButtonTextures; | 
|  | 4 | +import me.juancarloscp52.bedrockify.client.gui.bedrockMenus.GuiUtils; | 
|  | 5 | +import me.juancarloscp52.bedrockify.client.gui.bedrockMenus.widgets.*; | 
|  | 6 | +import me.juancarloscp52.bedrockify.client.gui.bedrockMenus.widgets.entryList.BedrockifyEntry; | 
|  | 7 | +import me.juancarloscp52.bedrockify.client.gui.bedrockMenus.widgets.entryList.BedrockifyEntryListWidget; | 
|  | 8 | +import net.minecraft.client.gui.DrawContext; | 
|  | 9 | +import net.minecraft.client.gui.screen.Screen; | 
|  | 10 | +import net.minecraft.client.render.RenderLayer; | 
|  | 11 | +import net.minecraft.text.Text; | 
|  | 12 | +import net.minecraft.util.Identifier; | 
|  | 13 | +import net.minecraft.util.math.ColorHelper; | 
|  | 14 | + | 
|  | 15 | +public class Test extends Screen { | 
|  | 16 | + | 
|  | 17 | +    BedrockifyEntryListWidget test; | 
|  | 18 | +    BedrockifyEntryListWidget test2; | 
|  | 19 | +    BedrockifyIconButtonTextures video = new BedrockifyIconButtonTextures(Identifier.of("bedrockify", "icons/video"), Identifier.of("bedrockify", "icons/video_highlighted")); | 
|  | 20 | +    BedrockifyIconButtonTextures back = new BedrockifyIconButtonTextures(Identifier.of("bedrockify", "widgets/back_button"), Identifier.of("bedrockify", "widgets/back_button_highlighted"), 4, 7); | 
|  | 21 | + | 
|  | 22 | + | 
|  | 23 | +    int header = 23; | 
|  | 24 | +    int sidebarWidth = (int) (this.width*0.4f); | 
|  | 25 | +    Screen previous; | 
|  | 26 | +    public Test(Text title, Screen previous) { | 
|  | 27 | +        super(title); | 
|  | 28 | +    } | 
|  | 29 | + | 
|  | 30 | +    @Override | 
|  | 31 | +    protected void init() { | 
|  | 32 | +        this.addDrawableChild(new BedrockifyIconButtonWidget.Builder(Text.literal("Back"), button -> client.setScreen(previous), back).dimensions(4,4,12,14).build()); | 
|  | 33 | +        sidebarWidth = (int) (this.width*0.4f); | 
|  | 34 | +        test = this.addDrawableChild(new BedrockifyEntryListWidget(client, sidebarWidth, this.height-header, header, 30, 0)); | 
|  | 35 | +        test.setX(0); | 
|  | 36 | +        test.children().add(new BedrockifyEntry(new BedrockifyButtonWidget.Builder(Text.literal("Video"), button -> System.out.println("PRESSED")).icon(video).position(220, 10).width(test.getRowWidth()).build())); | 
|  | 37 | +        test.children().add(new BedrockifyEntry(new BedrockifyButtonWidget.Builder(Text.literal("Button 1"), button -> System.out.println("PRESSED")).position(220, 10).icon(video).width(test.getRowWidth()).build())); | 
|  | 38 | +        test.children().add(new BedrockifyEntry(new BedrockifyTextWidget(Text.literal("Category Separator Centered")))); | 
|  | 39 | +        test.children().add(new BedrockifyEntry(new BedrockifyButtonWidget.Builder(Text.literal("Button 2"), button -> System.out.println("PRESSED")).position(220, 10).width(test.getRowWidth()).build())); | 
|  | 40 | +        test.children().add(new BedrockifyEntry(new BedrockifyButtonWidget.Builder(Text.literal("Button 3"), button -> System.out.println("PRESSED")).position(220, 10).width(test.getRowWidth()).build())); | 
|  | 41 | +        test.children().add(new BedrockifyEntry(new BedrockifyTextWidget(Text.literal("Category Separator top"), GuiUtils.VerticalLocation.TOP))); | 
|  | 42 | +        test.children().add(new BedrockifyEntry(new BedrockifyButtonWidget.Builder(Text.literal("Button 69"), button -> System.out.println("PRESSED")).position(220, 10).width(test.getRowWidth()).build())); | 
|  | 43 | +        test.children().add(new BedrockifyEntry(new BedrockifyButtonWidget.Builder(Text.literal("Button 69"), button -> System.out.println("PRESSED")).position(220, 10).width(test.getRowWidth()).build())); | 
|  | 44 | +        test.children().add(new BedrockifyEntry(new BedrockifyTextWidget(Text.literal("Category Separator bottom"), GuiUtils.VerticalLocation.BOTTOM))); | 
|  | 45 | +        test.children().add(new BedrockifyEntry(new BedrockifyButtonWidget.Builder(Text.literal("Button 69"), button -> System.out.println("PRESSED")).position(220, 10).width(test.getRowWidth()).build())); | 
|  | 46 | +        test.children().add(new BedrockifyEntry(new BedrockifyButtonWidget.Builder(Text.literal("Button 69"), button -> System.out.println("PRESSED")).position(220, 10).width(test.getRowWidth()).build())); | 
|  | 47 | +        test.children().add(new BedrockifyEntry(new BedrockifyButtonWidget.Builder(Text.literal("Button 69"), button -> System.out.println("PRESSED")).position(220, 10).width(test.getRowWidth()).build())); | 
|  | 48 | + | 
|  | 49 | +        test2 = this.addDrawableChild(new BedrockifyEntryListWidget(client, this.width-sidebarWidth-4, this.height-header, header, 30, 0)); | 
|  | 50 | +        var text = new BedrockifyTextFieldWidget(this.textRenderer,100,Text.literal("Example Text Field"), Text.literal("")); | 
|  | 51 | +        text.setPlaceholder(Text.literal("Escribe aqui...")); | 
|  | 52 | +        test2.setX(sidebarWidth+4); | 
|  | 53 | +        test2.children().add(new BedrockifyEntry(new BedrockifyToggleWidget.Builder(Text.literal("Toggle Option 1"), button -> System.out.println("PRESSED")).position(5, 16).build(),20)); | 
|  | 54 | +        test2.children().add(new BedrockifyEntry(new BedrockifyToggleWidget.Builder(Text.literal("Toggle Option 2"), button -> System.out.println("PRESSED")).position(5, 16).build(), 20)); | 
|  | 55 | +        test2.children().add(new BedrockifyEntry(new BedrockifySliderWidget(0,0,test2.getRowWidth(), Text.literal("Slider Option: "),0.5d),35)); | 
|  | 56 | +        test2.children().add(new BedrockifyEntry(text)); | 
|  | 57 | +        test2.children().add(new BedrockifyEntry(new BedrockifyColorFieldWidget(this.textRenderer,100,50,100,Text.literal("Example Color Field"), false, ColorHelper.getArgb(0,0,255)))); | 
|  | 58 | +        test2.children().add(new BedrockifyEntry(new BedrockifyButtonWidget.Builder(Text.literal("Button"), button -> System.out.println("PRESSED")).position(220, 10).width(test2.getRowWidth()).build())); | 
|  | 59 | +        test2.children().add(new BedrockifyEntry(new BedrockifyButtonWidget.Builder(Text.literal("Button"), button -> System.out.println("PRESSED")).position(220, 10).width(test2.getRowWidth()).build())); | 
|  | 60 | +        test2.children().add(new BedrockifyEntry(new BedrockifyButtonWidget.Builder(Text.literal("Button"), button -> System.out.println("PRESSED")).position(220, 10).width(test2.getRowWidth()).build())); | 
|  | 61 | +        test2.children().add(new BedrockifyEntry(new BedrockifyButtonWidget.Builder(Text.literal("Button"), button -> System.out.println("PRESSED")).position(220, 10).title(Text.literal("TITLE TEST:")).width(test2.getRowWidth()).build())); | 
|  | 62 | +        test2.children().add(new BedrockifyEntry(new BedrockifyButtonWidget.Builder(Text.literal("Button"), button -> System.out.println("PRESSED")).position(220, 10).width(test2.getRowWidth()).build())); | 
|  | 63 | +        test2.children().add(new BedrockifyEntry(new BedrockifyButtonWidget.Builder(Text.literal("Button"), button -> System.out.println("PRESSED")).position(220, 10).width(test2.getRowWidth()).build(),50)); | 
|  | 64 | +        test2.children().add(new BedrockifyEntry(new BedrockifyButtonWidget.Builder(Text.literal("Button"), button -> System.out.println("PRESSED")).position(220, 10).width(test2.getRowWidth()).build())); | 
|  | 65 | + | 
|  | 66 | + | 
|  | 67 | + | 
|  | 68 | +    } | 
|  | 69 | + | 
|  | 70 | +    @Override | 
|  | 71 | +    public void renderBackground(DrawContext context, int mouseX, int mouseY, float deltaTicks) { | 
|  | 72 | +        super.renderBackground(context, mouseX, mouseY, deltaTicks); | 
|  | 73 | +        context.drawGuiTexture(RenderLayer::getGuiTextured, Identifier.of("bedrockify", "header"), 0, 0, this.width, header); | 
|  | 74 | +        context.drawGuiTexture(RenderLayer::getGuiTextured, Identifier.of("bedrockify", "separator"), sidebarWidth, header-1, 4, this.height-header+1); | 
|  | 75 | +        context.drawText(textRenderer, this.title, 18, 7, ColorHelper.getArgb(76, 76, 76), false); | 
|  | 76 | +    } | 
|  | 77 | +} | 
|  | 78 | + | 
0 commit comments