66import net .minecraft .client .gui .components .Button ;
77import net .minecraft .client .gui .components .EditBox ;
88import net .minecraft .client .gui .components .ObjectSelectionList ;
9+ import net .minecraft .client .input .KeyEvent ;
10+ import net .minecraft .client .input .MouseButtonEvent ;
911import net .minecraft .client .renderer .RenderPipelines ;
1012import net .minecraft .client .renderer .entity .ItemRenderer ;
1113import net .minecraft .client .resources .language .I18n ;
@@ -152,13 +154,13 @@ public void init() {
152154 }
153155
154156 @ Override
155- public boolean keyPressed (int keyCode , int scanCode , int modifiers ) {
156- if (!search .isFocused () && keyCode == XRay .OPEN_GUI_KEY .key .getValue ()) {
157+ public boolean keyPressed (KeyEvent keyEvent ) {
158+ if (!search .isFocused () && keyEvent . key () == XRay .OPEN_GUI_KEY .key .getValue ()) {
157159 this .onClose ();
158160 return true ;
159161 }
160162
161- return super .keyPressed (keyCode , scanCode , modifiers );
163+ return super .keyPressed (keyEvent );
162164 }
163165
164166 private void updateSearch () {
@@ -178,17 +180,17 @@ public void tick() {
178180 }
179181
180182 @ Override
181- public boolean mouseClicked (double x , double y , int mouse ) {
182- if (search .mouseClicked (x , y , mouse ))
183+ public boolean mouseClicked (MouseButtonEvent event , boolean bl ) {
184+ if (search .mouseClicked (event , bl ))
183185 this .setFocused (search );
184186
185- if (mouse == 1 && distButtons .isMouseOver (x , y )) {
187+ if (event . button () == 1 && distButtons .isMouseOver (event . x (), event . y () )) {
186188 ScanController .INSTANCE .decrementCurrentDist ();
187189 distButtons .setMessage (Component .translatable ("xray.input.distance" , ScanController .INSTANCE .getVisualRadius ()));
188190 distButtons .playDownSound (Minecraft .getInstance ().getSoundManager ());
189191 }
190192
191- return super .mouseClicked (x , y , mouse );
193+ return super .mouseClicked (event , bl );
192194 }
193195
194196 @ Override
@@ -226,8 +228,8 @@ class ScanEntryScroller extends ObjectSelectionList<ScanEntryScroller.ScanSlot>
226228 ScanEntryScroller (int x , int y , int width , int height , ScanManageScreen parent ) {
227229 super (ScanManageScreen .this .minecraft , width - 2 , height , (ScanManageScreen .this .height / 2 ) - (height / 2 ) + 10 , SLOT_HEIGHT );
228230 this .parent = parent ;
231+ this .setX ((parent .getWidth () / 2 ) - (width / 2 ) - 36 );
229232 this .updateEntries ();
230- this .setX (x + 2 );
231233 }
232234
233235 @ Override
@@ -240,11 +242,11 @@ protected int scrollBarX() {
240242 return this .getX () + this .getRowWidth () + 6 ;
241243 }
242244
243- public void setSelected (@ Nullable ScanManageScreen .ScanEntryScroller .ScanSlot entry , int mouse ) {
245+ public void setSelected (@ Nullable ScanManageScreen .ScanEntryScroller .ScanSlot entry , MouseButtonEvent mouse ) {
244246 if (entry == null )
245247 return ;
246248
247- if (ScanManageScreen .hasShiftDown ()) {
249+ if (mouse .hasShiftDown ()) {
248250 Minecraft .getInstance ().setScreen (new ScanConfigureScreen (entry .entry , ScanManageScreen ::new ));
249251 return ;
250252 }
@@ -293,25 +295,25 @@ public static class ScanSlot extends ObjectSelectionList.Entry<ScanSlot> {
293295 }
294296
295297 @ Override
296- public void render (GuiGraphics guiGraphics , int entryIdx , int top , int left , int entryWidth , int entryHeight , int mouseX , int mouseY , boolean p_194999_5_ , float partialTicks ) {
298+ public void renderContent (GuiGraphics guiGraphics , int mouseX , int mouseY , boolean hovering , float partialTicks ) {
297299 Font font = Minecraft .getInstance ().font ;
298300
299- guiGraphics .drawString (font , this .entry .name (), left + 25 , top + 7 , 0xFFFFFFFF );
300- guiGraphics .drawString (font , this .entry .enabled () ? "Enabled" : "Disabled" , left + 25 , top + 17 , this .entry .enabled () ? Color .GREEN .getRGB () : Color .RED .getRGB ());
301+ guiGraphics .drawString (font , this .entry .name (), this . getContentX () + 25 , this . getContentY () + 7 , 0xFFFFFFFF );
302+ guiGraphics .drawString (font , this .entry .enabled () ? "Enabled" : "Disabled" , this . getContentX () + 25 , this . getContentY () + 17 , this .entry .enabled () ? Color .GREEN .getRGB () : Color .RED .getRGB ());
301303
302- guiGraphics .renderItem (this .icon , left , top + 7 );
304+ guiGraphics .renderItem (this .icon , this . getContentX (), this . getContentY () + 7 );
303305
304306 var stack = guiGraphics .pose ();
305307 stack .pushMatrix ();
306308
307- guiGraphics .blit (RenderPipelines .GUI_TEXTURED , ScanManageScreen .CIRCLE , (left + entryWidth ) - 23 , (int ) (top + (entryHeight / 2f ) - 9 ), 0 , 0 , 14 , 14 , 14 , 14 , 0x7F000000 );
308- guiGraphics .blit (RenderPipelines .GUI_TEXTURED , ScanManageScreen .CIRCLE , (left + entryWidth ) - 21 , (int ) (top + (entryHeight / 2f ) - 7 ), 0 , 0 , 10 , 10 , 10 , 10 , 0xFF000000 | this .entry .colorInt ());
309+ guiGraphics .blit (RenderPipelines .GUI_TEXTURED , ScanManageScreen .CIRCLE , (this . getContentX () + this . getWidth ()) - 23 , (int ) (this . getContentY () + (this . getHeight () / 2f ) - 9 ), 0 , 0 , 14 , 14 , 14 , 14 , 0x7F000000 );
310+ guiGraphics .blit (RenderPipelines .GUI_TEXTURED , ScanManageScreen .CIRCLE , (this . getContentX () + this . getWidth ()) - 21 , (int ) (this . getContentY () + (this . getHeight () / 2f ) - 7 ), 0 , 0 , 10 , 10 , 10 , 10 , 0xFF000000 | this .entry .colorInt ());
309311
310312 stack .popMatrix ();
311313 }
312314
313315 @ Override
314- public boolean mouseClicked (double p_mouseClicked_1_ , double p_mouseClicked_3_ , int mouse ) {
316+ public boolean mouseClicked (MouseButtonEvent mouse , boolean bl ) {
315317 this .parent .setSelected (this , mouse );
316318 return false ;
317319 }
0 commit comments