3
0
Mirror von https://github.com/GeyserMC/Geyser.git synchronisiert 2024-11-08 17:20:20 +01:00

Fix horse jump meter showing if not saddled

Dieser Commit ist enthalten in:
Camotoy 2021-07-08 18:55:28 -04:00
Ursprung 32bbd8ae1c
Commit 92cd36d81f
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: 7EEFB66FE798081F

Datei anzeigen

@ -56,6 +56,8 @@ public class AbstractHorseEntity extends AnimalEntity {
// Specifies the size of the entity's inventory. Required to place slots in the entity. // Specifies the size of the entity's inventory. Required to place slots in the entity.
metadata.put(EntityData.CONTAINER_BASE_SIZE, 2); metadata.put(EntityData.CONTAINER_BASE_SIZE, 2);
metadata.getFlags().setFlag(EntityFlag.WASD_CONTROLLED, true);
} }
@Override @Override
@ -76,8 +78,10 @@ public class AbstractHorseEntity extends AnimalEntity {
public void updateBedrockMetadata(EntityMetadata entityMetadata, GeyserSession session) { public void updateBedrockMetadata(EntityMetadata entityMetadata, GeyserSession session) {
if (entityMetadata.getId() == 17) { if (entityMetadata.getId() == 17) {
byte xd = (byte) entityMetadata.getValue(); byte xd = (byte) entityMetadata.getValue();
metadata.getFlags().setFlag(EntityFlag.TAMED, (xd & 0x02) == 0x02); boolean tamed = (xd & 0x02) == 0x02;
metadata.getFlags().setFlag(EntityFlag.SADDLED, (xd & 0x04) == 0x04); 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.EATING, (xd & 0x10) == 0x10);
metadata.getFlags().setFlag(EntityFlag.STANDING, (xd & 0x20) == 0x20); metadata.getFlags().setFlag(EntityFlag.STANDING, (xd & 0x20) == 0x20);
@ -106,13 +110,11 @@ public class AbstractHorseEntity extends AnimalEntity {
} }
// Set container type if tamed // 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 // Shows the jump meter
boolean canPowerJump = entityType != EntityType.LLAMA && entityType != EntityType.TRADER_LLAMA; metadata.getFlags().setFlag(EntityFlag.CAN_POWER_JUMP, saddled);
metadata.getFlags().setFlag(EntityFlag.CAN_POWER_JUMP, canPowerJump); }
metadata.getFlags().setFlag(EntityFlag.WASD_CONTROLLED, true);
super.updateBedrockMetadata(entityMetadata, session); super.updateBedrockMetadata(entityMetadata, session);
} }