You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Strings in Java are not guaranteed to share same references even if they have the same contents. You will occasionally get a negative result when comparing identical strings with the identity operator.
A better way to compare strings would be using the 'equals' method. There are some examples using it:
Before:
damageType == "arrow"
damageType != "player"
After:
damageType.equals("arrow")
!damageType.equals("player")
Switching '==' and '!=' to the corresponding 'equals' comparison would help you to reduce non-intentional behaviour in your mod. I have been testing compatibility of my mod to yours. And found that sometimes it does not work due to the usage of reference equality.
The text was updated successfully, but these errors were encountered:
Thanks a lot for all the issues you've submitted, I really appreciate the guidance. I've actually learned quite a bit since most of this code was creating, and 1.4 is going to have all of these fixes implemented, most of them having been corrected in code already. This repository is out-of-date very much so at this point, as I haven't seen a point in updating non-compilable code, but rest assured that these, along with other issues are being resolved.
Strings in Java are not guaranteed to share same references even if they have the same contents. You will occasionally get a negative result when comparing identical strings with the identity operator.
A better way to compare strings would be using the 'equals' method. There are some examples using it:
Before:
After:
Switching '==' and '!=' to the corresponding 'equals' comparison would help you to reduce non-intentional behaviour in your mod. I have been testing compatibility of my mod to yours. And found that sometimes it does not work due to the usage of reference equality.
The text was updated successfully, but these errors were encountered: