From 92cd36d81fb28680fbb8817a2ef4373c41951541 Mon Sep 17 00:00:00 2001 From: Camotoy <20743703+Camotoy@users.noreply.github.com> Date: Thu, 8 Jul 2021 18:55:28 -0400 Subject: [PATCH] Fix horse jump meter showing if not saddled --- .../animal/horse/AbstractHorseEntity.java | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/connector/src/main/java/org/geysermc/connector/entity/living/animal/horse/AbstractHorseEntity.java b/connector/src/main/java/org/geysermc/connector/entity/living/animal/horse/AbstractHorseEntity.java index 6364fe7aa..d4aed4196 100644 --- a/connector/src/main/java/org/geysermc/connector/entity/living/animal/horse/AbstractHorseEntity.java +++ b/connector/src/main/java/org/geysermc/connector/entity/living/animal/horse/AbstractHorseEntity.java @@ -56,6 +56,8 @@ public class AbstractHorseEntity extends AnimalEntity { // Specifies the size of the entity's inventory. Required to place slots in the entity. metadata.put(EntityData.CONTAINER_BASE_SIZE, 2); + + metadata.getFlags().setFlag(EntityFlag.WASD_CONTROLLED, true); } @Override @@ -76,8 +78,10 @@ public class AbstractHorseEntity extends AnimalEntity { public void updateBedrockMetadata(EntityMetadata entityMetadata, GeyserSession session) { if (entityMetadata.getId() == 17) { byte xd = (byte) entityMetadata.getValue(); - metadata.getFlags().setFlag(EntityFlag.TAMED, (xd & 0x02) == 0x02); - metadata.getFlags().setFlag(EntityFlag.SADDLED, (xd & 0x04) == 0x04); + boolean tamed = (xd & 0x02) == 0x02; + boolean saddled = (xd & 0x04) == 0x04; + metadata.getFlags().setFlag(EntityFlag.TAMED, tamed); + metadata.getFlags().setFlag(EntityFlag.SADDLED, saddled); metadata.getFlags().setFlag(EntityFlag.EATING, (xd & 0x10) == 0x10); metadata.getFlags().setFlag(EntityFlag.STANDING, (xd & 0x20) == 0x20); @@ -106,13 +110,11 @@ public class AbstractHorseEntity extends AnimalEntity { } // Set container type if tamed - metadata.put(EntityData.CONTAINER_TYPE, ((xd & 0x02) == 0x02) ? (byte) ContainerType.HORSE.getId() : (byte) 0); - } + metadata.put(EntityData.CONTAINER_TYPE, tamed ? (byte) ContainerType.HORSE.getId() : (byte) 0); - // Needed to control horses - boolean canPowerJump = entityType != EntityType.LLAMA && entityType != EntityType.TRADER_LLAMA; - metadata.getFlags().setFlag(EntityFlag.CAN_POWER_JUMP, canPowerJump); - metadata.getFlags().setFlag(EntityFlag.WASD_CONTROLLED, true); + // Shows the jump meter + metadata.getFlags().setFlag(EntityFlag.CAN_POWER_JUMP, saddled); + } super.updateBedrockMetadata(entityMetadata, session); }