fix: boat plr height & sneak height (#1459)

This commit is contained in:
Sylvessa 2026-04-02 17:16:31 -05:00 committed by GitHub
parent e4c08b8414
commit 8bf0343544
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 32 additions and 3 deletions

View file

@ -241,7 +241,7 @@ void HumanoidModel::setupAnim(float time, float r, float bob, float yRot, float
if (riding)
{
if(uiBitmaskOverrideAnim&(1<<eAnim_SmallModel) == 0)
if ((uiBitmaskOverrideAnim&(1<<eAnim_SmallModel)) == 0)
{
arm0->xRot += -HALF_PI * 0.4f;
arm1->xRot += -HALF_PI * 0.4f;

View file

@ -287,6 +287,20 @@ void ItemInHandRenderer::renderItem(shared_ptr<LivingEntity> mob, shared_ptr<Ite
float xo = 0.0f;
float yo = 0.3f;
// Re position height of held item if skin is small
if (mob->getAnimOverrideBitmask() & (1 << HumanoidModel::eAnim_SmallModel))
{
if (mob->isRiding())
{
std::shared_ptr<Entity> ridingEntity = mob->riding;
if (ridingEntity != nullptr) // Safety check;
{
yo += 0.3f; // reverts the change in Boat.cpp for smaller models.
}
}
}
glEnable(GL_RESCALE_NORMAL);
glTranslatef(-xo, -yo, 0);
float s = 1.5f;

View file

@ -199,11 +199,26 @@ void PlayerRenderer::render(shared_ptr<Entity> _mob, double x, double y, double
armorParts1->sneaking = armorParts2->sneaking = humanoidModel->sneaking = mob->isSneaking();
double yp = y - mob->heightOffset;
if (mob->isSneaking() && !mob->instanceof(eTYPE_LOCALPLAYER))
if (mob->isSneaking())
{
yp -= 2 / 16.0f;
}
if (mob->getAnimOverrideBitmask() & (1 << HumanoidModel::eAnim_SmallModel))
{
if (mob->isRiding())
{
std::shared_ptr<Entity> ridingEntity = mob->riding;
if (ridingEntity != nullptr) // Safety check;
{
if (ridingEntity->instanceof(eTYPE_BOAT))
{
yp += 0.25f; // reverts the change in Boat.cpp for smaller models.
}
}
}
}
// Check if an idle animation is needed
if(mob->getAnimOverrideBitmask()&(1<<HumanoidModel::eAnim_HasIdle))
{

View file

@ -87,7 +87,7 @@ Boat::Boat(Level *level, double x, double y, double z) : Entity( level )
double Boat::getRideHeight()
{
return heightOffset;
return heightOffset - 0.4f;
}
bool Boat::hurt(DamageSource *source, float hurtDamage)