From 46989fb6b5ab68b158f4d9da010016560f5273d6 Mon Sep 17 00:00:00 2001 From: Marco Date: Sun, 19 Apr 2020 10:57:37 +0200 Subject: [PATCH 1/2] Reset wolf color, if not tamed Fix baby metadata --- .../connector/entity/living/AgeableEntity.java | 6 ++---- .../entity/living/animal/tameable/WolfEntity.java | 14 +++++++++++++- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/connector/src/main/java/org/geysermc/connector/entity/living/AgeableEntity.java b/connector/src/main/java/org/geysermc/connector/entity/living/AgeableEntity.java index a9c60e45..f205c060 100644 --- a/connector/src/main/java/org/geysermc/connector/entity/living/AgeableEntity.java +++ b/connector/src/main/java/org/geysermc/connector/entity/living/AgeableEntity.java @@ -43,10 +43,8 @@ public class AgeableEntity extends CreatureEntity { public void updateBedrockMetadata(EntityMetadata entityMetadata, GeyserSession session) { if (entityMetadata.getId() == 15) { boolean isBaby = (boolean) entityMetadata.getValue(); - if (isBaby) { - metadata.put(EntityData.SCALE, .55f); - metadata.getFlags().setFlag(EntityFlag.BABY, true); - } + metadata.put(EntityData.SCALE, isBaby ? .55f : 1f); + metadata.getFlags().setFlag(EntityFlag.BABY, isBaby); } super.updateBedrockMetadata(entityMetadata, session); diff --git a/connector/src/main/java/org/geysermc/connector/entity/living/animal/tameable/WolfEntity.java b/connector/src/main/java/org/geysermc/connector/entity/living/animal/tameable/WolfEntity.java index 0ac49d55..fafb0d21 100644 --- a/connector/src/main/java/org/geysermc/connector/entity/living/animal/tameable/WolfEntity.java +++ b/connector/src/main/java/org/geysermc/connector/entity/living/animal/tameable/WolfEntity.java @@ -44,9 +44,21 @@ public class WolfEntity extends TameableEntity { if (entityMetadata.getId() == 18) { metadata.getFlags().setFlag(EntityFlag.INTERESTED, (boolean) entityMetadata.getValue()); } + + //Reset wolf color + if (entityMetadata.getId() == 16) { + byte xd = (byte) entityMetadata.getValue(); + boolean angry = (xd & 0x02) == 0x02; + boolean tamed = (xd & 0x04) == 0x04; + if (angry || !tamed) { + metadata.put(EntityData.COLOR, (byte) 0); + } + } + // Wolf collar color // Relies on EntityData.OWNER_EID being set in TameableEntity.java - if (entityMetadata.getId() == 19) { + boolean tamed = !metadata.getFlags().getFlag(EntityFlag.ANGRY) && metadata.getFlags().getFlag(EntityFlag.TAMED); + if (entityMetadata.getId() == 19 && tamed) { metadata.put(EntityData.COLOR, (byte) (int) entityMetadata.getValue()); } super.updateBedrockMetadata(entityMetadata, session); From 36b549be39aba017daf363322b23d6cc05f8a30a Mon Sep 17 00:00:00 2001 From: Marco Date: Sun, 19 Apr 2020 11:06:11 +0200 Subject: [PATCH 2/2] Reset wolf color --- .../connector/entity/living/animal/tameable/WolfEntity.java | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/connector/src/main/java/org/geysermc/connector/entity/living/animal/tameable/WolfEntity.java b/connector/src/main/java/org/geysermc/connector/entity/living/animal/tameable/WolfEntity.java index fafb0d21..118262dc 100644 --- a/connector/src/main/java/org/geysermc/connector/entity/living/animal/tameable/WolfEntity.java +++ b/connector/src/main/java/org/geysermc/connector/entity/living/animal/tameable/WolfEntity.java @@ -49,16 +49,14 @@ public class WolfEntity extends TameableEntity { if (entityMetadata.getId() == 16) { byte xd = (byte) entityMetadata.getValue(); boolean angry = (xd & 0x02) == 0x02; - boolean tamed = (xd & 0x04) == 0x04; - if (angry || !tamed) { + if (angry) { metadata.put(EntityData.COLOR, (byte) 0); } } // Wolf collar color // Relies on EntityData.OWNER_EID being set in TameableEntity.java - boolean tamed = !metadata.getFlags().getFlag(EntityFlag.ANGRY) && metadata.getFlags().getFlag(EntityFlag.TAMED); - if (entityMetadata.getId() == 19 && tamed) { + if (entityMetadata.getId() == 19 && !metadata.getFlags().getFlag(EntityFlag.ANGRY)) { metadata.put(EntityData.COLOR, (byte) (int) entityMetadata.getValue()); } super.updateBedrockMetadata(entityMetadata, session);