1
0

Properly deprecate more XYZ parameter'd functions (#5147)

* Fixes #5144
This commit is contained in:
Tiger Wang
2021-03-15 02:28:18 +00:00
committed by GitHub
parent c729d7abde
commit 45591cbe7b
22 changed files with 530 additions and 296 deletions

View File

@@ -2200,16 +2200,14 @@ void cPlayer::HandleFloater()
bool cPlayer::IsClimbing(void) const
{
int PosX = POSX_TOINT;
int PosY = POSY_TOINT;
int PosZ = POSZ_TOINT;
const auto Position = GetPosition().Floor();
if ((PosY < 0) || (PosY >= cChunkDef::Height))
if (!cChunkDef::IsValidHeight(Position.y))
{
return false;
}
BLOCKTYPE Block = m_World->GetBlock(PosX, PosY, PosZ);
BLOCKTYPE Block = m_World->GetBlock(Position);
switch (Block)
{
case E_BLOCK_LADDER:
@@ -2423,12 +2421,12 @@ bool cPlayer::DoesPlacingBlocksIntersectEntity(const sSetBlockVector & a_Blocks)
int y = blk.GetY();
int z = blk.GetZ();
cBoundingBox BlockBox = cBlockHandler::For(blk.m_BlockType).GetPlacementCollisionBox(
m_World->GetBlock(x - 1, y, z),
m_World->GetBlock(x + 1, y, z),
(y == 0) ? E_BLOCK_AIR : m_World->GetBlock(x, y - 1, z),
(y == cChunkDef::Height - 1) ? E_BLOCK_AIR : m_World->GetBlock(x, y + 1, z),
m_World->GetBlock(x, y, z - 1),
m_World->GetBlock(x, y, z + 1)
m_World->GetBlock({ x - 1, y, z }),
m_World->GetBlock({ x + 1, y, z }),
(y == 0) ? E_BLOCK_AIR : m_World->GetBlock({ x, y - 1, z }),
(y == cChunkDef::Height - 1) ? E_BLOCK_AIR : m_World->GetBlock({ x, y + 1, z }),
m_World->GetBlock({ x, y, z - 1 }),
m_World->GetBlock({ x, y, z + 1 })
);
BlockBox.Move(x, y, z);
@@ -2591,9 +2589,9 @@ void cPlayer::Detach()
for (int z = PosZ - 1; z <= (PosZ + 1); ++z)
{
if (
(m_World->GetBlock(x, y, z) == E_BLOCK_AIR) &&
(m_World->GetBlock(x, y + 1, z) == E_BLOCK_AIR) &&
cBlockInfo::IsSolid(m_World->GetBlock(x, y - 1, z))
(m_World->GetBlock({ x, y, z }) == E_BLOCK_AIR) &&
(m_World->GetBlock({ x, y + 1, z }) == E_BLOCK_AIR) &&
cBlockInfo::IsSolid(m_World->GetBlock({ x, y - 1, z }))
)
{
TeleportToCoords(x + 0.5, y, z + 0.5);
@@ -2674,12 +2672,12 @@ float cPlayer::GetLiquidHeightPercent(NIBBLETYPE a_Meta)
bool cPlayer::IsInsideWater()
{
BLOCKTYPE Block = m_World->GetBlock(FloorC(GetPosX()), FloorC(m_Stance), FloorC(GetPosZ()));
BLOCKTYPE Block = m_World->GetBlock(Vector3d(GetPosX(), m_Stance, GetPosZ()).Floor());
if ((Block != E_BLOCK_WATER) && (Block != E_BLOCK_STATIONARY_WATER))
{
return false;
}
NIBBLETYPE Meta = GetWorld()->GetBlockMeta(FloorC(GetPosX()), FloorC(m_Stance), FloorC(GetPosZ()));
NIBBLETYPE Meta = GetWorld()->GetBlockMeta(Vector3d(GetPosX(), m_Stance, GetPosZ()).Floor());
float f = GetLiquidHeightPercent(Meta) - 0.11111111f;
float f1 = static_cast<float>(m_Stance + 1) - f;
bool flag = (m_Stance < f1);