MCPcopy Create free account
hub / github.com/Hopson97/HopsonCraft / getBlock

Method getBlock

Source/World/World.cpp:130–144  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

128
129
130CBlock World::getBlock (int x, int y, int z) const
131{
132 Vector3 position(x, y, z);
133 auto chunkPos = Maths::Convert::worldToChunkPosition(position);
134
135 if (m_chunks.existsAt(chunkPos))
136 {
137 auto blockPosition = Maths::Convert::worldToChunkBlockPosition(position);
138 return m_chunks.get(chunkPos)->qGetBlock(blockPosition);
139 }
140 else
141 {
142 return Block::ID::Air;
143 }
144}
145
146void World::qSetBlock(const Vector3& position, CBlock block)
147{

Callers 2

editBlockInputMethod · 0.45
collisionTestMethod · 0.45

Calls 5

worldToChunkPositionFunction · 0.85
existsAtMethod · 0.80
getMethod · 0.80
qGetBlockMethod · 0.45

Tested by

no test coverage detected