mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-06-12 06:25:32 +00:00
World: disallow block placement and breaking in unloaded, ungenerated and locked chunks
This commit is contained in:
parent
bacdb7bde5
commit
1c49cedc8c
@ -1509,6 +1509,13 @@ class World implements ChunkManager{
|
||||
*/
|
||||
public function useBreakOn(Vector3 $vector, Item &$item = null, ?Player $player = null, bool $createParticles = false) : bool{
|
||||
$vector = $vector->floor();
|
||||
|
||||
$chunkX = $vector->getFloorX() >> 4;
|
||||
$chunkZ = $vector->getFloorZ() >> 4;
|
||||
if(!$this->isChunkLoaded($chunkX, $chunkZ) || !$this->isChunkGenerated($chunkX, $chunkZ) || $this->isChunkLocked($chunkX, $chunkZ)){
|
||||
return false;
|
||||
}
|
||||
|
||||
$target = $this->getBlock($vector);
|
||||
$affectedBlocks = $target->getAffectedBlocks();
|
||||
|
||||
@ -1614,6 +1621,11 @@ class World implements ChunkManager{
|
||||
//TODO: build height limit messages for custom world heights and mcregion cap
|
||||
return false;
|
||||
}
|
||||
$chunkX = $blockReplace->getPos()->getFloorX() >> 4;
|
||||
$chunkZ = $blockReplace->getPos()->getFloorZ() >> 4;
|
||||
if(!$this->isChunkLoaded($chunkX, $chunkZ) || !$this->isChunkGenerated($chunkX, $chunkZ) || $this->isChunkLocked($chunkX, $chunkZ)){
|
||||
return false;
|
||||
}
|
||||
|
||||
if($blockClicked->getId() === BlockLegacyIds::AIR){
|
||||
return false;
|
||||
|
Loading…
x
Reference in New Issue
Block a user