Skip to content
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

Rename SculkShriekerWarningManager#canIncreaseWarningLevel to isWardenNearby #3797

Merged
merged 1 commit into from
Feb 22, 2024

Conversation

TheDeathlyCow
Copy link
Contributor

The name of the canIncreaseWarningLevel() method of SculkShriekerWarningManager suggests the opposite of what it is actually used for, and is overbroad.

This method is used in warnNearbyPlayers() to prevent shriekers from spawning multiple wardens if other wardens are nearby. It returns true if there are any Wardens within a 48x48x48 box around the given position in the world, and false if there are none. When it returns true, then warnNearbyPlayers() will fail. However, the current name suggests that warnNearbyPlayers() should only fail if canIncreaseWarningLevel() returns false.

It is also a bit overbroad, as there are other conditions that are checked to see if a sculk shrieker will warn a player or not, so this PR fixes these issues by renaming the method to isWardenNearby to better reflect both what the method actually does and is used for.

@Shnupbups Shnupbups added refactor A PR that renames existing names. snapshot A PR that targets a snapshot version of Minecraft labels Feb 22, 2024
@Shnupbups Shnupbups merged commit 75e590d into FabricMC:24w07a Feb 22, 2024
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
refactor A PR that renames existing names. snapshot A PR that targets a snapshot version of Minecraft
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants