WolfEntity: fix entire wolf being set to a color in rare instances (#1630)

This commit is contained in:
Camotoy 2020-12-06 14:46:31 -05:00 committed by GitHub
parent 2f294c9466
commit 798ae34cd1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -60,6 +60,11 @@ public class WolfEntity extends TameableEntity {
// Relies on EntityData.OWNER_EID being set in TameableEntity.java
if (entityMetadata.getId() == 19 && !metadata.getFlags().getFlag(EntityFlag.ANGRY)) {
metadata.put(EntityData.COLOR, collarColor = (byte) (int) entityMetadata.getValue());
if (!metadata.containsKey(EntityData.OWNER_EID)) {
// If a color is set and there is no owner entity ID, set one.
// Otherwise, the entire wolf is set to that color: https://user-images.githubusercontent.com/9083212/99209989-92691200-2792-11eb-911d-9a315c955be9.png
metadata.put(EntityData.OWNER_EID, session.getPlayerEntity().getGeyserId());
}
}
// Wolf anger (1.16+)