Handle conduit priority #1036

Merged
h-ok-o merged 5 commits from dev/1.20.1 into dev/1.20.1 2025-05-04 12:56:53 +00:00
h-ok-o commented 2025-03-22 19:19:36 +00:00 (Migrated from github.com)

Description

The heart of this change resides in a single line in the item conduit ticker: inserts.sort(Comparator.comparingInt((CapabilityConnection conn) -> conn.data.compute(conn.direction).priority).reversed());

The insert connections are sorted in a descending order as to prioritize high priority values.
Tested only with item conduits with values in the range of integer.

TODO

  • Determine and implement a better UI for priority

Breaking Changes

Shouldn't have any (🤞)

Checklist

  • Handle priority between conduits
  • Added functional GUI for priority
  • My code follows the style guidelines of this project (.editorconfig, most IDEs will use this for you).
  • I have made corresponding changes to the documentation. (not needed ?)
  • My changes are ready for review from a contributor.

Summary by CodeRabbit

  • New Features
    • Enhanced the conduit interface to display current priority information.
    • Introduced interactive buttons for adjusting conduit priority, including accelerated tuning via modifier keys.
    • Updated language support to include a dedicated "Priority" label.
# Description The heart of this change resides in a single line in the item conduit ticker: `inserts.sort(Comparator.comparingInt((CapabilityConnection conn) -> conn.data.compute(conn.direction).priority).reversed());` The insert connections are sorted in a descending order as to prioritize high priority values. Tested only with item conduits with values in the range of integer. <!-- If you're submitting a Draft PR, consider providing a TODO list using checkboxes --> # TODO - [x] Determine and implement a better UI for priority # Breaking Changes Shouldn't have any (🤞) <!-- For drafts, fill this in as you go; if you are leaving draft, make sure these are all complete. --> # Checklist - [x] Handle priority between conduits - [x] Added functional GUI for priority - [x] My code follows the style guidelines of this project (.editorconfig, most IDEs will use this for you). - [x] I have made corresponding changes to the documentation. (not needed ?) - [x] My changes are ready for review from a contributor. <!-- Thanks to: https://embeddedartistry.com/blog/2017/08/04/a-github-pull-request-template-for-your-projects/ for the building blocks of this template --> <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **New Features** - Enhanced the conduit interface to display current priority information. - Introduced interactive buttons for adjusting conduit priority, including accelerated tuning via modifier keys. - Updated language support to include a dedicated "Priority" label. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
coderabbitai[bot] commented 2025-03-22 19:19:47 +00:00 (Migrated from github.com)

Walkthrough

The changes update the conduit system's GUI and internal priority handling. In the conduit screen, a conditional check is added to detect ItemConduitType and render corresponding priority labels. Two new buttons in the item conduit screen allow users to increment or decrement conduit priority. The conduit data class now encapsulates the priority field with getter and setter methods that include range validation. Additionally, conduit connections are sorted based on priority in the ticker, a new language constant is introduced, and a dedicated multi-icon button component has been implemented to facilitate these interactions.

Changes

File(s) Change Summary
src/.../ConduitScreen.java Added a conditional block in renderLabels to check for ItemConduitType and display priority information; imported ItemConduitType.
src/.../ItemConduitScreenExtension.java Added two buttons (plus/minus) via MultiIconButton in createWidgets to adjust conduit priority using lambda functions.
src/.../ItemConduitData.java Changed priority from public to private; added getPriority() and setPriority(int) with range validation (-9999 to 9999).
src/.../ItemConduitTicker.java Introduced sorting of the inserts list in descending order based on conduit priority using Comparator.
src/.../ConduitLang.java Added a new constant CONDUIT_PRIORITY for the "Priority" GUI label.
src/.../MultiIconButton.java Introduced the MultiIconButton class with plus/minus button functionality; supports modifier keys for dynamic value changes and includes static factory methods.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant Ext as ItemConduitScreenExtension
    participant Btn as MultiIconButton
    participant Data as ItemConduitData
    participant Ticker as ItemConduitTicker

    User->>Ext: Click plus/minus button
    Ext->>Btn: onPress event
    Btn->>Data: Retrieve current priority (getPriority)
    Btn->>Data: Update priority (setPriority)
    Data-->>Ext: Return updated value
    Ticker->>Data: getPriority() for sorting
sequenceDiagram
    participant Screen as ConduitScreen
    participant Menu
    participant Data as ItemConduitData

    Screen->>Menu: getConduitType()
    Menu-->>Screen: returns ItemConduitType
    Screen->>Data: Retrieve priority for specific direction (getPriority)
    Data-->>Screen: Return priority value
    Screen->>Screen: Render label and value on GUI

Poem

I hopped into the code with glee,
Discovering buttons and tweaks for all to see.
Priorities now dance on my GUI screen,
Sorted, encapsulated, and shining clean.
With nimble hops, my code's now sharp and bright—
A bunny's delight in every line of byte!

Finishing Touches
  • 📝 Generate Docstrings

🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.
<!-- This is an auto-generated comment: summarize by coderabbit.ai --> <!-- walkthrough_start --> ## Walkthrough The changes update the conduit system's GUI and internal priority handling. In the conduit screen, a conditional check is added to detect `ItemConduitType` and render corresponding priority labels. Two new buttons in the item conduit screen allow users to increment or decrement conduit priority. The conduit data class now encapsulates the priority field with getter and setter methods that include range validation. Additionally, conduit connections are sorted based on priority in the ticker, a new language constant is introduced, and a dedicated multi-icon button component has been implemented to facilitate these interactions. ## Changes | File(s) | Change Summary | |----------------------------------------|----------------| | `src/.../ConduitScreen.java` | Added a conditional block in `renderLabels` to check for `ItemConduitType` and display priority information; imported `ItemConduitType`. | | `src/.../ItemConduitScreenExtension.java` | Added two buttons (plus/minus) via `MultiIconButton` in `createWidgets` to adjust conduit priority using lambda functions. | | `src/.../ItemConduitData.java` | Changed `priority` from public to private; added `getPriority()` and `setPriority(int)` with range validation (-9999 to 9999). | | `src/.../ItemConduitTicker.java` | Introduced sorting of the `inserts` list in descending order based on conduit priority using `Comparator`. | | `src/.../ConduitLang.java` | Added a new constant `CONDUIT_PRIORITY` for the "Priority" GUI label. | | `src/.../MultiIconButton.java` | Introduced the `MultiIconButton` class with plus/minus button functionality; supports modifier keys for dynamic value changes and includes static factory methods. | ## Sequence Diagram(s) ```mermaid sequenceDiagram participant User participant Ext as ItemConduitScreenExtension participant Btn as MultiIconButton participant Data as ItemConduitData participant Ticker as ItemConduitTicker User->>Ext: Click plus/minus button Ext->>Btn: onPress event Btn->>Data: Retrieve current priority (getPriority) Btn->>Data: Update priority (setPriority) Data-->>Ext: Return updated value Ticker->>Data: getPriority() for sorting ``` ```mermaid sequenceDiagram participant Screen as ConduitScreen participant Menu participant Data as ItemConduitData Screen->>Menu: getConduitType() Menu-->>Screen: returns ItemConduitType Screen->>Data: Retrieve priority for specific direction (getPriority) Data-->>Screen: Return priority value Screen->>Screen: Render label and value on GUI ``` ## Poem > I hopped into the code with glee, > Discovering buttons and tweaks for all to see. > Priorities now dance on my GUI screen, > Sorted, encapsulated, and shining clean. > With nimble hops, my code's now sharp and bright— > A bunny's delight in every line of byte! <!-- walkthrough_end --> <!-- internal state start --> <!-- DwQgtGAEAqAWCWBnSTIEMB26CuAXA9mAOYCmGJATmriQCaQDG+Ats2bgFyQAOFk+AIwBWJBrngA3EsgEBPRvlqU0AgfFwA6NPEgQAfACgjoCEYDEZyAAUASpADK2VmgqyjcEj2wAbb5AokAI7Y0riQ4rjedJAARAASmLRRChi02Oo8FPD4WbiyMZAA7mjIiNgCzOo09HLhsJ7YiJSQsGD4ANZt6KkoyPBKGOIAZvDRJdZ2GE4CzQCMAAwAzABs/FgA4upx5Row9ZnwzC7yQ/gMjfxDdagMsJikveH4kGR3GAyeuPvqJMwpaRlxAx2s1aoduFE2IN4BgiOhIIgcuJYZA2LdMEg/qc+DCmhQwkwMOQxNkMDIStF8FgviR4HxeNlcvIJGhvCFELsPJAQfJmIp4CMGNRSY8yELuGVvNRojD4YgYURkt4YZ58FcmEo6tQEUjkDSUsTxFS+lglIgPqkFfwKEo+GgGEwbVaCHVafSsjl1LIADQvMnYLIor7ahBEeruxleyAstnSdABTJnaRNegjCiITR7TzgyHsYVUlrjGZkcKhaKFdSwFA0P6EgG4PV3MJ3KQoQYkUh8GPs3bufZoPCwHKF5D4PDK8j0NAwADyABEZ5BlRnfYUELc2ww2WbIEoaBRKhgrYkUMwIb92MfIDNcPvII1mjD90N7Z4ABQAVQAkgBKSDY1FMDQIgrQZT08k5ftB2HEo8QbLUwhpBNECHHwak8DBngEAI0HaK10VhOMAklZE4SGCgWGuZBsG4WhpV2ABBWhaHUUlWW8H14VuUR2mXMJUF4fAJH6OhfUJNNDzhYNEP2MCmULVIJzhG9ChIEs63SeC7hkNSsDQZjiJTX1pyGb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jB4sBfhuBWUcwMn1CsUhTCXktwMXAP0JmDD7F2wdlUwYIkj5QYrWULoKAg5z4UcmdtswEI6m4dstWfjMB5BLIPt1CmHLLWQvRK77Nq6Lra7rrfrbr/rn8ganrWI2625HW/l4NqnccMBFXPTSyL6N62MlzHQaD77NN+NcGEkO3IHwsj7v8jMpg/hu7MdwHO2yd6nV7vS+2kaB2Uah3uMClKDH6W8GwX7l2p3cNWyoBEyUtF2RT0zxXYFJ3anUdGBCdOtmIyc3wAA1E6HIAAJh0CTd9EUcAUoFUfbAsczNvHSuSZMdA/MY0YHKg4oDHJnPPpoP7YII9FvuHcwb4xKXHZPexxXY/ovcgCveTLbc0N7rzRgTI9Pafc4eVZJzVdOy/Z/YoH/Z4CGyA5ohA7MfA4Q+hX3F9DKR8Tg4E4oD0EQ/3BQ7PV7fQ63cw9Uzvtw8PZj2Pcfa7ZI4U1EygFE41h9xgko9vYsM04/ZsGkDHCiRIF2TOHUIed9wCF9G/bED/YA+44cF4+UbA5oAg6E+g9E4an4984Q+seE7o6I7PYwBDQRZIFk69Ow8vv9J3ZyBw/3bw+iQI7M+05ZF05g9zsM7tGM4bYi7foY6pDfAs8RADA+Fs6GhFAc6ecgBc+Qs48A4zMmy+FpebFpDDGpWA+8/g8k8g/C8C9MZ8/UeG7C4C5YC+xZzYDPkIdK5qa09Rxi+oPi/k6S5PJvt3ZHYPbHaPYnfo9W+nd3NhqsTCQUR6GUSgTfK5XcU4D+O8RJr6VqBMS7nUGCUsWsXkWQx3mZv6EQGZs3joGZtAqQ1CRsWhYAHYbiBAYfaAYeqEBBeYAAWOHkgG4kgGHoYNHhgWgZYeYIYG4oYAAVhuJh9/bR5uIYDJ7J95h+6u/+/UEB9oGB9B9oGZsUR+6AA== --> <!-- internal state end --> <!-- finishing_touch_checkbox_start --> <details> <summary>✨ Finishing Touches</summary> - [ ] <!-- {"checkboxId": "7962f53c-55bc-4827-bfbf-6a18da830691"} --> 📝 Generate Docstrings </details> <!-- finishing_touch_checkbox_end --> <!-- tips_start --> --- <details> <summary>🪧 Tips</summary> ### Chat There are 3 ways to chat with [CodeRabbit](https://coderabbit.ai?utm_source=oss&utm_medium=github&utm_campaign=Team-EnderIO/EnderIO&utm_content=1036): - Review comments: Directly reply to a review comment made by CodeRabbit. Example: - `I pushed a fix in commit <commit_id>, please review it.` - `Generate unit testing code for this file.` - `Open a follow-up GitHub issue for this discussion.` - Files and specific lines of code (under the "Files changed" tab): Tag `@coderabbitai` in a new review comment at the desired location with your query. Examples: - `@coderabbitai generate unit testing code for this file.` - `@coderabbitai modularize this function.` - PR comments: Tag `@coderabbitai` in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples: - `@coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.` - `@coderabbitai read src/utils.ts and generate unit testing code.` - `@coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.` - `@coderabbitai help me debug CodeRabbit configuration file.` Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. ### CodeRabbit Commands (Invoked using PR comments) - `@coderabbitai pause` to pause the reviews on a PR. - `@coderabbitai resume` to resume the paused reviews. - `@coderabbitai review` to trigger an incremental review. This is useful when automatic reviews are disabled for the repository. - `@coderabbitai full review` to do a full review from scratch and review all the files again. - `@coderabbitai summary` to regenerate the summary of the PR. - `@coderabbitai generate docstrings` to [generate docstrings](https://docs.coderabbit.ai/finishing-touches/docstrings) for this PR. - `@coderabbitai resolve` resolve all the CodeRabbit review comments. - `@coderabbitai configuration` to show the current CodeRabbit configuration for the repository. - `@coderabbitai help` to get help. ### Other keywords and placeholders - Add `@coderabbitai ignore` anywhere in the PR description to prevent this PR from being reviewed. - Add `@coderabbitai summary` to generate the high-level summary at a specific location in the PR description. - Add `@coderabbitai` anywhere in the PR title to generate the title automatically. ### CodeRabbit Configuration File (`.coderabbit.yaml`) - You can programmatically configure CodeRabbit by adding a `.coderabbit.yaml` file to the root of your repository. - Please see the [configuration documentation](https://docs.coderabbit.ai/guides/configure-coderabbit) for more information. - If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: `# yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json` ### Documentation and Community - Visit our [Documentation](https://docs.coderabbit.ai) for detailed information on how to use CodeRabbit. - Join our [Discord Community](http://discord.gg/coderabbit) to get help, request features, and share feedback. - Follow us on [X/Twitter](https://twitter.com/coderabbitai) for updates and announcements. </details> <!-- tips_end -->
h-ok-o commented 2025-03-22 22:43:37 +00:00 (Migrated from github.com)

