fix: slime block inaccurate damage properties + weird ui stuff

This commit is contained in:
Fireblade 2026-05-25 13:02:07 -04:00
parent fb46ed3005
commit e2b81cae79
7 changed files with 50 additions and 8 deletions

View file

@ -1486,6 +1486,7 @@ void CMinecraftApp::ApplyGameSettingsChanged(int iPad)
ActionGameSettings(iPad,eGameSetting_ControlScheme );
ActionGameSettings(iPad,eGameSetting_ControlInvertLook);
ActionGameSettings(iPad,eGameSetting_ControlSouthPaw);
ActionGameSettings(iPad,eGameSetting_ControlType);
ActionGameSettings(iPad,eGameSetting_SplitScreenVertical);
ActionGameSettings(iPad,eGameSetting_GamertagsVisible);

View file

@ -326,11 +326,11 @@ void UIScene::loadMovie()
if(primaryPad < 0 || primaryPad >= XUSER_MAX_COUNT)
primaryPad = 0;
const int controlType = app.GetGameSettings(primaryPad, eGameSetting_ControlType);
const bool force720ForControlType = (controlType == 3 || controlType == 4 || controlType == 6);
const bool force720ForControlType = (controlType == 3 || controlType == 5);
// tutorial popups + HUD elements have inaccuracies + crashes that we need to fix here
const bool isTutorialPopupMovie = (moviePath.find(L"TutorialPopup") == 0);
const bool isHUDMovie = (moviePath.find(L"HUD") == 0);
const bool use1080 = (ui.getScreenHeight() > 720.0f) && (!force720ForControlType || isTutorialPopupMovie || isHUDMovie);
const bool use1080 = (ui.getScreenHeight() > 720.0f) && (!force720ForControlType || isTutorialPopupMovie);
if(use1080)
{
moviePath.append(L"1080.swf");

View file

@ -1510,6 +1510,7 @@ static Minecraft* InitialiseMinecraftRuntime()
app.InitGameSettings();
app.InitialiseTips();
ui.ReloadSkin();
return pMinecraft;
}

View file

@ -356,6 +356,8 @@ void Entity::_init(bool useSmallId, Level *level)
// 4J Added
m_ignoreVerticalCollisions = false;
m_clearFallDamageThisTick = false;
m_ignoreFallDamageUntilGround = false;
m_uiAnimOverrideBitmask = 0L;
m_ignorePortal = false;
}
@ -1036,6 +1038,24 @@ bool Entity::makeStepSound()
void Entity::checkFallDamage(double ya, bool onGround)
{
if (m_clearFallDamageThisTick)
{
m_clearFallDamageThisTick = false;
fallDistance = 0;
return;
}
if (m_ignoreFallDamageUntilGround)
{
if (ya < 0)
{
m_ignoreFallDamageUntilGround = false;
fallDistance = 0;
}
else
{
return;
}
}
if (onGround)
{
if (fallDistance > 0)
@ -1068,6 +1088,13 @@ bool Entity::isFireImmune()
return fireImmune;
}
void Entity::clearFallDamageQueue()
{
fallDistance = 0.0f;
m_clearFallDamageThisTick = true;
m_ignoreFallDamageUntilGround = true;
}
void Entity::causeFallDamage(float distance)
{
if (rider.lock() != nullptr) rider.lock()->causeFallDamage(distance);

View file

@ -170,6 +170,8 @@ private:
protected:
// 4J Added so that client side simulations on the host are not affected by zero-lag
bool m_ignoreVerticalCollisions;
bool m_clearFallDamageThisTick;
bool m_ignoreFallDamageUntilGround;
bool m_ignorePortal;
@ -253,6 +255,7 @@ protected:
public:
bool isFireImmune();
void clearFallDamageQueue();
protected:
virtual void causeFallDamage(float distance);

View file

@ -164,7 +164,7 @@ void LivingEntity::checkFallDamage(double ya, bool onGround)
updateInWaterState();
}
if (onGround && fallDistance > 0)
if (onGround)
{
int xt = Mth::floor(x);
int yt = Mth::floor(y - 0.2f - heightOffset);
@ -182,8 +182,11 @@ void LivingEntity::checkFallDamage(double ya, bool onGround)
Tile *tile = Tile::tiles[t];
if (t > 0 && tile != nullptr) // tu31 tutorial world fix
{
auto ent = shared_from_this();
Tile::tiles[t]->fallOn(level, xt, yt, zt, ent, fallDistance);
if (fallDistance > 0 || t == Tile::slimeBlock->id)
{
auto ent = shared_from_this();
Tile::tiles[t]->fallOn(level, xt, yt, zt, ent, fallDistance);
}
}
}

View file

@ -45,6 +45,11 @@ void SlimeTile::fallOn(Level *level, int x, int y, int z,
if (entity == nullptr)
return;
entity->clearFallDamageQueue();
entity->fallDistance = 0.0f;
entity->onGround = false;
if (entity->isSneaking())
return;
@ -60,13 +65,15 @@ void SlimeTile::fallOn(Level *level, int x, int y, int z,
entity->yd *= 0.8f;
}
}
entity->fallDistance = 0.0f;
entity->onGround = false;
}
void SlimeTile::stepOn(Level *level, int x, int y, int z, shared_ptr<Entity> entity)
{
if (entity != nullptr)
{
entity->clearFallDamageQueue();
}
if (entity != nullptr &&
std::abs(entity->yd) < 0.1f &&
!entity->isSneaking())