From fe983a1a45b23c67cf6c758a4f0ffe6a8ba764d6 Mon Sep 17 00:00:00 2001 From: x12xx12x <44411062+12xx12@users.noreply.github.com> Date: Wed, 20 Apr 2022 00:10:35 +0200 Subject: Valid Height is now checked by vector. --- src/Entities/EnderCrystal.cpp | 2 +- src/Entities/Entity.cpp | 4 ++-- src/Entities/Pawn.cpp | 4 ++-- src/Entities/Player.cpp | 4 ++-- 4 files changed, 7 insertions(+), 7 deletions(-) (limited to 'src/Entities') diff --git a/src/Entities/EnderCrystal.cpp b/src/Entities/EnderCrystal.cpp index 07fd56dad..c356caa70 100644 --- a/src/Entities/EnderCrystal.cpp +++ b/src/Entities/EnderCrystal.cpp @@ -95,7 +95,7 @@ void cEnderCrystal::KilledBy(TakeDamageInfo & a_TDI) m_World->DoExplosionAt(6.0, GetPosX(), GetPosY() + GetHeight() / 2, GetPosZ(), true, esEnderCrystal, this); const auto Position = GetPosition().Floor(); - if (cChunkDef::IsValidHeight(Position.y)) + if (cChunkDef::IsValidHeight(Position)) { m_World->SetBlock(Position, E_BLOCK_FIRE, 0); } diff --git a/src/Entities/Entity.cpp b/src/Entities/Entity.cpp index 8788a8ce5..0718da06c 100644 --- a/src/Entities/Entity.cpp +++ b/src/Entities/Entity.cpp @@ -1131,7 +1131,7 @@ void cEntity::HandlePhysics(std::chrono::milliseconds a_Dt, cChunk & a_Chunk) } // Get water direction - Vector3f WaterDir = m_World->GetWaterSimulator()->GetFlowingDirection(BlockX, BlockY, BlockZ); + Vector3f WaterDir = m_World->GetWaterSimulator()->GetFlowingDirection({BlockX, BlockY, BlockZ}); m_WaterSpeed *= 0.9; // Reduce speed each tick @@ -1433,7 +1433,7 @@ bool cEntity::DetectPortal() return false; } - if (const auto Position = m_Position.Floor(); cChunkDef::IsValidHeight(Position.y)) + if (const auto Position = m_Position.Floor(); cChunkDef::IsValidHeight(Position)) { switch (GetWorld()->GetBlock(Position)) { diff --git a/src/Entities/Pawn.cpp b/src/Entities/Pawn.cpp index 361450349..990ea8096 100644 --- a/src/Entities/Pawn.cpp +++ b/src/Entities/Pawn.cpp @@ -320,7 +320,7 @@ void cPawn::HandleFalling(void) With this in mind, we first check the block at the player's feet, then the one below that (because fences), and decide which behaviour we want to go with. */ - BLOCKTYPE BlockAtFoot = (cChunkDef::IsValidHeight(POSY_TOINT)) ? GetWorld()->GetBlock(POS_TOINT) : static_cast(E_BLOCK_AIR); + BLOCKTYPE BlockAtFoot = (cChunkDef::IsValidHeight(POS_TOINT)) ? GetWorld()->GetBlock(POS_TOINT) : static_cast(E_BLOCK_AIR); /* We initialize these with what the foot is really IN, because for sampling we will move down with the epsilon above */ bool IsFootInWater = IsBlockWater(BlockAtFoot); @@ -364,7 +364,7 @@ void cPawn::HandleFalling(void) { Vector3i BlockTestPosition = CrossTestPosition.Floor() + BlockSampleOffsets[j]; - if (!cChunkDef::IsValidHeight(BlockTestPosition.y)) + if (!cChunkDef::IsValidHeight(BlockTestPosition)) { continue; } diff --git a/src/Entities/Player.cpp b/src/Entities/Player.cpp index 376f431eb..04a7f9be0 100644 --- a/src/Entities/Player.cpp +++ b/src/Entities/Player.cpp @@ -2192,7 +2192,7 @@ bool cPlayer::IsClimbing(void) const { const auto Position = GetPosition().Floor(); - if (!cChunkDef::IsValidHeight(Position.y)) + if (!cChunkDef::IsValidHeight(Position)) { return false; } @@ -2579,7 +2579,7 @@ bool cPlayer::IsInsideWater() { const auto EyePos = GetEyePosition().Floor(); - if (!cChunkDef::IsValidHeight(EyePos.y)) + if (!cChunkDef::IsValidHeight(EyePos)) { // Not in water if in void. return false; -- cgit v1.2.3