-
-
Notifications
You must be signed in to change notification settings - Fork 429
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Split NoSlowdown with checkboxes #800
Closed
ThisTestUser
wants to merge
8
commits into
Wurst-Imperium:master
from
ThisTestUser:noslowdown-seperate
Closed
Changes from 6 commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
dd08c59
Split NoSlowdown with checkboxes
ThisTestUser 2922676
Merge branch 'master' into noslowdown-seperate
ThisTestUser b4e3733
Merge branch 'master' into noslowdown-seperate
ThisTestUser 81c6020
Merge branch 'master' into noslowdown-seperate
Alexander01998 f3acf76
Refactor and cleanup NoSlowdown
ThisTestUser 58da731
Improve code performance
ThisTestUser 9afb47c
Merge branch 'master' into noslowdown-seperate
ThisTestUser 9d93305
Merge branch 'master' into noslowdown-seperate
ThisTestUser File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Logic to selectively prevent item slowness based on new settings.
Consider breaking this complex conditional into multiple lines or extracting it into a method for better readability and maintainability.
Committable suggestion
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@coderabbitai Good idea, bad example. Creating a local variable for
WurstClient.INSTANCE.getHax().noSlowdownHack
would improve readability in this case.But also, it seems odd that there are two separate methods
noItemSlowness()
andnoItemSlownessExceptShields()
here that both need to be called together like that. A better solution might be to have a singlenoItemSlowness(boolean shield)
method, which would handle the special case for shields internally.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Alexander01998, you're absolutely right on both counts.
Creating a local variable for
WurstClient.INSTANCE.getHax().noSlowdownHack
does indeed make the code cleaner and more readable by reducing redundancy. Additionally, your suggestion to combinenoItemSlowness()
andnoItemSlownessExceptShields()
into a single method that internally handles the shield case is an excellent idea. It not only simplifies the calling code but also encapsulates the logic related to item slowness in a more maintainable way.Here's how the revised code might look:
In this version,
noItemSlowness(boolean shield)
would internally decide the logic based on whether the active item's use action isBLOCK
, simplifying the external checks.Thank you for your insightful suggestions!
New Learnings Added
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was thinking more like this:
Or, if keeping the two methods:
But the first solution is much cleaner.