mcmonkeyprojects / Sentinel

Combat NPCs for Spigot!
MIT License
165 stars 85 forks source link

Non usage of parameters #385

Closed h14turkiye closed 1 year ago

h14turkiye commented 1 year ago

SentinelUtilities isLookingTowards(Location myLoc, Location theirLoc, float yawLimit, float pitchLimit) pitchLimit paramater is not involved with the method.


if (!(Math.abs(pitchHelp - pitch) < **yawLimit**)) {
            return false;
        }
        return true;
``` is the current one.
`return (Math.abs(pitchHelp - pitch) < **pitchLimit**);` should have been used rather than the full block.
mcmonkey4eva commented 1 year ago

ye, typo.

Also no inlining that would be improper in this case: there are several sequential fail checks each containing a return false;, with an eventual return true; if none passed. This is a clean and simple standard validation check in a consistent format. Changing just that line to be inlined would make the section inconsistent, and changing the full thing to be inline would make it a really messy long gross single line.