55
66package meteordevelopment .meteorclient .gui .renderer ;
77
8+ import meteordevelopment .meteorclient .MeteorClient ;
89import meteordevelopment .meteorclient .gui .utils .Cell ;
910import meteordevelopment .meteorclient .gui .widgets .WWidget ;
1011import meteordevelopment .meteorclient .gui .widgets .containers .WContainer ;
1314import meteordevelopment .meteorclient .renderer .MeteorRenderPipelines ;
1415import meteordevelopment .meteorclient .utils .render .color .Color ;
1516import net .minecraft .client .MinecraftClient ;
17+ import net .minecraft .client .gui .Click ;
1618
1719public class GuiDebugRenderer {
1820 private static final Color CELL_COLOR = new Color (25 , 225 , 25 );
@@ -34,11 +36,25 @@ public void render(WWidget widget) {
3436 .end ();
3537 }
3638
39+ public void mouseReleased (WWidget widget , Click click , int i ) {
40+ if (widget == null ) return ;
41+
42+ MeteorClient .LOG .info ("{} {}" , widget .getClass (), i );
43+
44+ if (widget instanceof WContainer container ) {
45+ for (Cell <?> cell : container .cells ) {
46+ if (cell .widget ().isOver (click .x (), click .y ())) {
47+ mouseReleased (cell .widget (), click , i + 1 );
48+ }
49+ }
50+ }
51+ }
52+
3753 private void renderWidget (WWidget widget ) {
3854 lineBox (widget .x , widget .y , widget .width , widget .height , WIDGET_COLOR );
3955
40- if (widget instanceof WContainer ) {
41- for (Cell <?> cell : (( WContainer ) widget ) .cells ) {
56+ if (widget instanceof WContainer container ) {
57+ for (Cell <?> cell : container .cells ) {
4258 lineBox (cell .x , cell .y , cell .width , cell .height , CELL_COLOR );
4359 renderWidget (cell .widget ());
4460 }
0 commit comments