summaryrefslogtreecommitdiffstats
path: root/src/Entities
diff options
context:
space:
mode:
authorandrew <xdotftw@gmail.com>2014-03-01 20:34:19 +0100
committerandrew <xdotftw@gmail.com>2014-03-01 20:34:19 +0100
commitd73cdba1f66a92f011ac881b581595c0959139ef (patch)
treea5c62bbc0cf7c52727e96e348a5978698c6c7a5d /src/Entities
parentRefactored global block property arrays (diff)
downloadcuberite-d73cdba1f66a92f011ac881b581595c0959139ef.tar
cuberite-d73cdba1f66a92f011ac881b581595c0959139ef.tar.gz
cuberite-d73cdba1f66a92f011ac881b581595c0959139ef.tar.bz2
cuberite-d73cdba1f66a92f011ac881b581595c0959139ef.tar.lz
cuberite-d73cdba1f66a92f011ac881b581595c0959139ef.tar.xz
cuberite-d73cdba1f66a92f011ac881b581595c0959139ef.tar.zst
cuberite-d73cdba1f66a92f011ac881b581595c0959139ef.zip
Diffstat (limited to '')
-rw-r--r--src/Entities/Entity.cpp6
-rw-r--r--src/Entities/Minecart.cpp16
-rw-r--r--src/Entities/Player.cpp2
-rw-r--r--src/Entities/ProjectileEntity.cpp4
4 files changed, 14 insertions, 14 deletions
diff --git a/src/Entities/Entity.cpp b/src/Entities/Entity.cpp
index 8554ab2a5..96e8c15a5 100644
--- a/src/Entities/Entity.cpp
+++ b/src/Entities/Entity.cpp
@@ -582,11 +582,11 @@ void cEntity::HandlePhysics(float a_Dt, cChunk & a_Chunk)
int RelBlockZ = BlockZ - (NextChunk->GetPosZ() * cChunkDef::Width);
BLOCKTYPE BlockIn = NextChunk->GetBlock( RelBlockX, BlockY, RelBlockZ );
BLOCKTYPE BlockBelow = (BlockY > 0) ? NextChunk->GetBlock(RelBlockX, BlockY - 1, RelBlockZ) : E_BLOCK_AIR;
- if (!g_BlockIsSolid[BlockIn]) // Making sure we are not inside a solid block
+ if (!cBlockInfo::IsSolid(BlockIn)) // Making sure we are not inside a solid block
{
if (m_bOnGround) // check if it's still on the ground
{
- if (!g_BlockIsSolid[BlockBelow]) // Check if block below is air or water.
+ if (!cBlockInfo::IsSolid(BlockBelow)) // Check if block below is air or water.
{
m_bOnGround = false;
}
@@ -616,7 +616,7 @@ void cEntity::HandlePhysics(float a_Dt, cChunk & a_Chunk)
// The pickup is too close to an unloaded chunk, bail out of any physics handling
return;
}
- if (!g_BlockIsSolid[GotBlock])
+ if (!cBlockInfo::IsSolid(GotBlock))
{
NextPos.x += gCrossCoords[i].x;
NextPos.z += gCrossCoords[i].z;
diff --git a/src/Entities/Minecart.cpp b/src/Entities/Minecart.cpp
index d854906b7..f52a7b6d9 100644
--- a/src/Entities/Minecart.cpp
+++ b/src/Entities/Minecart.cpp
@@ -720,7 +720,7 @@ bool cMinecart::TestBlockCollision(NIBBLETYPE a_RailMeta)
if (GetSpeedZ() > 0)
{
BLOCKTYPE Block = m_World->GetBlock((int)floor(GetPosX()), (int)floor(GetPosY()), (int)ceil(GetPosZ()));
- if (!IsBlockRail(Block) && g_BlockIsSolid[Block])
+ if (!IsBlockRail(Block) && cBlockInfo::IsSolid(Block))
{
// We could try to detect a block in front based purely on coordinates, but xoft made a bounding box system - why not use? :P
cBoundingBox bbBlock(Vector3d((int)floor(GetPosX()), (int)floor(GetPosY()), (int)ceil(GetPosZ())), 0.5, 1);
@@ -737,7 +737,7 @@ bool cMinecart::TestBlockCollision(NIBBLETYPE a_RailMeta)
else if (GetSpeedZ() < 0)
{
BLOCKTYPE Block = m_World->GetBlock((int)floor(GetPosX()), (int)floor(GetPosY()), (int)floor(GetPosZ()) - 1);
- if (!IsBlockRail(Block) && g_BlockIsSolid[Block])
+ if (!IsBlockRail(Block) && cBlockInfo::IsSolid(Block))
{
cBoundingBox bbBlock(Vector3d((int)floor(GetPosX()), (int)floor(GetPosY()), (int)floor(GetPosZ()) - 1), 0.5, 1);
cBoundingBox bbMinecart(Vector3d(GetPosX(), floor(GetPosY()), GetPosZ() - 1), GetWidth() / 2, GetHeight());
@@ -757,7 +757,7 @@ bool cMinecart::TestBlockCollision(NIBBLETYPE a_RailMeta)
if (GetSpeedX() > 0)
{
BLOCKTYPE Block = m_World->GetBlock((int)ceil(GetPosX()), (int)floor(GetPosY()), (int)floor(GetPosZ()));
- if (!IsBlockRail(Block) && g_BlockIsSolid[Block])
+ if (!IsBlockRail(Block) && cBlockInfo::IsSolid(Block))
{
cBoundingBox bbBlock(Vector3d((int)ceil(GetPosX()), (int)floor(GetPosY()), (int)floor(GetPosZ())), 0.5, 1);
cBoundingBox bbMinecart(Vector3d(GetPosX(), floor(GetPosY()), GetPosZ()), GetWidth() / 2, GetHeight());
@@ -773,7 +773,7 @@ bool cMinecart::TestBlockCollision(NIBBLETYPE a_RailMeta)
else if (GetSpeedX() < 0)
{
BLOCKTYPE Block = m_World->GetBlock((int)floor(GetPosX()) - 1, (int)floor(GetPosY()), (int)floor(GetPosZ()));
- if (!IsBlockRail(Block) && g_BlockIsSolid[Block])
+ if (!IsBlockRail(Block) && cBlockInfo::IsSolid(Block))
{
cBoundingBox bbBlock(Vector3d((int)floor(GetPosX()) - 1, (int)floor(GetPosY()), (int)floor(GetPosZ())), 0.5, 1);
cBoundingBox bbMinecart(Vector3d(GetPosX() - 1, floor(GetPosY()), GetPosZ()), GetWidth() / 2, GetHeight());
@@ -798,10 +798,10 @@ bool cMinecart::TestBlockCollision(NIBBLETYPE a_RailMeta)
BLOCKTYPE BlockZM = m_World->GetBlock((int)floor(GetPosX()), (int)floor(GetPosY()), (int)floor(GetPosZ()) + 1);
BLOCKTYPE BlockZP = m_World->GetBlock((int)floor(GetPosX()), (int)floor(GetPosY()), (int)floor(GetPosZ()) + 1);
if (
- (!IsBlockRail(BlockXM) && g_BlockIsSolid[BlockXM]) ||
- (!IsBlockRail(BlockXP) && g_BlockIsSolid[BlockXP]) ||
- (!IsBlockRail(BlockZM) && g_BlockIsSolid[BlockZM]) ||
- (!IsBlockRail(BlockZP) && g_BlockIsSolid[BlockZP])
+ (!IsBlockRail(BlockXM) && cBlockInfo::IsSolid(BlockXM)) ||
+ (!IsBlockRail(BlockXP) && cBlockInfo::IsSolid(BlockXP)) ||
+ (!IsBlockRail(BlockZM) && cBlockInfo::IsSolid(BlockZM)) ||
+ (!IsBlockRail(BlockZP) && cBlockInfo::IsSolid(BlockZP))
)
{
SetSpeed(0, 0, 0);
diff --git a/src/Entities/Player.cpp b/src/Entities/Player.cpp
index 8f94f1feb..42ee14cf3 100644
--- a/src/Entities/Player.cpp
+++ b/src/Entities/Player.cpp
@@ -1904,7 +1904,7 @@ void cPlayer::Detach()
{
for (int z = PosZ - 2; z <= (PosZ + 2); ++z)
{
- if (!g_BlockIsSolid[m_World->GetBlock(x, y, z)] && g_BlockIsSolid[m_World->GetBlock(x, y - 1, z)])
+ if (!cBlockInfo::IsSolid(m_World->GetBlock(x, y, z)) && cBlockInfo::IsSolid(m_World->GetBlock(x, y - 1, z)))
{
TeleportToCoords(x, y, z);
return;
diff --git a/src/Entities/ProjectileEntity.cpp b/src/Entities/ProjectileEntity.cpp
index ef82c6e94..03bc0c99d 100644
--- a/src/Entities/ProjectileEntity.cpp
+++ b/src/Entities/ProjectileEntity.cpp
@@ -50,12 +50,12 @@ protected:
LOGD("Hit block %d:%d at {%d, %d, %d} face %d, %s (%s)",
a_BlockType, a_BlockMeta,
a_BlockX, a_BlockY, a_BlockZ, a_EntryFace,
- g_BlockIsSolid[a_BlockType] ? "solid" : "non-solid",
+ cBlockInfo::IsSolid(a_BlockType) ? "solid" : "non-solid",
ItemToString(cItem(a_BlockType, 1, a_BlockMeta)).c_str()
);
*/
- if (g_BlockIsSolid[a_BlockType])
+ if (cBlockInfo::IsSolid(a_BlockType))
{
// The projectile hit a solid block
// Calculate the exact hit coords: