11package com .cleanroommc .modularui .test ;
22
3- import com .cleanroommc .modularui .api .drawable .IKey ;
4- import com .cleanroommc .modularui .api .layout .IViewportStack ;
5- import com .cleanroommc .modularui .drawable .GuiTextures ;
63import com .cleanroommc .modularui .screen .CustomModularScreen ;
74import com .cleanroommc .modularui .screen .ModularPanel ;
85import com .cleanroommc .modularui .screen .viewport .GuiContext ;
9- import com .cleanroommc .modularui .widget . Widget ;
10-
11- import net . minecraft . client . Minecraft ;
6+ import com .cleanroommc .modularui .utils . fakeworld . ArraySchema ;
7+ import com . cleanroommc . modularui . utils . fakeworld . ISchema ;
8+ import com . cleanroommc . modularui . widgets . SchemaWidget ;
129
1310import org .jetbrains .annotations .NotNull ;
1411
@@ -24,34 +21,50 @@ public class ResizerTest extends CustomModularScreen {
2421 .background(new SpriteDrawable(sprite))
2522 .size(20)
2623 .align(Alignment.Center));*/
27- return ModularPanel .defaultPanel ("main" )
24+ /*TrackedDummyWorld world = new TrackedDummyWorld();
25+ world.addBlock(new BlockPos(0, 0, 0), new BlockInfo(Blocks.DIAMOND_BLOCK.getDefaultState()));
26+ world.addBlock(new BlockPos(0, 1, 0), new BlockInfo(Blocks.BEDROCK.getDefaultState()));
27+ world.addBlock(new BlockPos(1, 0, 1), new BlockInfo(Blocks.GOLD_BLOCK.getDefaultState()));*/
28+ /* return ModularPanel.defaultPanel("main")
2829 .size(150)
29- .child (new SpinningWidget ()
30- .size (80 , 20 )
31- .center ()
32- .background (GuiTextures .MC_BUTTON )
33- .overlay (IKey .str ("Text" ))
34- .addTooltipLine ("Long Tooltip Line" ));
35- /*.child(new Column()
36- .alignX(0.5f)
37- .heightRel(1f)
38- .margin(0, 7)
39- .coverChildrenWidth()
40- .mainAxisAlignment(Alignment.MainAxis.SPACE_BETWEEN)
41- .child(new ButtonWidget<>().width(40))
42- .child(new Row().height(30).widthRel(1f).background(GuiTextures.CHECKBOARD).debugName("row"))
43- .child(new ButtonWidget<>()));*/
44- }
30+ .overlay(new SchemaRenderer(BoxSchema.of(Minecraft.getMinecraft().world, new BlockPos(Minecraft.getMinecraft().player), 5))
31+ .cameraFunc((camera, schema) -> {
32+ double pitch = Math.PI / 4;
33+ double T = 4000D;
34+ double yaw = Minecraft.getSystemTime() % T / T * Math.PI * 2;
35+ camera.setLookAt(new BlockPos(Minecraft.getMinecraft().player), 20, yaw, pitch);
36+ })
37+ .isometric(true)
38+ .asIcon().size(140));*/
39+
40+
41+ /*MapSchema world = new MapSchema.Builder()
42+ .add(new BlockPos(0, 0, 0), Blocks.DIAMOND_BLOCK.getDefaultState())
43+ .add(new BlockPos(0, 1, 0), Blocks.BEDROCK.getDefaultState())
44+ .add(new BlockPos(0, 2, 0), Blocks.WOOL.getDefaultState())
45+ .add(new BlockPos(1, 0, 1), Blocks.GOLD_BLOCK.getDefaultState())
46+ .add(new BlockPos(0, 3, 0), Blocks.BEACON.getDefaultState())
47+ .build();*/
4548
46- private static class SpinningWidget extends Widget <SpinningWidget > {
49+ ISchema schema = ArraySchema .builder ()
50+ .layer ("D D" , " " , " " , " " )
51+ .layer (" DDD " , " E E " , " " , " " )
52+ .layer (" DDD " , " E " , " G " , " B " )
53+ .layer (" DDD " , " E E " , " " , " " )
54+ .layer ("D D" , " " , " " , " " )
55+ .where ('D' , "minecraft:gold_block" )
56+ .where ('E' , "minecraft:emerald_block" )
57+ .where ('G' , "minecraft:diamond_block" )
58+ .where ('B' , "minecraft:beacon" )
59+ .build ();
4760
48- @ Override
49- public void transform ( IViewportStack stack ) {
50- super . transform ( stack );
51- stack . translate ( getArea (). width / 2f , getArea (). height / 2f );
52- float p = Minecraft . getSystemTime () % 4000 / 4000f ;
53- stack . rotateZ (( float ) ( p * Math . PI * 2 ));
54- stack . translate (- getArea (). width / 2f , - getArea (). height / 2f );
55- }
61+ var panel = ModularPanel . defaultPanel ( "main" ). size ( 170 );
62+ panel . child ( new SchemaWidget ( schema )
63+ . full ())
64+ . child ( new SchemaWidget . LayerButton ( schema , 0 , 3 )
65+ . bottom ( 1 )
66+ . left ( 1 )
67+ . size ( 16 ) );
68+ return panel ;
5669 }
5770}
0 commit comments