I'm not sure how I could keep the input box and have the value fully drawn on the screen
image
note: the "00" value on screen is 100 but the "1" is not showing

I'm not sure how I could keep the input box and have the value fully drawn on the screen ![image](https://github.com/user-attachments/assets/76c758ff-c9d0-4923-917e-ddadf3aa4622) note: the "00" value on screen is 100 but the "1" is not showing
h-ok-o commented 2025-03-23 11:17:00 +00:00 (Migrated from github.com)

@coderabbitai review

@coderabbitai review
coderabbitai[bot] commented 2025-03-23 11:17:05 +00:00 (Migrated from github.com)
Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

<!-- This is an auto-generated reply by CodeRabbit --> <details> <summary>:white_check_mark: Actions performed</summary> Review triggered. > Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused. </details>
coderabbitai[bot] (Migrated from github.com) reviewed 2025-03-23 11:19:19 +00:00
coderabbitai[bot] (Migrated from github.com) left a comment

Actionable comments posted: 0

🧹 Nitpick comments (3)
src/conduits/java/com/enderio/conduits/client/gui/ConduitScreen.java (1)

81-90: Good implementation of priority display in UI.

The code correctly retrieves and displays the priority value for item conduits. The priority label and value are rendered at appropriate positions in the GUI, providing users with visibility into the conduit's priority setting.

