Skip to content

Restore GuiGraphicsExtended.drawSlotText#227

Closed
Copilot wants to merge 3 commits intomaster-26from
copilot/restore-old-method-code-reuse
Closed

Restore GuiGraphicsExtended.drawSlotText#227
Copilot wants to merge 3 commits intomaster-26from
copilot/restore-old-method-code-reuse

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Apr 12, 2026

drawSlotText(Font, String, int, int) was dropped in 1.29.0, forcing downstream mods (e.g. IntegratedTerminals#198) to inline equivalent rendering logic as a workaround.

Changes

  • Restore drawSlotText — public method with inlined scaled text rendering (0.5× scale, right-aligned at slot bottom-right), making the downstream workaround unnecessary
// Before (removed from CyclopsCore 1.29.0)
new GuiGraphicsExtended(guiGraphics).drawSlotText(font, label, x, y);

// After (restored)
new GuiGraphicsExtended(guiGraphics).drawSlotText(font, label, x, y);
Original prompt

Please restore the old method so the workaround in CyclopsMC/IntegratedTerminals#198 is not necessary anymore.
Make sure there's no code duplication in this class, so make sure there's method code reuse.

@coveralls
Copy link
Copy Markdown

coveralls commented Apr 12, 2026

Coverage Status

coverage: 30.837% (-0.01%) from 30.848% — copilot/restore-old-method-code-reuse into master-26

Copilot AI changed the title [WIP] Restore old method to eliminate workaround necessity Restore GuiGraphicsExtended.drawSlotText and eliminate rendering code duplication Apr 12, 2026
Copilot AI requested a review from rubensworks April 12, 2026 06:37
this.guiGraphics = guiGraphics;
}

private void renderText(Font font, String text, int x, int y) {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This private method is not necessary. The implementation can just be moved to the other new methods.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done in b946c5c — removed the renderText helper and inlined the implementation directly in itemCount and drawSlotText.


private void renderText(Font font, String text, int x, int y) {
float scale = 0.5f;
guiGraphics.pose().pushMatrix();
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Make sure the code comments from before are kept.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Restored in b946c5c — the original // This part was added and // Scale was added here comments are back.

float scale = 0.5f;
guiGraphics.pose().pushMatrix();
guiGraphics.pose().scale(scale, scale);
guiGraphics.text(font, text, (int) ((x + 17) / scale - font.width(text)), (int) ((y + 12) / scale), -1, true);
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This line should be exactly the same as the old line 28.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in b946c5citemCount now uses (x + 19 - 2) and (y + 6 + 6) exactly as before.

…ressions, inline drawSlotText

Agent-Logs-Url: https://github.com/CyclopsMC/CyclopsCore/sessions/204a904e-0e70-43fd-9f50-8d753c76640a

Co-authored-by: rubensworks <440384+rubensworks@users.noreply.github.com>
Copilot AI changed the title Restore GuiGraphicsExtended.drawSlotText and eliminate rendering code duplication Restore GuiGraphicsExtended.drawSlotText Apr 12, 2026
@sonarqubecloud
Copy link
Copy Markdown

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants