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

Function checkBound

Source/World/Chunk/BoundsCheck.cpp:20–32  ·  view source on GitHub ↗

* Checks for the position of block passed in. * If the block position is out of the chunks bounds * (see the if statements) * It will correct the position to be within a neighbouring chunks bounds * It also takes in "change", which says which direction the neighbouring chunk * is located. */

Source from the content-addressed store, hash-verified

18 * is located.
19 */
20 void checkBound(int& pos, int& change)
21 {
22 if (pos > CHUNK_SIZE - 1)
23 {
24 change = 1;
25 pos -= CHUNK_SIZE;
26 }
27 else if (pos < 0)
28 {
29 change = -1;
30 pos += CHUNK_SIZE;
31 }
32 }
33 }
34/*
35 * Tries to get a get chunk section based on the block position relative to the "default chunk"

Callers 2

getSectionFunction · 0.85
getConstSectionFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected