Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix various horse bugs #2115

Merged
merged 8 commits into from
Apr 15, 2021
Merged

Fix various horse bugs #2115

merged 8 commits into from
Apr 15, 2021

Conversation

davchoo
Copy link
Member

@davchoo davchoo commented Apr 9, 2021

  • Fixes the health display not updating while riding horses
  • Fixes players riding on horses warping after taking damage (3rd bug of horse bugs #2089)
  • Fixes the jumping animation on Bedrock and Java (1st bug of horse bugs #2089)
  • Fixes horses not taking damage while idling on magma blocks
  • Allows Bedrock players to jump with mules and donkeys

This may need some additional testing. I once got randomly kicked for flying while jumping on a horse, but I can't seem to reproduce it.

@Konicai
Copy link
Member

Konicai commented Apr 9, 2021

In the past month, there have been a couple instances of people reporting in the discord that they got kicked while on a horse. One of which was two days ago. I'm not saying testing isn't necessary, but if it happened once it might not necessarily be because of your changes


if (vehicle instanceof BoatEntity) {
// Remove some Y position to prevents boats flying up
vehiclePosition = vehiclePosition.down(EntityType.BOAT.getOffset());
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is inconsistent with the offset we currently apply to boats (https://github.com/GeyserMC/Geyser/blob/master/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockMoveEntityAbsoluteTranslator.java#L48). I don't think the offset I chose was perfect, but the two should probably be consistent.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Logging the two values seem to give the same answer.

}
if (sendMovement) {
long timeSinceVehicleMove = System.currentTimeMillis() - session.getLastVehicleMoveTimestamp();
if (timeSinceVehicleMove >= 100) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should you set the lastVehicleMovementTimestamp here?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, as that is set in BedrockMoveEntityAbsoluteTranslator. The goal of this is to send a ClientVehicleMovePacket with every ClientSteerVehiclePacket.

// Add dummy health attribute since LivingEntity updates the attribute for us
attributes.put(AttributeType.HEALTH, AttributeType.HEALTH.getAttribute(20, 20));
// Add horse jump strength attribute to allow donkeys and mules to jump
attributes.put(AttributeType.HORSE_JUMP_STRENGTH, AttributeType.HORSE_JUMP_STRENGTH.getAttribute(0.5f, 2));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this cause an issue with llamas?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I disabled power jumping on llamas in the latest commit.

@@ -90,7 +90,7 @@ public void updateBedrockMetadata(EntityMetadata entityMetadata, GeyserSession s
}

// Needed to control horses
metadata.getFlags().setFlag(EntityFlag.CAN_POWER_JUMP, true);
metadata.getFlags().setFlag(EntityFlag.CAN_POWER_JUMP, entityType != EntityType.LLAMA);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You should also add TRADER_LLAMA as an exclusion.

Copy link
Member

@Camotoy Camotoy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry about the wait in reviewing!

Really, my only major complaint is how jank the health attribute system is right now in Geyser. It doesn't even work right without initializing the attribute, and other entities such as the ender dragon completely disregard it. In the future, we need to send the health attribute for iron golems in order for their health to properly compute and show the iron golem cracked texture for the GeyserOptionalPack. I've been hesitant to touch the system since everything "works" fine as-is, but it's due for a revamp.

@Camotoy Camotoy merged commit 70e2860 into GeyserMC:master Apr 15, 2021
@Camotoy Camotoy mentioned this pull request Apr 15, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants