summaryrefslogtreecommitdiffstats
path: root/src/NetherPortalScanner.cpp
diff options
context:
space:
mode:
authorTiger Wang <ziwei.tiger@outlook.com>2020-04-10 22:08:19 +0200
committerTiger Wang <ziwei.tiger@outlook.com>2020-04-18 20:51:30 +0200
commit50893667db7d158918a2fd2dd30f68591b4d46ac (patch)
treefa182e3e4f4171c8dc766eada816d072cadc62a4 /src/NetherPortalScanner.cpp
parentOnly store IDs across ticks (diff)
downloadcuberite-50893667db7d158918a2fd2dd30f68591b4d46ac.tar
cuberite-50893667db7d158918a2fd2dd30f68591b4d46ac.tar.gz
cuberite-50893667db7d158918a2fd2dd30f68591b4d46ac.tar.bz2
cuberite-50893667db7d158918a2fd2dd30f68591b4d46ac.tar.lz
cuberite-50893667db7d158918a2fd2dd30f68591b4d46ac.tar.xz
cuberite-50893667db7d158918a2fd2dd30f68591b4d46ac.tar.zst
cuberite-50893667db7d158918a2fd2dd30f68591b4d46ac.zip
Diffstat (limited to '')
-rw-r--r--src/NetherPortalScanner.cpp42
1 files changed, 21 insertions, 21 deletions
diff --git a/src/NetherPortalScanner.cpp b/src/NetherPortalScanner.cpp
index 386da61fb..10ea64f02 100644
--- a/src/NetherPortalScanner.cpp
+++ b/src/NetherPortalScanner.cpp
@@ -17,7 +17,7 @@ const double cNetherPortalScanner::AcrossOffset = 0.5;
-cNetherPortalScanner::cNetherPortalScanner(cEntity & a_MovingEntity, cWorld * a_DestinationWorld, Vector3d a_DestPosition, int a_MaxY) :
+cNetherPortalScanner::cNetherPortalScanner(cEntity & a_MovingEntity, cWorld & a_DestinationWorld, Vector3d a_DestPosition, int a_MaxY) :
m_EntityID(a_MovingEntity.GetUniqueID()),
m_SourceWorld(*a_MovingEntity.GetWorld()),
m_World(a_DestinationWorld),
@@ -39,7 +39,7 @@ cNetherPortalScanner::cNetherPortalScanner(cEntity & a_MovingEntity, cWorld * a_
Add(x, z);
}
}
- Enable(*a_DestinationWorld->GetChunkMap());
+ Enable(*a_DestinationWorld.GetChunkMap());
}
@@ -49,7 +49,7 @@ cNetherPortalScanner::cNetherPortalScanner(cEntity & a_MovingEntity, cWorld * a_
void cNetherPortalScanner::OnChunkAvailable(int a_ChunkX, int a_ChunkZ)
{
cChunkDef::BlockTypes blocks;
- m_World->GetChunkBlockTypes(a_ChunkX, a_ChunkZ, blocks);
+ m_World.GetChunkBlockTypes(a_ChunkX, a_ChunkZ, blocks);
// Iterate through all of the blocks in the chunk
for (unsigned int i = 0; i < cChunkDef::NumBlocks; i++)
@@ -92,7 +92,7 @@ bool cNetherPortalScanner::IsValidBuildLocation(Vector3i a_BlockPos)
{
for (int j = 0; j < PortalLength; j++)
{
- BLOCKTYPE blocktype = m_World->GetBlock(a_BlockPos.x + i, a_BlockPos.y, a_BlockPos.z + j);
+ BLOCKTYPE blocktype = m_World.GetBlock(a_BlockPos.x + i, a_BlockPos.y, a_BlockPos.z + j);
if (!cBlockInfo::IsSolid(blocktype))
{
return false;
@@ -101,7 +101,7 @@ bool cNetherPortalScanner::IsValidBuildLocation(Vector3i a_BlockPos)
// Check the airspace
for (int k = 1; k < PortalHeight; k++)
{
- blocktype = m_World->GetBlock(a_BlockPos.x + i, a_BlockPos.y + k, a_BlockPos.z + j);
+ blocktype = m_World.GetBlock(a_BlockPos.x + i, a_BlockPos.y + k, a_BlockPos.z + j);
if (blocktype != E_BLOCK_AIR)
{
return false;
@@ -121,15 +121,15 @@ bool cNetherPortalScanner::OnAllChunksAvailable(void)
if (m_FoundPortal)
{
// Find the bottom of this portal
- while (m_World->GetBlock(m_PortalLoc.x, m_PortalLoc.y, m_PortalLoc.z) == E_BLOCK_NETHER_PORTAL)
+ while (m_World.GetBlock(m_PortalLoc.x, m_PortalLoc.y, m_PortalLoc.z) == E_BLOCK_NETHER_PORTAL)
{
m_PortalLoc.y -= 1;
}
m_PortalLoc.y += 1;
// Figure out which way the portal is facing
- int BXP = m_World->GetBlock(m_PortalLoc.x + 1, m_PortalLoc.y, m_PortalLoc.z);
- int BXM = m_World->GetBlock(m_PortalLoc.x - 1, m_PortalLoc.y, m_PortalLoc.z);
+ int BXP = m_World.GetBlock(m_PortalLoc.x + 1, m_PortalLoc.y, m_PortalLoc.z);
+ int BXM = m_World.GetBlock(m_PortalLoc.x - 1, m_PortalLoc.y, m_PortalLoc.z);
if ((BXP == E_BLOCK_NETHER_PORTAL) || (BXM == E_BLOCK_NETHER_PORTAL))
{
// The long axis is along X
@@ -208,11 +208,11 @@ void cNetherPortalScanner::BuildNetherPortal(Vector3i a_Location, Direction a_Di
{
if (a_Direction == Direction::Y)
{
- m_World->SetBlock(x + i, y + k, z + j, E_BLOCK_AIR, 0);
+ m_World.SetBlock(x + i, y + k, z + j, E_BLOCK_AIR, 0);
}
else if (a_Direction == Direction::X)
{
- m_World->SetBlock(x + j, y + k, z + i, E_BLOCK_AIR, 0);
+ m_World.SetBlock(x + j, y + k, z + i, E_BLOCK_AIR, 0);
}
}
}
@@ -226,11 +226,11 @@ void cNetherPortalScanner::BuildNetherPortal(Vector3i a_Location, Direction a_Di
// +2 on the short axis because that's where we deposit the entity
if (a_Direction == Direction::Y)
{
- m_World->SetBlock(x + 2, y, z + j, E_BLOCK_OBSIDIAN, 0);
+ m_World.SetBlock(x + 2, y, z + j, E_BLOCK_OBSIDIAN, 0);
}
else if (a_Direction == Direction::X)
{
- m_World->SetBlock(x + j, y, z + 2, E_BLOCK_OBSIDIAN, 0);
+ m_World.SetBlock(x + j, y, z + 2, E_BLOCK_OBSIDIAN, 0);
}
}
}
@@ -240,31 +240,31 @@ void cNetherPortalScanner::BuildNetherPortal(Vector3i a_Location, Direction a_Di
{
if (a_Direction == Direction::Y)
{
- m_World->SetBlock(x + 1, y + i, z, E_BLOCK_OBSIDIAN, 0);
- m_World->SetBlock(x + 1, y + i, z + 3, E_BLOCK_OBSIDIAN, 0);
+ m_World.SetBlock(x + 1, y + i, z, E_BLOCK_OBSIDIAN, 0);
+ m_World.SetBlock(x + 1, y + i, z + 3, E_BLOCK_OBSIDIAN, 0);
}
else if (a_Direction == Direction::X)
{
- m_World->SetBlock(x, y + i, z + 1, E_BLOCK_OBSIDIAN, 0);
- m_World->SetBlock(x + 3, y + i, z + 1, E_BLOCK_OBSIDIAN, 0);
+ m_World.SetBlock(x, y + i, z + 1, E_BLOCK_OBSIDIAN, 0);
+ m_World.SetBlock(x + 3, y + i, z + 1, E_BLOCK_OBSIDIAN, 0);
}
}
for (int i = 0; i < PortalLength; i++)
{
if (a_Direction == Direction::Y)
{
- m_World->SetBlock(x + 1, y + 4, z + i, E_BLOCK_OBSIDIAN, 0);
- m_World->SetBlock(x + 1, y, z + i, E_BLOCK_OBSIDIAN, 0);
+ m_World.SetBlock(x + 1, y + 4, z + i, E_BLOCK_OBSIDIAN, 0);
+ m_World.SetBlock(x + 1, y, z + i, E_BLOCK_OBSIDIAN, 0);
}
else if (a_Direction == Direction::X)
{
- m_World->SetBlock(x + i, y + 4, z + 1, E_BLOCK_OBSIDIAN, 0);
- m_World->SetBlock(x + i, y, z + 1, E_BLOCK_OBSIDIAN, 0);
+ m_World.SetBlock(x + i, y + 4, z + 1, E_BLOCK_OBSIDIAN, 0);
+ m_World.SetBlock(x + i, y, z + 1, E_BLOCK_OBSIDIAN, 0);
}
}
// Fill the frame (place a fire in the bottom)
- m_World->SetBlock(x + 1, y + 1, z + 1, E_BLOCK_FIRE, 0);
+ m_World.SetBlock(x + 1, y + 1, z + 1, E_BLOCK_FIRE, 0);
}