Fix wolf collar color when it's no longer angry (Closes #1404)

This commit is contained in:
RednedEpic 2020-10-15 01:54:05 -05:00
parent 7d2745dee6
commit 64f2233581

View file

@ -34,6 +34,8 @@ import org.geysermc.connector.network.session.GeyserSession;
public class WolfEntity extends TameableEntity {
private byte collarColor;
public WolfEntity(long entityId, long geyserId, EntityType entityType, Vector3f position, Vector3f motion, Vector3f rotation) {
super(entityId, geyserId, entityType, position, motion, rotation);
}
@ -57,12 +59,13 @@ public class WolfEntity extends TameableEntity {
// Wolf collar color
// Relies on EntityData.OWNER_EID being set in TameableEntity.java
if (entityMetadata.getId() == 19 && !metadata.getFlags().getFlag(EntityFlag.ANGRY)) {
metadata.put(EntityData.COLOR, (byte) (int) entityMetadata.getValue());
metadata.put(EntityData.COLOR, collarColor = (byte) (int) entityMetadata.getValue());
}
// Wolf anger (1.16+)
if (entityMetadata.getId() == 20) {
metadata.getFlags().setFlag(EntityFlag.ANGRY, (int) entityMetadata.getValue() != 0);
metadata.put(EntityData.COLOR, (int) entityMetadata.getValue() != 0 ? (byte) 0 : collarColor);
}
super.updateBedrockMetadata(entityMetadata, session);