Commit Graph

1 Commits

Author SHA1 Message Date
Aikar
84d350c24c
Fix CraftEntity hashCode
hashCodes are not allowed to change, however bukkit used a value
that does change, the entityId.

When an entity is teleported dimensions, the entity reference is
replaced with a new one with a new entity ID.

For hashCode, we can simply use the UUID's hashCode to keep
the hashCode from changing.

equals() is ok to use getEntityId() because equals() should only
be true if both the left and right are the same reference.

Since entity ids can not duplicate during runtime, this
check is essentially the same as this.getHandle() == other.getHandle()

However, replaced it too to make it clearer of intent.
2018-06-10 20:29:15 -04:00