11package malte0811 .controlengineering .gui .widget ;
22
3+ import net .minecraft .client .gui .ComponentPath ;
34import net .minecraft .client .gui .GuiGraphics ;
45import net .minecraft .client .gui .components .AbstractWidget ;
56import net .minecraft .client .gui .components .events .ContainerEventHandler ;
67import net .minecraft .client .gui .components .events .GuiEventListener ;
78import net .minecraft .client .gui .narration .NarrationElementOutput ;
9+ import net .minecraft .client .gui .navigation .FocusNavigationEvent ;
810import net .minecraft .network .chat .Component ;
911import org .jetbrains .annotations .NotNull ;
1012
@@ -35,6 +37,22 @@ public void renderWidget(@Nonnull GuiGraphics graphics, int mouseX, int mouseY,
3537 }
3638 }
3739
40+ @ Override
41+ public boolean isFocused () {
42+ return ContainerEventHandler .super .isFocused ();
43+ }
44+
45+ @ Nullable
46+ public ComponentPath getCurrentFocusPath () {
47+ return ContainerEventHandler .super .getCurrentFocusPath ();
48+ }
49+
50+ @ Override
51+ @ Nullable
52+ public ComponentPath nextFocusPath (FocusNavigationEvent p_265640_ ) {
53+ return ContainerEventHandler .super .nextFocusPath (p_265640_ );
54+ }
55+
3856 @ Nonnull
3957 @ Override
4058 public List <? extends GuiEventListener > children () {
@@ -59,6 +77,12 @@ public GuiEventListener getFocused() {
5977
6078 @ Override
6179 public void setFocused (@ Nullable GuiEventListener listener ) {
80+ if (this .listener != null ) {
81+ this .listener .setFocused (false );
82+ }
83+ if (listener != null ) {
84+ listener .setFocused (true );
85+ }
6286 this .listener = listener ;
6387 }
6488
0 commit comments