Consider adding a comment explaining the magic numbers used for positioning (7 + 4 + 4 + 8 + 16 + 12) to improve code readability.

src/conduits/java/com/enderio/conduits/common/conduit/type/item/ItemConduitData.java (1)

67-77: Good encapsulation of the priority field with validation.

The priority field has been properly encapsulated with getter and setter methods, which is good practice. The validation in setPriority() ensures that values stay within a sensible range (-9999 to 9999).

Consider defining the min/max values as constants to improve maintainability:

private int priority = 0;
+private static final int MIN_PRIORITY = -9999;
+private static final int MAX_PRIORITY = 9999;

public int getPriority() {
    return priority;
}

public void setPriority(int priority) {
-   if (priority >= -9999 && priority <= 9999) {
+   if (priority >= MIN_PRIORITY && priority <= MAX_PRIORITY) {
        this.priority = priority;
    }
}
src/core/java/com/enderio/core/client/gui/widgets/MultiIconButton.java (1)

59-62: Missing implementation for screen reader accessibility.

The updateWidgetNarration method is empty, which affects accessibility for users who rely on screen readers. Consider adding appropriate narration text.

@Override
protected void updateWidgetNarration(NarrationElementOutput narrationElementOutput) {
+    String buttonType = type == MultiIconButtonType.PLUS_BUTTON ? "Increase" : "Decrease";
+    narrationElementOutput.add(NarratedElementType.TITLE, Component.translatable("narration.enderio.priority_button", buttonType));
+    narrationElementOutput.add(NarratedElementType.HINT, Component.translatable("narration.enderio.priority_button.hint"));
}
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 6fe4dcf45f and ba79b7d7ef.

Files ignored due to path filters (3)
  • src/core/resources/assets/enderio/textures/gui/multi_icon.png is excluded by !**/*.png
  • src/generated/resources/assets/enderio/lang/en_ud.json is excluded by !**/generated/**
  • src/generated/resources/assets/enderio/lang/en_us.json is excluded by !**/generated/**
📒 Files selected for processing (6)
  • src/conduits/java/com/enderio/conduits/client/gui/ConduitScreen.java (2 hunks)
  • src/conduits/java/com/enderio/conduits/client/gui/conduit/ItemConduitScreenExtension.java (2 hunks)
  • src/conduits/java/com/enderio/conduits/common/conduit/type/item/ItemConduitData.java (1 hunks)
  • src/conduits/java/com/enderio/conduits/common/conduit/type/item/ItemConduitTicker.java (2 hunks)
  • src/conduits/java/com/enderio/conduits/common/init/ConduitLang.java (1 hunks)
  • src/core/java/com/enderio/core/client/gui/widgets/MultiIconButton.java (1 hunks)
🧰 Additional context used
🧬 Code Definitions (2)
src/conduits/java/com/enderio/conduits/client/gui/ConduitScreen.java (1)
src/conduits/java/com/enderio/conduits/common/init/ConduitLang.java (1)
  • ConduitLang (8-21)
src/conduits/java/com/enderio/conduits/client/gui/conduit/ItemConduitScreenExtension.java (1)
src/core/java/com/enderio/core/client/gui/widgets/MultiIconButton.java (1)
  • MultiIconButton (21-87)
🔇 Additional comments (11)
src/conduits/java/com/enderio/conduits/common/init/ConduitLang.java (1)

17-17: LGTM! New language constant for Conduit Priority.

The addition of CONDUIT_PRIORITY constant follows the established pattern in this class and properly integrates with the existing language registration system.

src/conduits/java/com/enderio/conduits/common/conduit/type/item/ItemConduitTicker.java (2)

16-16: Added import for Comparator.

Appropriate import for the new sorting functionality.


32-33: Good implementation of priority-based sorting.

The sorting mechanism effectively prioritises connections with higher priority values by using the reversed() method on the comparator. This ensures that high-priority connections are processed first during each ticker cycle.

src/conduits/java/com/enderio/conduits/client/gui/ConduitScreen.java (1)

17-17: LGTM! Added import for ItemConduitType.

Appropriate import for the conditional type check in the render method.

src/conduits/java/com/enderio/conduits/client/gui/conduit/ItemConduitScreenExtension.java (2)

9-9: LGTM! Added import for MultiIconButton.

Appropriate import for the new UI controls.


29-49:

Verification successful

Good implementation of priority adjustment buttons.

The addition of plus and minus buttons for adjusting conduit priority provides a user-friendly way to modify priority values. The implementation correctly updates the underlying data structure when the buttons are pressed.

Consider adding validation or constraints to ensure the priority values remain within acceptable bounds, especially for the minus button which could potentially reduce the priority to negative values.

Run the following script to check if there's any validation in the setPriority method:


🏁 Script executed:

#!/bin/bash
# Description: Find definition of setPriority method in ItemConduitData

# Look for the setPriority method definition
rg -A 5 "public void setPriority\(" --type java

Length of output: 731


Priority adjustment buttons implementation validated

The priority controls have been well implemented. The setPriority method in ItemConduitData already enforces that the priority remains within the bounds of -9999 and 9999. Therefore, no further validation is needed in the GUI for preventing negative or out-of-bound values. If desired, you might still consider adding user feedback for cases where an invalid value is silently ignored.

  • File: src/conduits/java/com/enderio/conduits/client/gui/conduit/ItemConduitScreenExtension.java (lines 29-49)
  • File: src/conduits/java/com/enderio/conduits/common/conduit/type/item/ItemConduitData.java (the setPriority method)
src/core/java/com/enderio/core/client/gui/widgets/MultiIconButton.java (5)

16-19: Enum looks good for button type differentiation.

The MultiIconButtonType enum provides a clear way to differentiate between plus and minus buttons.


21-39: Well-structured button class with comprehensive constructors.

The button class is well-designed with appropriate fields and constructor overloads that provide flexibility when creating buttons.


41-57: Good implementation of button behaviour with keyboard modifiers.

The onPress method effectively handles different increment values based on keyboard modifiers (Shift, Control), allowing for fine and coarse adjustments to the priority value.


64-78: Correctly implemented rendering with hover effect.

The renderWidget method properly handles button rendering based on its type and hover state.


80-86: Useful factory methods for creating buttons.

The static factory methods make it easier to create buttons with appropriate types, promoting code reuse and reducing the chance of errors.

**Actionable comments posted: 0** <details> <summary>🧹 Nitpick comments (3)</summary><blockquote> <details> <summary>src/conduits/java/com/enderio/conduits/client/gui/ConduitScreen.java (1)</summary><blockquote> `81-90`: **Good implementation of priority display in UI.** The code correctly retrieves and displays the priority value for item conduits. The priority label and value are rendered at appropriate positions in the GUI, providing users with visibility into the conduit's priority setting. Consider adding a comment explaining the magic numbers used for positioning (7 + 4 + 4 + 8 + 16 + 12) to improve code readability. </blockquote></details> <details> <summary>src/conduits/java/com/enderio/conduits/common/conduit/type/item/ItemConduitData.java (1)</summary><blockquote> `67-77`: **Good encapsulation of the priority field with validation.** The priority field has been properly encapsulated with getter and setter methods, which is good practice. The validation in setPriority() ensures that values stay within a sensible range (-9999 to 9999). Consider defining the min/max values as constants to improve maintainability: ```diff private int priority = 0; +private static final int MIN_PRIORITY = -9999; +private static final int MAX_PRIORITY = 9999; public int getPriority() { return priority; } public void setPriority(int priority) { - if (priority >= -9999 && priority <= 9999) { + if (priority >= MIN_PRIORITY && priority <= MAX_PRIORITY) { this.priority = priority; } } ``` </blockquote></details> <details> <summary>src/core/java/com/enderio/core/client/gui/widgets/MultiIconButton.java (1)</summary><blockquote> `59-62`: **Missing implementation for screen reader accessibility.** The updateWidgetNarration method is empty, which affects accessibility for users who rely on screen readers. Consider adding appropriate narration text. ```diff @Override protected void updateWidgetNarration(NarrationElementOutput narrationElementOutput) { + String buttonType = type == MultiIconButtonType.PLUS_BUTTON ? "Increase" : "Decrease"; + narrationElementOutput.add(NarratedElementType.TITLE, Component.translatable("narration.enderio.priority_button", buttonType)); + narrationElementOutput.add(NarratedElementType.HINT, Component.translatable("narration.enderio.priority_button.hint")); } ``` </blockquote></details> </blockquote></details> <details> <summary>📜 Review details</summary> **Configuration used: CodeRabbit UI** **Review profile: CHILL** **Plan: Pro** <details> <summary>📥 Commits</summary> Reviewing files that changed from the base of the PR and between 6fe4dcf45fa0b98ad64ef0eadbd0bed2bb6a2e43 and ba79b7d7efb00479e9e7f4cd60f9f597249c5500. </details> <details> <summary>⛔ Files ignored due to path filters (3)</summary> * `src/core/resources/assets/enderio/textures/gui/multi_icon.png` is excluded by `!**/*.png` * `src/generated/resources/assets/enderio/lang/en_ud.json` is excluded by `!**/generated/**` * `src/generated/resources/assets/enderio/lang/en_us.json` is excluded by `!**/generated/**` </details> <details> <summary>📒 Files selected for processing (6)</summary> * `src/conduits/java/com/enderio/conduits/client/gui/ConduitScreen.java` (2 hunks) * `src/conduits/java/com/enderio/conduits/client/gui/conduit/ItemConduitScreenExtension.java` (2 hunks) * `src/conduits/java/com/enderio/conduits/common/conduit/type/item/ItemConduitData.java` (1 hunks) * `src/conduits/java/com/enderio/conduits/common/conduit/type/item/ItemConduitTicker.java` (2 hunks) * `src/conduits/java/com/enderio/conduits/common/init/ConduitLang.java` (1 hunks) * `src/core/java/com/enderio/core/client/gui/widgets/MultiIconButton.java` (1 hunks) </details> <details> <summary>🧰 Additional context used</summary> <details> <summary>🧬 Code Definitions (2)</summary> <details> <summary>src/conduits/java/com/enderio/conduits/client/gui/ConduitScreen.java (1)</summary><blockquote> <details> <summary>src/conduits/java/com/enderio/conduits/common/init/ConduitLang.java (1)</summary> * `ConduitLang` (8-21) </details> </blockquote></details> <details> <summary>src/conduits/java/com/enderio/conduits/client/gui/conduit/ItemConduitScreenExtension.java (1)</summary><blockquote> <details> <summary>src/core/java/com/enderio/core/client/gui/widgets/MultiIconButton.java (1)</summary> * `MultiIconButton` (21-87) </details> </blockquote></details> </details> </details> <details> <summary>🔇 Additional comments (11)</summary><blockquote> <details> <summary>src/conduits/java/com/enderio/conduits/common/init/ConduitLang.java (1)</summary> `17-17`: **LGTM! New language constant for Conduit Priority.** The addition of `CONDUIT_PRIORITY` constant follows the established pattern in this class and properly integrates with the existing language registration system. </details> <details> <summary>src/conduits/java/com/enderio/conduits/common/conduit/type/item/ItemConduitTicker.java (2)</summary> `16-16`: **Added import for Comparator.** Appropriate import for the new sorting functionality. --- `32-33`: **Good implementation of priority-based sorting.** The sorting mechanism effectively prioritises connections with higher priority values by using the `reversed()` method on the comparator. This ensures that high-priority connections are processed first during each ticker cycle. </details> <details> <summary>src/conduits/java/com/enderio/conduits/client/gui/ConduitScreen.java (1)</summary> `17-17`: **LGTM! Added import for ItemConduitType.** Appropriate import for the conditional type check in the render method. </details> <details> <summary>src/conduits/java/com/enderio/conduits/client/gui/conduit/ItemConduitScreenExtension.java (2)</summary> `9-9`: **LGTM! Added import for MultiIconButton.** Appropriate import for the new UI controls. --- `29-49`: <details> <summary>✅ Verification successful</summary> **Good implementation of priority adjustment buttons.** The addition of plus and minus buttons for adjusting conduit priority provides a user-friendly way to modify priority values. The implementation correctly updates the underlying data structure when the buttons are pressed. Consider adding validation or constraints to ensure the priority values remain within acceptable bounds, especially for the minus button which could potentially reduce the priority to negative values. Run the following script to check if there's any validation in the setPriority method: --- 🏁 Script executed: ```shell #!/bin/bash # Description: Find definition of setPriority method in ItemConduitData # Look for the setPriority method definition rg -A 5 "public void setPriority\(" --type java ``` Length of output: 731 --- </details> **Priority adjustment buttons implementation validated** The priority controls have been well implemented. The `setPriority` method in `ItemConduitData` already enforces that the priority remains within the bounds of -9999 and 9999. Therefore, no further validation is needed in the GUI for preventing negative or out-of-bound values. If desired, you might still consider adding user feedback for cases where an invalid value is silently ignored. - **File:** `src/conduits/java/com/enderio/conduits/client/gui/conduit/ItemConduitScreenExtension.java` (lines 29-49) - **File:** `src/conduits/java/com/enderio/conduits/common/conduit/type/item/ItemConduitData.java` (the `setPriority` method) </details> <details> <summary>src/core/java/com/enderio/core/client/gui/widgets/MultiIconButton.java (5)</summary> `16-19`: **Enum looks good for button type differentiation.** The MultiIconButtonType enum provides a clear way to differentiate between plus and minus buttons. --- `21-39`: **Well-structured button class with comprehensive constructors.** The button class is well-designed with appropriate fields and constructor overloads that provide flexibility when creating buttons. --- `41-57`: **Good implementation of button behaviour with keyboard modifiers.** The onPress method effectively handles different increment values based on keyboard modifiers (Shift, Control), allowing for fine and coarse adjustments to the priority value. --- `64-78`: **Correctly implemented rendering with hover effect.** The renderWidget method properly handles button rendering based on its type and hover state. --- `80-86`: **Useful factory methods for creating buttons.** The static factory methods make it easier to create buttons with appropriate types, promoting code reuse and reducing the chance of errors. </details> </blockquote></details> </details> <!-- This is an auto-generated comment by CodeRabbit for review status -->
Rover656 commented 2025-04-30 10:35:52 +00:00 (Migrated from github.com)

I should be able to review these changes in the coming week or two as university is finishing up for me, thanks for your hard work and patience!

I should be able to review these changes in the coming week or two as university is finishing up for me, thanks for your hard work and patience!
h-ok-o commented 2025-04-30 20:26:11 +00:00 (Migrated from github.com)

I should be able to review these changes in the coming week or two as university is finishing up for me, thanks for your hard work and patience!

its fine, though I have to put this here
e8383d1209878047077d36bdb5fe829e

> I should be able to review these changes in the coming week or two as university is finishing up for me, thanks for your hard work and patience! its fine, though I have to put this here ![e8383d1209878047077d36bdb5fe829e](https://github.com/user-attachments/assets/7f63eedb-6bd3-4c40-a7b7-c5843c409b04)
Rover656 (Migrated from github.com) approved these changes 2025-05-04 12:56:25 +00:00
Rover656 (Migrated from github.com) left a comment

This looks good to me, thanks for working on this!

I'll manually port this up to 1.21.1 as part of my conduit rewrite work in #1025

This looks good to me, thanks for working on this! I'll manually port this up to 1.21.1 as part of my conduit rewrite work in #1025
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: Team-EnderIO/EnderIO#1036
No description provided.