pocketmine\level\GameRules::writeToNBT PHP Method

writeToNBT() public method

Return the defined game rules as NBT.
public writeToNBT ( )
    public function writeToNBT()
    {
        $compoundarray = [];
        foreach ($this->theGameRules as $key => $value) {
            $compoundarray[] = NBT::fromArrayGuesser($key, $value);
        }
        $nbttagcompound = new CompoundTag("GameRules", $compoundarray);
        return $nbttagcompound;
    }