@@ -95,7 +95,6 @@ public EditorScreen(
9595 Screen lastScreen
9696 ) {
9797 super (localized ("title" , "positionEditor" ));
98- this .font = Minecraft .getInstance ().font ;
9998 this .lastScreen = lastScreen ;
10099 this .underlay = underlay ;
101100 this .rep = button ;
@@ -110,7 +109,7 @@ public void init() {
110109 super .init ();
111110
112111 // Resize the underlay
113- underlay .init (Minecraft . getInstance (), width , height );
112+ underlay .init (width , height );
114113
115114 // Reload buttons from the manager
116115 if (!reloadButtonsAndIgnoredSlots ()) {
@@ -248,13 +247,13 @@ private void rebuildGui() {
248247 movingY += 21 ;
249248
250249 // Change the auto trigger behavior
251- CycleButton <Boolean > autoOpOtherButton = CycleButton .booleanBuilder (
250+ CycleButton <@ NotNull Boolean > autoOpOtherButton = CycleButton .booleanBuilder (
252251 Component .literal ("1" ).withStyle (ChatFormatting .RED ),
253- Component .literal ("0" ).withStyle (ChatFormatting .GREEN )
252+ Component .literal ("0" ).withStyle (ChatFormatting .GREEN ),
253+ autoOpOther
254254 )
255255 .withTooltip ((v ) -> Tooltip .create (localized ("editor" , "autoOp.other.tooltip" )))
256256 .displayOnlyValue ()
257- .withInitialValue (autoOpOther )
258257 .create (
259258 x + width - 10 ,
260259 movingY ,
@@ -264,15 +263,16 @@ private void rebuildGui() {
264263 (b , v ) -> autoOpOther = v
265264 );
266265 addRenderableWidget (autoOpOtherButton );
267- CycleButton <Integer > autoOpButton = CycleButton .<Integer >builder ((v ) -> v == 0
268- ? localized ("editor" , "autoOp.none" )
269- : localized ("key" , "op." + Operation .values ()[v - 1 ].translationKey ))
266+ CycleButton <@ NotNull Integer > autoOpButton = CycleButton .builder (
267+ (v ) -> v == 0
268+ ? localized ("editor" , "autoOp.none" )
269+ : localized ("key" , "op." + Operation .values ()[v - 1 ].translationKey ),
270+ autoOp == null
271+ ? 0
272+ : List .of (Operation .values ()).indexOf (autoOp ) + 1
273+ )
270274 .withTooltip ((v ) -> Tooltip .create (localized ("editor" , "autoOp.tooltip" )))
271275 .withValues (0 , 1 , 2 , 3 , 4 )
272- .withInitialValue (autoOp == null
273- ? 0
274- : List .of (Operation .values ()).indexOf (autoOp ) + 1
275- )
276276 .create (
277277 x ,
278278 movingY ,
@@ -517,7 +517,7 @@ public void render(@NotNull GuiGraphics graphics, int mouseX, int mouseY, float
517517
518518 // Render editable widgets again, above background blur
519519 for (TriggerButton cb : buttons ) {
520- cb .renderWidget (graphics , mouseX , mouseY , partialTick );
520+ cb .renderContents (graphics , mouseX , mouseY , partialTick );
521521 }
522522 }
523523
@@ -572,7 +572,7 @@ private void drawLineFor(GuiGraphics graphics, TriggerButton button) {
572572 @ Override
573573 public void onClose () {
574574 super .onClose ();
575- lastScreen .init (Minecraft . getInstance (), width , height );
575+ lastScreen .init (width , height );
576576 Minecraft .getInstance ().setScreen (lastScreen );
577577 }
578578
@@ -616,7 +616,7 @@ public boolean keyPressed(KeyEvent event) {
616616 * Allows dragging the selected widget to reposition it.
617617 */
618618 @ Override
619- public boolean mouseClicked (MouseButtonEvent event , boolean doubleClick ) {
619+ public boolean mouseClicked (@ NotNull MouseButtonEvent event , boolean doubleClick ) {
620620 if (super .mouseClicked (event , doubleClick )) {
621621 dragging = false ;
622622 return true ;
@@ -650,7 +650,7 @@ public boolean mouseClicked(MouseButtonEvent event, boolean doubleClick) {
650650 * Allows dragging the selected widget to reposition it.
651651 */
652652 @ Override
653- public boolean mouseDragged (MouseButtonEvent event , double dragX , double dragY ) {
653+ public boolean mouseDragged (@ NotNull MouseButtonEvent event , double dragX , double dragY ) {
654654 if (dragging ) {
655655 Vec2i before = rep .offset ;
656656 if (rep .mouseDragged (event , dragX , dragY )) {
@@ -666,7 +666,7 @@ public boolean mouseDragged(MouseButtonEvent event, double dragX, double dragY)
666666 * Allows dragging the selected widget to reposition it.
667667 */
668668 @ Override
669- public boolean mouseReleased (MouseButtonEvent event ) {
669+ public boolean mouseReleased (@ NotNull MouseButtonEvent event ) {
670670 dragging = false ;
671671 return super .mouseReleased (event );
672672 }
0 commit comments