Hello, I am porting pc factions (by massive core) over to pe. Not a crappy featureless port. I mean the whole deal. I need help with: Getting chunk coords at current player location (like return chunk number ex: 2,5) This is for claiming and /f map This plugins source will eventually be released to the community.
You can get an chunk with this: PHP: Level::getChunk($x >> 4, $z >> 4, true); And your chunk numbers would be: PHP: $ChunkIDp1 = $x >> 4$ChunkIDp2 = $z >> 4//(so for example$ChunkNumber = $ChunkIDp1.",".$ChunkIDp2 = ;//)
Some code: PHP: $x = //PLAYER x$y = //PLAYER y$ChunkIDp1 = $x >> 4;$ChunkIDp2 = $z >> 4;//(so for example$ChunkNumber = $ChunkIDp1.",".$ChunkIDp2;echo($ChunkNumber); //outputs for example 3,4//)//So you can do the following to save chunk reservations:$ChunkIDp1 = $x >> 4;$ChunkIDp2 = $z >> 4;$ReservedChunks[$id] = [$ChunkIDp1,$ChunkIDp2]; You can also get an chunk with this: PHP: Level::getChunk($x >> 4, $z >> 4, true);