From c777641a9000a7ddedc794b86a28494298ef18be Mon Sep 17 00:00:00 2001 From: DoctorMacc Date: Thu, 9 Apr 2020 17:53:38 -0400 Subject: [PATCH] Changes? --- .../connector/entity/living/animal/tameable/CatEntity.java | 5 +++-- .../entity/living/animal/tameable/TameableEntity.java | 4 +++- .../connector/entity/living/animal/tameable/WolfEntity.java | 2 ++ 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/connector/src/main/java/org/geysermc/connector/entity/living/animal/tameable/CatEntity.java b/connector/src/main/java/org/geysermc/connector/entity/living/animal/tameable/CatEntity.java index f380360c..dcfdf841 100644 --- a/connector/src/main/java/org/geysermc/connector/entity/living/animal/tameable/CatEntity.java +++ b/connector/src/main/java/org/geysermc/connector/entity/living/animal/tameable/CatEntity.java @@ -45,10 +45,11 @@ public class CatEntity extends TameableEntity { if ((int) entityMetadata.getValue() == 0) { metadata.put(EntityData.VARIANT, 8); } else if ((int) entityMetadata.getValue() == 8) { - // Assumption, need to test metadata.put(EntityData.VARIANT, 0); } else if ((int) entityMetadata.getValue() == 9) { - metadata.put(EntityData.VARIANT, 7); + metadata.put(EntityData.VARIANT, 10); + } else if ((int) entityMetadata.getValue() == 10) { + metadata.put(EntityData.VARIANT, 9); } else { metadata.put(EntityData.VARIANT, (int) entityMetadata.getValue()); } diff --git a/connector/src/main/java/org/geysermc/connector/entity/living/animal/tameable/TameableEntity.java b/connector/src/main/java/org/geysermc/connector/entity/living/animal/tameable/TameableEntity.java index 19ac8178..2d3e0b1d 100644 --- a/connector/src/main/java/org/geysermc/connector/entity/living/animal/tameable/TameableEntity.java +++ b/connector/src/main/java/org/geysermc/connector/entity/living/animal/tameable/TameableEntity.java @@ -46,9 +46,11 @@ public class TameableEntity extends AnimalEntity { metadata.getFlags().setFlag(EntityFlag.SITTING, (xd & 0x01) == 0x01); metadata.getFlags().setFlag(EntityFlag.ANGRY, (xd & 0x02) == 0x02); metadata.getFlags().setFlag(EntityFlag.TAMED, (xd & 0x04) == 0x04); + // Must be set for wolf collar color to work + // Extending it to all entities to prevent future bugs if (metadata.getFlags().getFlag(EntityFlag.TAMED)) { metadata.put(EntityData.OWNER_EID, session.getPlayerEntity().getGeyserId()); - } + } // Can't de-tame an entity so no resetting the owner ID } 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 9796d364..0ac49d55 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,6 +44,8 @@ public class WolfEntity extends TameableEntity { if (entityMetadata.getId() == 18) { metadata.getFlags().setFlag(EntityFlag.INTERESTED, (boolean) entityMetadata.getValue()); } + // Wolf collar color + // Relies on EntityData.OWNER_EID being set in TameableEntity.java if (entityMetadata.getId() == 19) { metadata.put(EntityData.COLOR, (byte) (int) entityMetadata.getValue()); }