@@ -102,7 +102,6 @@ public EditorScreen(
102102 Screen lastScreen
103103 ) {
104104 super (localized ("title" , "positionEditor" ));
105- this .font = Minecraft .getInstance ().font ;
106105 this .lastScreen = lastScreen ;
107106 this .underlay = underlay ;
108107 this .isPlayerInv = isPlayerInv ;
@@ -118,7 +117,7 @@ public void init() {
118117 super .init ();
119118
120119 // Resize the underlay
121- underlay .init (Minecraft . getInstance (), width , height );
120+ underlay .init (width , height );
122121
123122 // Reload buttons from the manager
124123 if (!reloadButtonsAndIgnoredSlots ()) {
@@ -379,11 +378,11 @@ private void rebuildGui() {
379378 movingY += 21 ;
380379
381380 // Switch between offset types
382- CycleButton <Boolean > switchOffsetTypeButton = CycleButton .booleanBuilder (
381+ CycleButton <@ NotNull Boolean > switchOffsetTypeButton = CycleButton .booleanBuilder (
383382 localized ("editor" , "switchOffsetType.slot" ),
384- localized ("editor" , "switchOffsetType.edge" )
383+ localized ("editor" , "switchOffsetType.edge" ),
384+ offsetFromSlot
385385 )
386- .withInitialValue (offsetFromSlot )
387386 .withTooltip ((v ) -> Tooltip .create (localized (
388387 "editor" ,
389388 "switchOffsetType.tooltip." + (v ? "slot" : "edge" )
@@ -442,13 +441,13 @@ private void rebuildGui() {
442441 movingY += 21 ;
443442
444443 // Change the auto trigger behavior
445- CycleButton <Boolean > autoOpOtherButton = CycleButton .booleanBuilder (
444+ CycleButton <@ NotNull Boolean > autoOpOtherButton = CycleButton .booleanBuilder (
446445 Component .literal ("1" ).withStyle (ChatFormatting .RED ),
447- Component .literal ("0" ).withStyle (ChatFormatting .GREEN )
446+ Component .literal ("0" ).withStyle (ChatFormatting .GREEN ),
447+ autoOpOther
448448 )
449449 .withTooltip ((v ) -> Tooltip .create (localized ("editor" , "autoOp.other.tooltip" )))
450450 .displayOnlyValue ()
451- .withInitialValue (autoOpOther )
452451 .create (
453452 x + width - 10 ,
454453 movingY ,
@@ -458,15 +457,16 @@ private void rebuildGui() {
458457 (b , v ) -> autoOpOther = v
459458 );
460459 addRenderableWidget (autoOpOtherButton );
461- CycleButton <Integer > autoOpButton = CycleButton .<Integer >builder ((v ) -> v == 0
462- ? localized ("editor" , "autoOp.none" )
463- : localized ("key" , "op." + Operation .values ()[v - 1 ].translationKey ))
460+ CycleButton <@ NotNull Integer > autoOpButton = CycleButton .builder (
461+ (v ) -> v == 0
462+ ? localized ("editor" , "autoOp.none" )
463+ : localized ("key" , "op." + Operation .values ()[v - 1 ].translationKey ),
464+ autoOp == null
465+ ? 0
466+ : List .of (Operation .values ()).indexOf (autoOp ) + 1
467+ )
464468 .withTooltip ((v ) -> Tooltip .create (localized ("editor" , "autoOp.tooltip" )))
465469 .withValues (0 , 1 , 2 , 3 , 4 )
466- .withInitialValue (autoOp == null
467- ? 0
468- : List .of (Operation .values ()).indexOf (autoOp ) + 1
469- )
470470 .create (
471471 x ,
472472 movingY ,
@@ -640,7 +640,7 @@ public void render(@NotNull GuiGraphics graphics, int mouseX, int mouseY, float
640640
641641 // Render editable widgets again, above background blur
642642 for (TriggerButton cb : buttons ) {
643- cb .renderWidget (graphics , mouseX , mouseY , partialTick );
643+ cb .renderContents (graphics , mouseX , mouseY , partialTick );
644644 }
645645 }
646646
@@ -695,7 +695,7 @@ private void drawLineFor(GuiGraphics graphics, TriggerButton button) {
695695 @ Override
696696 public void onClose () {
697697 super .onClose ();
698- lastScreen .init (Minecraft . getInstance (), width , height );
698+ lastScreen .init (width , height );
699699 Minecraft .getInstance ().setScreen (lastScreen );
700700 }
701701
@@ -745,7 +745,7 @@ public boolean keyPressed(KeyEvent event) {
745745 * Allows dragging the selected widget to reposition it.
746746 */
747747 @ Override
748- public boolean mouseClicked (MouseButtonEvent event , boolean doubleClick ) {
748+ public boolean mouseClicked (@ NotNull MouseButtonEvent event , boolean doubleClick ) {
749749 if (super .mouseClicked (event , doubleClick )) {
750750 dragging = false ;
751751 return true ;
@@ -780,7 +780,7 @@ public boolean mouseClicked(MouseButtonEvent event, boolean doubleClick) {
780780 * Allows dragging the selected widget to reposition it.
781781 */
782782 @ Override
783- public boolean mouseDragged (MouseButtonEvent event , double dragX , double dragY ) {
783+ public boolean mouseDragged (@ NotNull MouseButtonEvent event , double dragX , double dragY ) {
784784 if (dragging ) {
785785 Vec2i before = rep .offset ;
786786 if (rep .mouseDragged (event , dragX , dragY )) {
@@ -796,7 +796,7 @@ public boolean mouseDragged(MouseButtonEvent event, double dragX, double dragY)
796796 * Allows dragging the selected widget to reposition it.
797797 */
798798 @ Override
799- public boolean mouseReleased (MouseButtonEvent event ) {
799+ public boolean mouseReleased (@ NotNull MouseButtonEvent event ) {
800800 dragging = false ;
801801 return super .mouseReleased (event );
802802 }
0 commit comments