mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-05-15 02:09:42 +00:00
added creative mode check for block picking
This commit is contained in:
parent
674394c4f5
commit
23ed3334c2
@ -2416,18 +2416,21 @@ class Player extends Human implements CommandSender, InventoryHolder, ChunkLoade
|
|||||||
}
|
}
|
||||||
|
|
||||||
public function handleBlockPickRequest(BlockPickRequestPacket $packet) : bool{
|
public function handleBlockPickRequest(BlockPickRequestPacket $packet) : bool{
|
||||||
$tile = $this->getLevel()->getTile($this->temporalVector->setComponents($packet->tileX, $packet->tileY, $packet->tileZ));
|
if($this->isCreative()){
|
||||||
if($tile instanceof Tile){ //TODO: check if the held item matches the target tile
|
$tile = $this->getLevel()->getTile($this->temporalVector->setComponents($packet->tileX, $packet->tileY, $packet->tileZ));
|
||||||
$nbt = $tile->getCleanedNBT();
|
if($tile instanceof Tile){ //TODO: check if the held item matches the target tile
|
||||||
if($nbt instanceof CompoundTag){
|
$nbt = $tile->getCleanedNBT();
|
||||||
$item = $this->inventory->getItemInHand();
|
if($nbt instanceof CompoundTag){
|
||||||
$item->setCustomBlockData($nbt);
|
$item = $this->inventory->getItemInHand();
|
||||||
$item->setLore(["+(DATA)"]);
|
$item->setCustomBlockData($nbt);
|
||||||
$this->inventory->setItemInHand($item);
|
$item->setLore(["+(DATA)"]);
|
||||||
}
|
$this->inventory->setItemInHand($item);
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user